-
Notifications
You must be signed in to change notification settings - Fork 113
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
Improve zstd-sys/build.rs: Fallback to -Os
or -O2
if -Oz
is not supported
#172
Conversation
-Oz
-Oz
, and enable LTO only for clang-like compiler
@gyscos Can you review this PR please? |
@gyscos Pinging |
Unfortunately I'm not sure I'm still trying to figure out how to safely enable any form of lto on GCC that will work on both recent gcc version, older gcc version used in cross (gcc 9), and the gcc used in the windows-gnu target... |
Perhaps we should just compile a simple hello-world with lto to see if that works? I can try implementing that in a new PR and meanwhile I will reduce the scope of this PR |
I think a simpler option to start would be letting the end user override this "guesswork" and explicitly enable LTO or other options. Some magic to detect supported features would also be valuable, but it's not clear if it should go here or in cc itself. |
Signed-off-by: Jiahao XU <[email protected]>
-Oz
, and enable LTO only for clang-like compiler-Os
or -O2
if -Oz
is not supported
-Os
or -O2
if -Oz
is not supported-Os
or -O2
if -Oz
is not supported
Actually, do we need to turn on O2 manually? What's the advantage vs letting cc pick the optimization level? I realize it's only when none of Oz or Os works (not sure when that happens), but that still looks like a different decision. |
It's only turned on if feature "thin" is enabled. |
I remember that gcc doesn't support -Oz and only -Os? |
I checked I think the problem lies in this line, where it does not check the exit status of the command and assumes that if the stderr is empty, everything works as expected. |
@gyscos I've opend rust-lang/cc-rs#757 which might help fix the LTO issue in zstd. |
Signed-off-by: Jiahao XU [email protected]