public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] arm/flat.lds: Specify program headers with flags to avoid linker warnings
@ 2023-06-23 13:05 Thomas Huth
  2023-06-23 15:38 ` Andrew Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2023-06-23 13:05 UTC (permalink / raw)
  To: Andrew Jones, kvmarm; +Cc: kvm

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


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

* Re: [kvm-unit-tests PATCH] arm/flat.lds: Specify program headers with flags to avoid linker warnings
  2023-06-23 13:05 [kvm-unit-tests PATCH] arm/flat.lds: Specify program headers with flags to avoid linker warnings Thomas Huth
@ 2023-06-23 15:38 ` Andrew Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Jones @ 2023-06-23 15:38 UTC (permalink / raw)
  To: Thomas Huth; +Cc: kvmarm, kvm

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

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

end of thread, other threads:[~2023-06-23 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-23 13:05 [kvm-unit-tests PATCH] arm/flat.lds: Specify program headers with flags to avoid linker warnings Thomas Huth
2023-06-23 15:38 ` Andrew Jones

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