mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: afa@pengutronix.de
Subject: [PATCH 2/2] Kbuild: link with -z noexecstack and --no-warn-rwx-segments
Date: Tue,  8 Nov 2022 11:49:27 +0100	[thread overview]
Message-ID: <20221108104927.1922424-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20221108104927.1922424-1-s.hauer@pengutronix.de>

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




      reply	other threads:[~2022-11-08 10:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 10:49 [PATCH 1/2] Kbuild: create LDFLAGS_common Sascha Hauer
2022-11-08 10:49 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221108104927.1922424-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=afa@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox