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@xxxxxxxxx> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- 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