meta-sunxi/recipes-bsp/atf/atf-sunxi/Makefile-link-with-z-noexecstack-no-warn-rwx-segment.patch

36 lines
1019 B
Diff

From 69d2c1ccb42942980064c12d3ea3904bac450feb Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Thu, 23 Feb 2023 16:30:01 +0100
Subject: [PATCH] Makefile: link with -z noexecstack --no-warn-rwx-segments
---
Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Makefile b/Makefile
index 578083221..e70888cf2 100644
--- a/Makefile
+++ b/Makefile
@@ -445,6 +445,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += --no-warn-rwx-segment
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -471,6 +473,9 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
--
2.34.1