-
Notifications
You must be signed in to change notification settings - Fork 478
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
Constrain -Clto
and -Cembed-bitcode
flag inheritance to be clang
-only
#1379
Conversation
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!
Similar in spirit to #1363, CC @mrkajetanp, why were these originally marked enabled on GCC too? Are there other options here that we are not considering that we should be?
I'm gonna merge this immediately, because this PR is clearly correct. I'll look into the other options myself, and file a follow-up PR if needed. |
There may also be cases that while a specific flag-form is supported for both |
Filed #1380. And yes, you're correct, they may not have the same semantics. |
As originally written, clang and gcc flags were just all one group because if either of the compilers didn't support one you'd just get this warning but it wouldn't be an actual error. Somewhat useful for when someone was using a different compiler than they intended etc. |
In rust-lang/rust#136338 we noticed two unsupported inherited flag warnings when the underlying
cc
isgcc
and notclang
:This PR constraints
-Clto
and-Cembed-bitcode
flag inheritance to beclang
-only, compared the current behavior of inheriting the flags for bothclang
andgcc
.Constrain
-Cembed-bitcode
flag inheritance to beclang
-onlyembed-bitcode
refers to embedding LLVM bitcode, which is not a thing forgcc
1.This PR moves the
-Cembed-bitcode
flag inheritance from being shared bygcc
/clang
to beclang
-only.Constrain
-Clto
flag inheritance to beclang
-onlyWhile
clang
supports-flto={thin,fat}
,gcc
does not support this form. Furthermore, there isn't really a 1-to-1 mapping betweenclang
's ThinLTO/FatLTO andgcc
's LTO.We noticed this in rust-lang/rust#136338 when trying to compile
rustc_llvm
but with the underlyingcc
beinggcc
:For instance,
gcc
has multiple LTO-related / LTO-affecting flags:-ffat-lto-objects
and-fno-fat-lto-objects
. And its docs state:-fwhole-program
-flto-partition
-flto-compression-level
This PR moves the
-Clto
flag inheritance from being shared bygcc
/clang
to beclang
-only.Footnotes
I suppose if you squint super super hard, embedding GIMPLE bytecode somehow...? ↩