Closed rracariu closed 6 years ago
This looks like a lld bug
I'd guess so too. We don't treat LLD any different than the MS linker - codegen is the same, even the linker command-line arguments are. Just to rule out it has anything to do with our integration, you could use the lld-link.exe
from our LDC-LLVM packages (and -linker=lld-link
in the LDC cmdline).
The size seems to be around 50K; does 32K happen to be the magic threshold?
The results are the same for -linker=lld-link
.
I noticed that .rdata
section above 147992 will cause a crash (148K probably the round number).
Submitted the LLVM bug https://bugs.llvm.org/show_bug.cgi?id=38645
Thx; you'll probably have more luck/responses with an object file, ideally minimized to a betterC version, so that the guys can link themselves and debug what's wrong.
@rracariu: From the LLD 7 release log:
lld 7 for ELF, COFF and MinGW are production-ready. [...] lld/COFF is being used to create official builds of large popular programs such as Chrome and Firefox.
I tested the code above with LLVM 7, and it works for me. You can give it a shot yourself with https://github.com/ldc-developers/llvm/releases/download/CI/llvm-7.0.0-windows-x64-withAsserts.7z (e.g., -linker=...\lld-link
so that you don't need to recompile LDC).
@kinke I can confirm it works here with ldc 1.11.0 and the linker form LLVM7. Thanks for the update!
You may want to close this (v1.12-beta2 with LLVM 7 just released) and the LLD bug then.
On Windows using the
-link-internally
makes the following program crash (segmentation fault). This crashes both underLDC 1.10.0
andLDC 1.11.0
when building for Windows X86-64, the X86 32 bit variant doesn't crash.Linking with the system linker produces a working executable.
The bug is strange, it is related to the size of the enum string - shortening that makes the crash go away. This looks like a
lld
bug, but I want to get some input from LDC experts on why this bug exists so we can point the issue to the LLVM team. I'm suspecting the way data segments are linked is having issues with larger constants (see bottom with the sections report).Sections info as reported by https://github.com/zodiacon/PEExplorer