mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] Kbuild: create LDFLAGS_common
@ 2022-11-08 10:49 Sascha Hauer
  2022-11-08 10:49 ` [PATCH 2/2] Kbuild: link with -z noexecstack and --no-warn-rwx-segments Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2022-11-08 10:49 UTC (permalink / raw)
  To: Barebox List; +Cc: afa

The same linker flags are passed to both LDFLAGS_barebox and LDFLAGS_pbl.
Instead of duplicating it create a LDFLAGS_common variable for these
common flags.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d7f1e3779a..12882ef4cf 100644
--- a/Makefile
+++ b/Makefile
@@ -453,8 +453,10 @@ KBUILD_CFLAGS_MODULE := -DMODULE
 LDFLAGS_barebox	:= -Map barebox.map
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
-LDFLAGS_barebox += $(call ld-option, --no-dynamic-linker)
-LDFLAGS_pbl += $(call ld-option, --no-dynamic-linker)
+LDFLAGS_common += $(call ld-option, --no-dynamic-linker)
+
+LDFLAGS_barebox += $(LDFLAGS_common)
+LDFLAGS_pbl += $(LDFLAGS_common)
 
 export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL PYTHON3 UTS_MACHINE
-- 
2.30.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] Kbuild: link with -z noexecstack and --no-warn-rwx-segments
  2022-11-08 10:49 [PATCH 1/2] Kbuild: create LDFLAGS_common Sascha Hauer
@ 2022-11-08 10:49 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-11-08 10:49 UTC (permalink / raw)
  To: Barebox List; +Cc: afa

Users of GNU ld (BFD) from binutils 2.39+ will observe multiple
instances of a new warning when linking barebox and PBL in the form:

ld: warning: defaultenv/defaultenv-2-dfu.bbenv.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: .tmp_barebox1 has a LOAD segment with RWX permissions

We don't need executable stack, so disable with -z noexecstack. We also
do not use the permissions from ELF segments, so disable the warning
with --no-warn-rwx-segments.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index 12882ef4cf..de0329c761 100644
--- a/Makefile
+++ b/Makefile
@@ -454,6 +454,10 @@ LDFLAGS_barebox	:= -Map barebox.map
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
 LDFLAGS_common += $(call ld-option, --no-dynamic-linker)
+# Avoid 'missing .note.GNU-stack section implies executable stack' warnings on binutils 2.39+
+LDFLAGS_common += -z noexecstack
+# Avoid '... has a LOAD segment with RWX permissions' warnings on binutils 2.39+
+LDFLAGS_common += $(call ld-option,--no-warn-rwx-segments)
 
 LDFLAGS_barebox += $(LDFLAGS_common)
 LDFLAGS_pbl += $(LDFLAGS_common)
-- 
2.30.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-08 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 10:49 [PATCH 1/2] Kbuild: create LDFLAGS_common Sascha Hauer
2022-11-08 10:49 ` [PATCH 2/2] Kbuild: link with -z noexecstack and --no-warn-rwx-segments Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox