mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning
@ 2024-07-03 19:02 Ahmad Fatoum
  2024-07-15  6:04 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2024-07-03 19:02 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>
---
 arch/sandbox/board/barebox.lds.S | 2 +-
 1 file changed, 1 insertion(+), 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
 	}
 }
-- 
2.39.2




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

* Re: [PATCH master] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning
  2024-07-03 19:02 [PATCH master] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning Ahmad Fatoum
@ 2024-07-15  6:04 ` Ahmad Fatoum
  2024-07-16 11:09   ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2024-07-15  6:04 UTC (permalink / raw)
  To: barebox

On 03.07.24 21:02, 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.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Please dismiss this patch. The new BAREBOX_CLASSES addition to RO_DATA_SECTION
makes the section not const anymore, so this would crash on the first class
addition. I'll send a v2 later.

> ---
>  arch/sandbox/board/barebox.lds.S | 2 +-
>  1 file changed, 1 insertion(+), 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
>  	}
>  }

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

* Re: [PATCH master] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning
  2024-07-15  6:04 ` Ahmad Fatoum
@ 2024-07-16 11:09   ` Ahmad Fatoum
  0 siblings, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-07-16 11:09 UTC (permalink / raw)
  To: barebox

On 15.07.24 08:04, Ahmad Fatoum wrote:
> On 03.07.24 21:02, 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.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> Please dismiss this patch. The new BAREBOX_CLASSES addition to RO_DATA_SECTION
> makes the section not const anymore, so this would crash on the first class
> addition. I'll send a v2 later.

This is further complicated by REAONLY being new in GCC 11 apparently.
I need to find out which version of GNU ld that is and how we could
check whether READONLY is supported..

> 
>> ---
>>  arch/sandbox/board/barebox.lds.S | 2 +-
>>  1 file changed, 1 insertion(+), 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
>>  	}
>>  }
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

end of thread, other threads:[~2024-07-16 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-03 19:02 [PATCH master] sandbox: lds: fix "ELF has a LOAD segment with RWX permissions" warning Ahmad Fatoum
2024-07-15  6:04 ` Ahmad Fatoum
2024-07-16 11:09   ` Ahmad Fatoum

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