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
Update CROSSTOOL opt mode flags #99
Comments
What about "-fno-omit-frame-pointer"? |
What about it? :-) I don't have any first-hand experience with it, but I On Tuesday, April 7, 2015, Ming Zhao notifications@github.com wrote:
|
Does a change like this make sense?
|
Here's my proposal. for DBG: It's unclear that the benefits of -g3 warrant the size increase of the resulting binaries. -g for OPT: # No debug symbols # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or even generally? # However, that can't happen here, as it requires special handling in Bazel. compiler_flag: "-g0" # Conservative choice for -O # -O3 can increase binary size and even slow down the resulting binaries. # Profile first and / or use FDO if you need better performance than this. compiler_flag: "-O2" compiler_flag: "-DNDEBUG" # Removal of unused code and data at link time (can this increase binary size in some cases?). compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" linker_flag: "-Wl,--gc-sections" This doesn't really belong here, but if we're changing the crosstool file, we might also want to update the default flags. Personally, I'd add security hardening options by default, as well as enable a number of warnings. I haven't tried to build anything with these options yet. # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. compiler_flag: "-D_FORTIFY_SOURCE=1" compiler_flag: "-fstack-protector" compiler_flag: "-fPIE" linker_flag: "-pie" linker_flag: "-Wl,-z,relro,-z,now" # Enable coloring even if there's no attached terminal. compiler_flag: "-fcolor-diagnostics" # All warnings are enabled (this is probably too aggressive). # Maybe enable -Werror as well? compiler_flag: "-Wall" compiler_flag: "-Wformat-security" compiler_flag: "-Wthread-safety-analysis" compiler_flag: "-Wunused-but-set-parameter" compiler_flag: "-Wself-assign" compiler_flag: "-Wno-free-nonheap-object" # has false positives compiler_flag: "-fno-omit-frame-pointer" compiler_flag: "-gmlt" linker_flag: "-Wl,--build-id=md5" linker_flag: "-Wl,--hash-style=gnu" linker_flag: "-pass-exit-codes" # Gold linker only? linker_flag: "-Wl,--warn-execstack" linker_flag: "-Wl,--detect-odr-violations" |
looks good to me, 👍 |
I can try building with some of these flags. |
Update CROSSTOOL opt mode, at least set -O2, maybe -DNDEBUG as well?
The text was updated successfully, but these errors were encountered: