From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Abdelrahman Youssef <abdelrahmanyossef12@gmail.com>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] sandbox: lds: fix relocation in read-only section warning
Date: Mon, 14 Oct 2024 13:35:40 +0200 [thread overview]
Message-ID: <20241014113540.2817987-1-a.fatoum@pengutronix.de> (raw)
To address an "ELF has a LOAD segment with RWX permissions" warning
during the sandbox build, the RO_DATA_SECTION was marked READONLY.
At least with Debian GCC 12.2.0-14, this just brought us a different
warning:
/usr/bin/ld: common/memory.o: warning: relocation in read-only section `.initcall.9'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
This is understandable: If an initcall is emitted with a relocation,
marking its section as read-only is inconsistent.
Taking a step back, the actual problem is that we need to tell GCC that
our RO_DATA_SECTION is not executable. Therefore, let's insert it before
.data (which is rw^x) instead of .rodata, which is (rx).
Fixes: c11590f5643b ("sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning")
Reported-by: Abdelrahman Youssef <abdelrahmanyossef12@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/sandbox/board/barebox.lds.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/board/barebox.lds.S b/arch/sandbox/board/barebox.lds.S
index de8552dba0ac..0102b9333174 100644
--- a/arch/sandbox/board/barebox.lds.S
+++ b/arch/sandbox/board/barebox.lds.S
@@ -5,9 +5,9 @@
SECTIONS
{
. = ALIGN(64);
- .barebox_rodata (READONLY) : {
+ .barebox_rodata () : {
RO_DATA_SECTION
}
}
-INSERT BEFORE .rodata;
+INSERT BEFORE .data;
--
2.39.5
next reply other threads:[~2024-10-14 13:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 11:35 Ahmad Fatoum [this message]
2024-10-15 6:55 ` Sascha Hauer
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=20241014113540.2817987-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=abdelrahmanyossef12@gmail.com \
--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