Created
December 31, 2017 16:53
-
-
Save TuxCoding/5c5f66d869ebb88b161adb5692694fa9 to your computer and use it in GitHub Desktop.
Enhanced gcc (c/c++) compiler flags for enhanced linux security and performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #-- Compiler and Linker Flags | |
| # -march (or -mcpu) builds exclusively for an architecture | |
| # -mtune optimizes for an architecture, but builds for whole processor family | |
| export CFLAGS="-pipe -mtune=generic -fstack-protector-all -O3 -fno-plt" | |
| export CXXFLAGS="-pipe -mtune=generic -fstack-protector-all -O3 -fno-plt" | |
| export CPPFLAGS="-D_FORTIFY_SOURCE=2" | |
| export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment