toolchain/toolchain-wrapper: add BR2_SSP_* support
authorMatt Weber <matthew.weber@rockwellcollins.com>
Mon, 17 Sep 2018 21:21:50 +0000 (16:21 -0500)
committerPeter Korsgaard <peter@korsgaard.com>
Sat, 20 Oct 2018 10:51:21 +0000 (12:51 +0200)
Migrate the stack protection flag management into the wrapper.

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/Makefile.in
toolchain/toolchain-wrapper.c
toolchain/toolchain-wrapper.mk

index cd2148270a6041cc2bcd99f950d07999bb59fca1..dc0eecf1d54c2671a9a08fae81cb279844241dba 100644 (file)
@@ -143,14 +143,6 @@ endif
 
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
-ifeq ($(BR2_SSP_REGULAR),y)
-TARGET_HARDENED += -fstack-protector
-else ifeq ($(BR2_SSP_STRONG),y)
-TARGET_HARDENED += -fstack-protector-strong
-else ifeq ($(BR2_SSP_ALL),y)
-TARGET_HARDENED += -fstack-protector-all
-endif
-
 ifeq ($(BR2_FORTIFY_SOURCE_1),y)
 TARGET_HARDENED += -D_FORTIFY_SOURCE=1
 else ifeq ($(BR2_FORTIFY_SOURCE_2),y)
index c73a0cc0792973f5280daa446b0aa7de16ffc767..e9c5cd9d322795fea6bd9187c1de596c78590cdf 100644 (file)
@@ -98,6 +98,15 @@ static char *predef_args[] = {
 #if defined(BR_MIPS_TARGET_BIG_ENDIAN) || defined(BR_ARC_TARGET_BIG_ENDIAN)
        "-EB",
 #endif
+#ifdef BR_SSP_REGULAR
+       "-fstack-protector",
+#endif
+#ifdef BR_SSP_STRONG
+       "-fstack-protector-strong",
+#endif
+#ifdef BR_SSP_ALL
+       "-fstack-protector-all",
+#endif
 #ifdef BR_ADDITIONAL_CFLAGS
        BR_ADDITIONAL_CFLAGS
 #endif
index 99d303975c22586d9a14819862022e1b797b6e71..613f5f6c56509660f82b475286b0198e764621a7 100644 (file)
@@ -51,6 +51,14 @@ else ifeq ($(BR2_RELRO_FULL),y)
 TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_FULL
 endif
 
+ifeq ($(BR2_SSP_REGULAR),y)
+TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_REGULAR
+else ifeq ($(BR2_SSP_STRONG),y)
+TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_STRONG
+else ifeq ($(BR2_SSP_ALL),y)
+TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_ALL
+endif
+
 define TOOLCHAIN_WRAPPER_BUILD
        $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
                -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \