Skip to content

Instantly share code, notes, and snippets.

@TuxCoding
Created December 31, 2017 16:53
Show Gist options
  • Select an option

  • Save TuxCoding/5c5f66d869ebb88b161adb5692694fa9 to your computer and use it in GitHub Desktop.

Select an option

Save TuxCoding/5c5f66d869ebb88b161adb5692694fa9 to your computer and use it in GitHub Desktop.
Enhanced gcc (c/c++) compiler flags for enhanced linux security and performance
#-- 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