From: Unsung Lee Date: Sat, 25 Nov 2023 12:51:34 +0000 (+0900) Subject: CMakeLists.txt: Add security compiling option (RELRO, SC, and FORTIFY) X-Git-Tag: accepted/tizen/unified/20231128.175121^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=337aeedddc2e9bad6b2490030caffafd9834024f;p=platform%2Fhal%2Fapi%2Fcommon.git CMakeLists.txt: Add security compiling option (RELRO, SC, and FORTIFY) Add security compiling option (RELRO, SC, and FORTIFY) in CFLAGS. Change-Id: Ic32765cd1967b7f8d028acac238a3ccf001c6992 Signed-off-by: Unsung Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fcd8e1..f88a4f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -fPIC") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wl,-z,relro") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt") SET(CMAKE_EXE_LINKER_FLAGS "-pie")