-
Notifications
You must be signed in to change notification settings - Fork 568
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
LTO does not work with Clang #6999
Comments
I don't see any reason we cannot support this. I've opened #8582 to fix this on our 3.0 branch. I found that setting |
Thanks for taking a look! Our team is still using 2.0 so a backport would be much appreciated. |
Got the same issue on a fresh Ubuntu 24.04 install. No idea how to fix it (can't find |
Describe the bug
When compiling a project using Clang, I am unable to use link-time optimization (LTO) due to the absence of /usr/lib/LLVMgold.so.
LLVMgold.so is a a linker plugin which is part of the LLVM/Clang project itself. It acts as "glue" between the Clang compiler driver and GNU
gold
, which is used to perform the actual linking when LTO is enabled. More information here:https://llvm.org/docs/GoldPlugin.html
LLVMgold.so appears to be missing from Mariner's
clang
package. Based on my reading of the spec files and LLVM's CMake files, I believe this is because LLVM_BINUTILS_INCDIR is not being specified at the time LLVM/Clang is built.Proposed fix:
binutils
package (which provides GNU gold) as a build-time dependency of theclang
package (orllvm
package, not sure which?)clang
and/orllvm
to specify LLVM_BINUTILS_INCDIR on the CMake command lineTo Reproduce
Steps to reproduce the behavior:
Expected behavior
Clang should compile and link the program without error, using LTO.
Next steps
Please advise whether the proposed fix above makes sense, or whether there is some additional context as to why this does not work.
If this seems okay, I am happy to submit a PR with these changes.
The text was updated successfully, but these errors were encountered: