-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
wip! mold: fatal: failed to load plugin : /usr/bin/ld: undefined symbol: onload #1358
Comments
The linker complains that you passed |
I have a similar error, not sure if/how it is related to okias' one. I am on Gentoo, using clang 19.1.7 as system compiler. I recompiled my whole system with mold using with the following flags:
I have noticed quite a few packages that fail at link stage, I suspect because clang is not detecting that it should pass the LTO options to the linker. This happens in some packages using libtool, but the simplest reproducer I could find is If I use the flags above, I get this invocation at link stage:
If I override LDFLAGS by adding the LTO options ->
I get a proper link instead:
The difference that I could find between the two invocations is that on the successful one I'm not sure if this is an issue with clang or mold - would you be able to point me in the right direction? |
@fsvm88 Can you build it with GNU ld? In other words, can you build it if you replace |
I get a
It seems also in this case the flags are not passed down by clang. I'm not sure whether this is expected though: when |
LLVM lld is, as a subproject of LLVM, supports LLVM bitcode natively, so it doesn't require a plugin to read LLVM object files. (By the way, on the other hand, lld supports only the corresponding version of LLVM. If you are using clang-19, you need to use lld-19 for LTO.) GNU ld and mold don't support LLVM bitcode natively. It's clang's responsibility to pass a plugin path to the linker. That's what the Maybe your clang doesn't come with a plugin file. The plugin file is usually named |
On Gentoo this is configured via The plugin is built in LLVM itself, and it is present on my system -> I did some deeper digging, it seems this is a known issue with non-LLD linkers. CFLAGS need to be part of LDFLAGS if the compiler is used to invoke the linker. |
I need to test against default linker in CI, if this will happen too, but so far it could be on mold side, so dropping here as WIP report-in-progress.
Ref: https://gitlab.freedesktop.org/dh/mesa/-/jobs/65017251 .
The text was updated successfully, but these errors were encountered: