diff mbox series

[kvm-unit-tests] arm/flat.lds: Specify program headers with flags to avoid linker warnings

Message ID 20230623130528.483909-1-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] arm/flat.lds: Specify program headers with flags to avoid linker warnings | expand

Commit Message

Thomas Huth June 23, 2023, 1:05 p.m. UTC
With ld from binutils v2.40 I currently get warning messages like this:

 ld: warning: arm/spinlock-test.elf has a LOAD segment with RWX permissions
 ld: warning: arm/selftest.elf has a LOAD segment with RWX permissions
 ld: warning: arm/pci-test.elf has a LOAD segment with RWX permissions
 ld: warning: arm/pmu.elf has a LOAD segment with RWX permissions
 ...

Seems like these can be silenced by explicitly specifying the program
headers with the appropriate flags (like we did in commit 0a06949aafac4a4
on x86 and in commit 5126732d73aa75 on powerpc already).

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 arm/flat.lds | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Andrew Jones June 23, 2023, 3:38 p.m. UTC | #1
On Fri, Jun 23, 2023 at 03:05:28PM +0200, Thomas Huth wrote:
> With ld from binutils v2.40 I currently get warning messages like this:
> 
>  ld: warning: arm/spinlock-test.elf has a LOAD segment with RWX permissions
>  ld: warning: arm/selftest.elf has a LOAD segment with RWX permissions
>  ld: warning: arm/pci-test.elf has a LOAD segment with RWX permissions
>  ld: warning: arm/pmu.elf has a LOAD segment with RWX permissions
>  ...
> 
> Seems like these can be silenced by explicitly specifying the program
> headers with the appropriate flags (like we did in commit 0a06949aafac4a4
> on x86 and in commit 5126732d73aa75 on powerpc already).
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  arm/flat.lds | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arm/flat.lds b/arm/flat.lds
> index 47fcb649..f722c650 100644
> --- a/arm/flat.lds
> +++ b/arm/flat.lds
> @@ -22,10 +22,16 @@
>   *    +----------------------+   <-- physical address 0x0
>   */
>  
> +PHDRS
> +{
> +    text PT_LOAD FLAGS(5);
> +    data PT_LOAD FLAGS(6);
> +}
> +
>  SECTIONS
>  {
>      PROVIDE(_text = .);
> -    .text : { *(.init) *(.text) *(.text.*) }
> +    .text : { *(.init) *(.text) *(.text.*) } :text
>      . = ALIGN(64K);
>      PROVIDE(etext = .);
>  
> @@ -39,8 +45,8 @@ SECTIONS
>      .got      : { *(.got) *(.got.plt) }
>      .eh_frame : { *(.eh_frame) }
>  
> -    .rodata   : { *(.rodata*) }
> -    .data     : { *(.data) }
> +    .rodata   : { *(.rodata*) } :data
> +    .data     : { *(.data) } :data
>      . = ALIGN(16);
>      PROVIDE(bss = .);
>      .bss      : { *(.bss) }
> -- 
> 2.39.3
>

Applied to arm/queue

https://gitlab.com/jones-drew/kvm-unit-tests/-/commits/arm/queue

Thanks,
drew
diff mbox series

Patch

diff --git a/arm/flat.lds b/arm/flat.lds
index 47fcb649..f722c650 100644
--- a/arm/flat.lds
+++ b/arm/flat.lds
@@ -22,10 +22,16 @@ 
  *    +----------------------+   <-- physical address 0x0
  */
 
+PHDRS
+{
+    text PT_LOAD FLAGS(5);
+    data PT_LOAD FLAGS(6);
+}
+
 SECTIONS
 {
     PROVIDE(_text = .);
-    .text : { *(.init) *(.text) *(.text.*) }
+    .text : { *(.init) *(.text) *(.text.*) } :text
     . = ALIGN(64K);
     PROVIDE(etext = .);
 
@@ -39,8 +45,8 @@  SECTIONS
     .got      : { *(.got) *(.got.plt) }
     .eh_frame : { *(.eh_frame) }
 
-    .rodata   : { *(.rodata*) }
-    .data     : { *(.data) }
+    .rodata   : { *(.rodata*) } :data
+    .data     : { *(.data) } :data
     . = ALIGN(16);
     PROVIDE(bss = .);
     .bss      : { *(.bss) }