[PATCH] Makefile: Silence new GNU linker warnings

Joel Stanley joel at jms.id.au
Tue Aug 2 10:30:23 CEST 2022


The next version of the linker will complain about rwx segments with
permissions and executable stacks:

 https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
 https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774

These warnings are relevant for ELF binaries loaded by an operating
system linker, but do not make sense in the context of u-boot where the
objects are loaded by other means.

Disable the warnings using the following options:

 --no-warn-rwx-segments

  warning: u-boot has a LOAD segment with RWX permissions
  warning: u-boot-spl has a LOAD segment with RWX permissions

 --no-warn-execstack

  warning: arch/arm/lib/setjmp.o: missing .note.GNU-stack section implies executable stack
  NOTE: This behaviour is deprecated and will be removed in a future version of the linker

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
This behaviour can be seen when building with binutils
2.38.90.20220713-2 from Debian testing.

 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ff25f9297486..32aac7493f8d 100644
--- a/Makefile
+++ b/Makefile
@@ -432,7 +432,8 @@ KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
 		   -fno-builtin -ffreestanding $(CSTD_FLAG)
 KBUILD_CFLAGS	+= -fshort-wchar -fno-strict-aliasing
 KBUILD_AFLAGS   := -D__ASSEMBLY__
-KBUILD_LDFLAGS  :=
+KBUILD_LDFLAGS  := $(call ld-option, --no-warn-rwx-segments) \
+		   $(call ld-option, --no-warn-execstack)
 
 ifeq ($(cc-name),clang)
 ifneq ($(CROSS_COMPILE),)
-- 
2.35.1



More information about the U-Boot mailing list