[OpenWrt-Devel,2/3] gcc: Activate hardening features for libgcc

Message ID 20190102171835.16763-2-hauke@hauke-m.de
State New
Delegated to: Hauke Mehrtens
Headers show
Series
  • [OpenWrt-Devel,1/3] bzip2: fix hardening build
Related show

Commit Message

Hauke Mehrtens Jan. 2, 2019, 5:18 p.m.
This includes the hardening.mk before the code gets compiled and then
also sets the LDFLAGS for the libgcc and other applications.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/toolchain-build.mk | 1 +
 toolchain/gcc/common.mk    | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/include/toolchain-build.mk b/include/toolchain-build.mk
index 883d74d25c..35d8c9380e 100644
--- a/include/toolchain-build.mk
+++ b/include/toolchain-build.mk
@@ -12,6 +12,7 @@  HOST_BUILD_PREFIX:=$(TOOLCHAIN_DIR)
 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
 
 include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/hardening.mk
 
 HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared
 
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index b75fce57ef..e3b3f90821 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -191,7 +191,8 @@  GCC_MAKE:= \
 		CFLAGS="$(HOST_CFLAGS)" \
 		CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
 		CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
-		GOCFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
+		GOCFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
+		LDFLAGS_FOR_TARGET="$(TARGET_LDFLAGS)"
 
 define Host/SetToolchainInfo
 	$(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk