Browse Source

- added hardening compile- and link-options

development
Andreas Romeyke 2 years ago
parent
commit
f29f00672b
  1. 2
      README.compile
  2. 4
      src/CMakeLists.txt

2
README.compile

@ -5,7 +5,7 @@
########################################################
mkdir build
cd build
cmake ../src/ -DCMAKE_C_FLAGS="-W -Wall -Wextra -ansi -pedantic -O3 -Wno-unused-function -fstack-check"
cmake ../src/ -DCMAKE_C_FLAGS="-W -Wall -Wextra -ansi -pedantic -O3 -Wno-unused-function -fstack-check -fstack-protector-strong -Wformat -Werror=format-security"
make
###
# if you want to allow preferred CMM type "LINO", you should use the cmake-call

4
src/CMakeLists.txt

@ -35,6 +35,10 @@ execute_process( COMMAND git describe --long --tags --dirty --always OUTPUT_VARI
add_definitions(-DVERSION="${BUILD_BRANCH}_${BUILD_TAG}")
add_definitions(-DREPO_REVISION="${REPO_REVISION}")
# add default CFLAGS
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong -Wformat -Werror=format-security")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -fPIE")
# Check for compatibility with gnu11
# Compile with gnu11 support.
include(CheckCCompilerFlag)

Loading…
Cancel
Save