New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix undefined symbol errors #1180
Conversation
After commit fd75e73 ("add f16 type"), the Ubuntu CI machine started failing with the following link-time errors: lld: error: undefined symbol: __gnu_f2h_ieee >>> referenced by math.zig:9(/home/travis/build/ziglang/zig/test/cases/math.zig:9) >>> ./zig-cache/test.o:(testDivision) lld: error: undefined symbol: __gnu_h2f_ieee >>> referenced by math.zig:9(/home/travis/build/ziglang/zig/test/cases/math.zig:9) >>> ./zig-cache/test.o:(testDivision) Export the symbols unconditionally except on MacOS. This follows the logic in LLVM's lib/CodeGen/TargetLoweringBase.cpp. Don't export the symbols when testing on Windows because it results in duplicate symbol errors when linking the compiler_rt tests (but not other tests.)
It's a bit of a puzzle but I hope I have it right now. To summarize:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Still failing. Back to the drawing board... It's weird I can't reproduce on a local trusty system with the packages from apt.llvm.org. Will need to study this more. |
I think I know what's going on here. Here's the failing test with
On linux we don't link compiler_rt.o when we link against libc, because when we link against libc we also link with Lines 551 to 560 in 0206b76
The comment is a bit outdated - we've since changed the linkage of compiler-rt symbols to Weak. So I think we can change the ELF linking logic to be the same as this windows linking logic. |
I believe this is fixed by 2759c79. Tests passed for me locally. |
I don't know what's going on with the macos failure. I'll have access to my mac laptop in 2 days. |
Nice work, Andrew! Glad to see linux is working again. I'll try to take a look at macos tomorrow. |
After commit fd75e73 ("add f16 type"), the Ubuntu CI machine started
failing with the following link-time errors:
Define the symbols unconditionally except on MacOS. This follows the
logic in LLVM's lib/CodeGen/TargetLoweringBase.cpp.
(This works for me locally but let's see how it fares on the CI.)