[OpenWrt-Devel] [PATCH] openwrt/hardening: Fix CFLAGS usage for -D_FORTIFY_SOURCE

Helmut Schaa helmut.schaa at googlemail.com
Mon Sep 7 11:32:13 EDT 2015


Fix the following configure error with c-ares by using CPPFLAGS for -D_FORTIFY_SOURCE.
Not sure if any other packages suffer from the same issue.

configure: using CFLAGS: -Os -pipe -march=74kc -fno-caller-saves -mno-branch-likely -g3 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro
configure: CFLAGS error: CFLAGS may only be used to specify C compiler flags, not macro definitions. Use CPPFLAGS for: -D_FORTIFY_SOURCE=1
configure: error: Can not continue. Fix errors mentioned immediately above this line.

Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>
---
 include/hardening.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/hardening.mk b/include/hardening.mk
index c277081..4de9cfc 100644
--- a/include/hardening.mk
+++ b/include/hardening.mk
@@ -27,12 +27,12 @@ ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
 endif
 ifdef CONFIG_PKG_FORTIFY_SOURCE_1
   ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
-    TARGET_CFLAGS += -D_FORTIFY_SOURCE=1
+    TARGET_CPPFLAGS += -D_FORTIFY_SOURCE=1
   endif
 endif
 ifdef CONFIG_PKG_FORTIFY_SOURCE_2
   ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
-    TARGET_CFLAGS += -D_FORTIFY_SOURCE=2
+    TARGET_CPPFLAGS += -D_FORTIFY_SOURCE=2
   endif
 endif
 ifdef CONFIG_PKG_RELRO_PARTIAL
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list