TH_spliceE5_prof_ext fails with split-sections enabled on Windows
$ _build/stage1/bin/ghc -prof -itestsuite/tests/th testsuite/tests/th/TH_spliceE5_prof_ext -XTemplateHaskell -fexternal-interpreter
[2 of 3] Compiling Main ( testsuite\tests\th\TH_spliceE5_prof_ext.hs, testsuite\tests\th\TH_spliceE5_prof_ext.o )
ghc-iserv-prof: | C:\msys64\home\ben\ghc\_build\stage1\lib\x86_64-windows-ghc-9.7.20230208\template-haskell-2.20.0.0\libHStemplate-haskell-2.20.0.0_p.a: unknown symbol `templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info'
ghc-iserv-prof: | C:\msys64\home\ben\ghc\testsuite\tests\th\TH_spliceE5_prof_ext_Lib.o: unknown symbol `templatezmhaskell_LanguageziHaskellziTHziSyntax_mkName_closure'
ghc-iserv-prof: ^^ Could not load 'THzuspliceE5zuprofzuextzuLib_expandVars_closure', dependency unresolved. See top entry above.
<no location info>: error:
GHC.ByteCode.Linker.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
THzuspliceE5zuprofzuextzuLib_expandVars_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session. Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please report this as a GHC bug:
https://www.haskell.org/ghc/reportabug
Yet the symbol in question appears to be defined:
$ objdump -x _build/stage1/libraries/template-haskell/build/Language/Haskell/TH/Syntax.p_o | grep NameU_con_info
32888 .text$templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info 00000063 0000000000000000 0000000000000000 00581998 2**3
[65776](sec -32647)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x0000000000000000 .text$templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info
[66453](sec -32647)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x0000000000000028 templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info
00000000000000a7 IMAGE_REL_AMD64_REL32 templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info-0x0000000000000028
00000000000001b7 IMAGE_REL_AMD64_REL32 templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info-0x0000000000000028
00000000000000a7 IMAGE_REL_AMD64_REL32 templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info-0x0000000000000028
000000000000040f IMAGE_REL_AMD64_REL32 templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info-0x0000000000000028
RELOCATION RECORDS FOR [.text$templatezmhaskell_LanguageziHaskellziTHziSyntax_NameU_con_info]:
However, note the strange negative section number. Perhaps this is due to the PE bigobj extension? Sadly, I can find precisely zero documentation on the bigobj format so it's hard saying.
Edited by Ben Gamari