Makefile: Add security compiling option (RELRO, SC, and FORTIFY) 34/301934/1 accepted/tizen_unified accepted/tizen_unified_riscv tizen accepted/tizen/unified/20231128.175125 accepted/tizen/unified/riscv/20231211.234141
authorUnsung Lee <unsung.lee@samsung.com>
Sat, 25 Nov 2023 12:14:47 +0000 (21:14 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Tue, 28 Nov 2023 02:24:23 +0000 (11:24 +0900)
Add security compiling option in Makefile.am to support
RELRO, SC, and FORTIFY.

Change-Id: I5d6c052b897cc392d4c2a1f62a5ac60952c2927e
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
Makefile.am

index 16c0a4d..edbcab3 100644 (file)
@@ -12,10 +12,13 @@ AM_CPPFLAGS = \
         -DPREFIX=\""$(prefix)"\"                \
         -DSYSCONFDIR=\""$(sysconfdir)"\"        \
         -DVERSION=\""$(VERSION)"\"              \
-        -DEXTERNAL_LUKS2_TOKENS_PATH=\"${EXTERNAL_LUKS2_TOKENS_PATH}\"
-AM_CFLAGS = -Wall -fPIE
+        -DEXTERNAL_LUKS2_TOKENS_PATH=\"${EXTERNAL_LUKS2_TOKENS_PATH}\" \
+       -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wl,-z,relro
+AM_CFLAGS = -Wall -fPIE \
+           -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wl,-z,relro
 AM_CXXFLAGS = -Wall
-AM_LDFLAGS = -pie
+AM_LDFLAGS = -pie \
+            -Wl,-z,relro
 
 if ENABLE_FUZZ_TARGETS
 AM_CFLAGS += -fsanitize=fuzzer-no-link