Repository navigation
build: workaround link error with LTO and mingw - #8674
Conversation
|
That's the correct solution. Linking to a github issue in the comment is not that useful, writing a few words on why it's being disabled is much better |
mmm. I don't get it. |
074f90b to
ad00754
Compare
After some cursory testing it seems that the external symbols introduced by LLVM during the expansion of the thread-local accesses are not taken into account when computing the LTO module index. This is probably worth reporting upstream. |
|
I've added a test for the issue. (linking a c file and a zig file, with threadlocal variables) All is fine in debug builds. However, in release builds:
I guess I can disable the test on macos, but I don't know about the debug info warnings. |
|
Also, the test links with libC, but it's not actually used. However if I remove it, of course, the workaround for windows release builds is not used, and once again the linker can't seem to find |
e1ec251 to
fbe6d2a
Compare
The symbol "_tls_index" gets lost when using LTO. Disabling LTO on the object file that defines it allows the link to work. fixes ziglang#8531
* Annotate workarounds with their corresponding GitHub issue links. * Enable test coverage for LTO on Windows with the added c_compiler test.
|
Thank you for this work, and apologies for the delayed merge. I'm adding a comment on #8531 now. |
The symbol "_tls_index" gets lost when using LTO.
Disabling LTO only on the object file that defines it allows the link to work.
I have no idea what I'm doing :)
I tried a few random things in
tlssup.cto see if the symbol would stay, with no success.Short of actually figuring out the issue, maybe it would be cleaner to just drop LTO on the whole mingw32.lib?
I also tried to test with x86_64-windows-msvc, but no idea how to make it work at all when linking with libC.
fixes #8531
Maybe related:
as soon as a xxx.c file is linked (even if no symbols are pulled from it), I get a warning: