-
Notifications
You must be signed in to change notification settings - Fork 544
Fix linker-plugin-lto: use -flto=thin
#1594
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
Conversation
| // It has to be thin LTO because llvm linker plugin/lld uses thin LTO by default. | ||
| // And for thin LTO to work, the archive also has to be compiled using thin LTO, | ||
| // since thin LTO generates extra information that fat LTO does not generate that | ||
| // is required for thin LTO process. |
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.
Six "thin LTO" in two sentences. Well, not that I care that much, but it does sting the eye. It also feels that it would look worse in isolation, i.e. not in the diff context. I mean
- push_if_supported(format!("-flto={cc_val}").into());
+ // It has to be thin LTO because llvm linker plugin/lld uses thin LTO by default.
looks like meaningful "rebuttal," while
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto
// It has to be thin LTO because llvm linker plugin/lld uses thin LTO by default.
feels like "wow, where does it come from?"
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.
Thanks updated
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.
Five "thin LTO"-s, only one down... But what does second sentence add now? It's basically the first sentence... Again, not that I care that much :-) Just do you :-)
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.
hmm if it can be understood by another maintainer with no context before hand, then I think it's good
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.
FWIW, I think this might become problematic with rustc_codegen_gcc, as GCC has -flto but not -flto=thin (the way GCC does LTO is different). I believe rustc_codegen_gcc already has some support for cross-language LTO so it's not just theoretical. cc @antoyo
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.
-flto is only enabled for clang, it's currently always disabled for gcc
The linker-plugin/lld uses thin LTO by default, and it requires the archive to be compiled with thin LTO as well, since thin LTO generates function summary which is needed by thin LTO.
Added a comment explaining the purpose of the unused 'lto' variable.
Clarify comments regarding thin LTO requirements for linker plugin.
141ecd7 to
27698d1
Compare
The linker-plugin/lld uses thin LTO by default, and it requires the archive to be compiled with thin LTO as well, since thin LTO generates function summary which is needed by thin LTO.