* [PATCH v2] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning
@ 2024-09-10 9:00 Ahmad Fatoum
2024-09-11 8:37 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-09-10 9:00 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
With binutils 2.39+, the barebox build started emitting this warning.
On platforms other than sandbox, we disable this warning by passing --no-warn-rwx
to ld as we don't care for ELF attributes as they aren't used anyway.
On sandbox, however, the ELF attributes matter, so disabling the warning
completely felt wrong. Looking more into it now, we can mark the
.barebox_rodata section in the linker file snippet we have in sandbox as
READONLY and the warning disappears, so let's do that instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- add fallback for earlier binutils that don't know about READONLY.
---
arch/sandbox/board/barebox.lds.S | 2 +-
include/asm-generic/barebox.lds.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/sandbox/board/barebox.lds.S b/arch/sandbox/board/barebox.lds.S
index ab2801f3d207..de8552dba0ac 100644
--- a/arch/sandbox/board/barebox.lds.S
+++ b/arch/sandbox/board/barebox.lds.S
@@ -5,7 +5,7 @@
SECTIONS
{
. = ALIGN(64);
- .barebox_rodata : {
+ .barebox_rodata (READONLY) : {
RO_DATA_SECTION
}
}
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index d3736ebaed59..9af874b2262b 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -171,3 +171,8 @@ CONFIG_ARCH_BAREBOX_MAX_PBL_SIZE < CONFIG_BAREBOX_MAX_PBL_SIZE
ASSERT(_barebox_pbl_size < MAX_PBL_SIZE, "Barebox pbl size > ") \
ASSERT(_barebox_pbl_size < MAX_PBL_SIZE, __stringify(MAX_PBL_SIZE)) \
+#if defined(__GNUC__) && __GNUC__ >= 11
+#define READONLY READONLY
+#else
+#define READONLY
+#endif
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning
2024-09-10 9:00 [PATCH v2] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning Ahmad Fatoum
@ 2024-09-11 8:37 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-09-11 8:37 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Tue, 10 Sep 2024 11:00:50 +0200, Ahmad Fatoum wrote:
> With binutils 2.39+, the barebox build started emitting this warning.
> On platforms other than sandbox, we disable this warning by passing --no-warn-rwx
> to ld as we don't care for ELF attributes as they aren't used anyway.
>
> On sandbox, however, the ELF attributes matter, so disabling the warning
> completely felt wrong. Looking more into it now, we can mark the
> .barebox_rodata section in the linker file snippet we have in sandbox as
> READONLY and the warning disappears, so let's do that instead.
>
> [...]
Applied, thanks!
[1/1] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning
https://git.pengutronix.de/cgit/barebox/commit/?id=c11590f5643b (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-11 8:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-10 9:00 [PATCH v2] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning Ahmad Fatoum
2024-09-11 8:37 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox