linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] vDSO linkerscript follow up
@ 2022-06-28 15:13 Joey Gouly
  2022-06-28 15:13 ` [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Joey Gouly
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Joey Gouly @ 2022-06-28 15:13 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: nd, Joey Gouly

Hi all,

This is a follow up to the vDSO linker script fixes, that was pulled into the
arm64 tree.

Patch 1 fixes the issue found by Will:
  https://lore.kernel.org/linux-arm-kernel/20220623175352.GA17471@willie-the-truck/
Patch 2 fixes the comments Vincenzo had:
  https://lore.kernel.org/linux-arm-kernel/00abb0c5-6360-0004-353f-e7a88b3bd22c@arm.com/o

This is based on for-next/vdso: 2d304afaedc4 ("arm64: compat: Move kuser32.S to .rodata section")

Thanks,
Joey

Joey Gouly (2):
  arm64: vdso32: add ARM.exidx* sections
  arm64: vdso*: place got/plt sections in .rodata

 arch/arm64/kernel/vdso/vdso.lds.S   | 12 +++++-------
 arch/arm64/kernel/vdso32/vdso.lds.S | 24 +++++++++++-------------
 2 files changed, 16 insertions(+), 20 deletions(-)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections
  2022-06-28 15:13 [PATCH v1 0/2] vDSO linkerscript follow up Joey Gouly
@ 2022-06-28 15:13 ` Joey Gouly
  2022-06-29  9:56   ` Vincenzo Frascino
  2022-06-29 20:10   ` Nathan Chancellor
  2022-06-28 15:13 ` [PATCH v1 2/2] arm64: vdso*: place got/plt sections in .rodata Joey Gouly
  2022-06-28 17:02 ` [PATCH v1 0/2] vDSO linkerscript follow up Will Deacon
  2 siblings, 2 replies; 8+ messages in thread
From: Joey Gouly @ 2022-06-28 15:13 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: nd, Joey Gouly, Will Deacon, Vincenzo Frascino

These show up when building with clang+lld.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/kernel/vdso32/vdso.lds.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
index 120cf422036f..e2f8ced571d6 100644
--- a/arch/arm64/kernel/vdso32/vdso.lds.S
+++ b/arch/arm64/kernel/vdso32/vdso.lds.S
@@ -60,6 +60,7 @@ SECTIONS
 	}
 
 	ELF_DETAILS
+	.ARM.exidx : { *(.ARM.exidx*) }
 	.ARM.attributes 0 : { *(.ARM.attributes) }
 
 	/DISCARD/	: {
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 2/2] arm64: vdso*: place got/plt sections in .rodata
  2022-06-28 15:13 [PATCH v1 0/2] vDSO linkerscript follow up Joey Gouly
  2022-06-28 15:13 ` [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Joey Gouly
@ 2022-06-28 15:13 ` Joey Gouly
  2022-06-29 10:11   ` Vincenzo Frascino
  2022-06-28 17:02 ` [PATCH v1 0/2] vDSO linkerscript follow up Will Deacon
  2 siblings, 1 reply; 8+ messages in thread
From: Joey Gouly @ 2022-06-28 15:13 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: nd, Joey Gouly, Will Deacon, Vincenzo Frascino

The vDSO will not contain absolute relocations, so place these
sections in .rodata.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Link: https://lore.kernel.org/linux-arm-kernel/00abb0c5-6360-0004-353f-e7a88b3bd22c@arm.com/
Cc: Will Deacon <will@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/kernel/vdso/vdso.lds.S   | 12 +++++-------
 arch/arm64/kernel/vdso32/vdso.lds.S | 23 ++++++++++-------------
 2 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index 1cd85258c079..e69fb4aaaf3e 100644
--- a/arch/arm64/kernel/vdso/vdso.lds.S
+++ b/arch/arm64/kernel/vdso/vdso.lds.S
@@ -52,17 +52,15 @@ SECTIONS
 
 	.rela.dyn	: ALIGN(8) { *(.rela .rela*) }
 
-	.plt		: {
+	.rodata		: {
+		*(.rodata*)
+		*(.got)
+		*(.got.plt)
 		*(.plt)
 		*(.plt.*)
 		*(.iplt)
 		*(.igot .igot.plt)
-	}
-
-	.got		: { *(.got) }
-	.got.plt	: { *(.got.plt) }
-
-	.rodata		: { *(.rodata*) }		:text
+	}						:text
 
 	_end = .;
 	PROVIDE(end = .);
diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
index e2f8ced571d6..6e67a6524d58 100644
--- a/arch/arm64/kernel/vdso32/vdso.lds.S
+++ b/arch/arm64/kernel/vdso32/vdso.lds.S
@@ -36,7 +36,15 @@ SECTIONS
 
 	.dynamic	: { *(.dynamic) }		:text	:dynamic
 
-	.rodata		: { *(.rodata*) }		:text
+	.rodata		: {
+		*(.rodata*)
+		*(.got)
+		*(.got.plt)
+		*(.plt)
+		*(.rel.iplt)
+		*(.iplt)
+		*(.igot.plt)
+	}						:text
 
 	.text		: {
 		*(.text*)
@@ -46,18 +54,7 @@ SECTIONS
 		*(.v4_bx)
 	}						:text	=0xe7f001f2
 
-	.rel.dyn	: { *(.rel.text) }
-
-	.got		: { *(.got) }
-	.rel.got	: { *(.rel.got) }
-	.got.plt	: { *(.got.plt) }
-	.rel.plt	: { *(.rel.plt) }
-	.plt		: {
-		*(.plt)
-		*(.rel.iplt)
-		*(.iplt)
-		*(.igot.plt)
-	}
+	.rel.dyn	: { *(.rel*) }
 
 	ELF_DETAILS
 	.ARM.exidx : { *(.ARM.exidx*) }
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 0/2] vDSO linkerscript follow up
  2022-06-28 15:13 [PATCH v1 0/2] vDSO linkerscript follow up Joey Gouly
  2022-06-28 15:13 ` [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Joey Gouly
  2022-06-28 15:13 ` [PATCH v1 2/2] arm64: vdso*: place got/plt sections in .rodata Joey Gouly
@ 2022-06-28 17:02 ` Will Deacon
  2 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2022-06-28 17:02 UTC (permalink / raw)
  To: linux-arm-kernel, Joey Gouly
  Cc: catalin.marinas, kernel-team, Will Deacon, nd

On Tue, 28 Jun 2022 16:13:05 +0100, Joey Gouly wrote:
> This is a follow up to the vDSO linker script fixes, that was pulled into the
> arm64 tree.
> 
> Patch 1 fixes the issue found by Will:
>   https://lore.kernel.org/linux-arm-kernel/20220623175352.GA17471@willie-the-truck/
> Patch 2 fixes the comments Vincenzo had:
>   https://lore.kernel.org/linux-arm-kernel/00abb0c5-6360-0004-353f-e7a88b3bd22c@arm.com/o
> 
> [...]

Applied to arm64 (for-next/vdso), thanks!

[1/2] arm64: vdso32: add ARM.exidx* sections
      https://git.kernel.org/arm64/c/5c4fb60816ea
[2/2] arm64: vdso*: place got/plt sections in .rodata
      https://git.kernel.org/arm64/c/4274929c7ee6

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections
  2022-06-28 15:13 ` [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Joey Gouly
@ 2022-06-29  9:56   ` Vincenzo Frascino
  2022-06-29 20:10   ` Nathan Chancellor
  1 sibling, 0 replies; 8+ messages in thread
From: Vincenzo Frascino @ 2022-06-29  9:56 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel; +Cc: nd, Will Deacon

On 28/06/2022 16:13, Joey Gouly wrote:
> These show up when building with clang+lld.
> 
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
>   arch/arm64/kernel/vdso32/vdso.lds.S | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
> index 120cf422036f..e2f8ced571d6 100644
> --- a/arch/arm64/kernel/vdso32/vdso.lds.S
> +++ b/arch/arm64/kernel/vdso32/vdso.lds.S
> @@ -60,6 +60,7 @@ SECTIONS
>   	}
>   
>   	ELF_DETAILS
> +	.ARM.exidx : { *(.ARM.exidx*) }
>   	.ARM.attributes 0 : { *(.ARM.attributes) }
>   
>   	/DISCARD/	: {

-- 
Regards,
Vincenzo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 2/2] arm64: vdso*: place got/plt sections in .rodata
  2022-06-28 15:13 ` [PATCH v1 2/2] arm64: vdso*: place got/plt sections in .rodata Joey Gouly
@ 2022-06-29 10:11   ` Vincenzo Frascino
  0 siblings, 0 replies; 8+ messages in thread
From: Vincenzo Frascino @ 2022-06-29 10:11 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel; +Cc: nd, Will Deacon



On 28/06/2022 16:13, Joey Gouly wrote:
> The vDSO will not contain absolute relocations, so place these
> sections in .rodata.
> 
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Link: https://lore.kernel.org/linux-arm-kernel/00abb0c5-6360-0004-353f-e7a88b3bd22c@arm.com/
> Cc: Will Deacon <will@kernel.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
>   arch/arm64/kernel/vdso/vdso.lds.S   | 12 +++++-------
>   arch/arm64/kernel/vdso32/vdso.lds.S | 23 ++++++++++-------------
>   2 files changed, 15 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
> index 1cd85258c079..e69fb4aaaf3e 100644
> --- a/arch/arm64/kernel/vdso/vdso.lds.S
> +++ b/arch/arm64/kernel/vdso/vdso.lds.S
> @@ -52,17 +52,15 @@ SECTIONS
>   
>   	.rela.dyn	: ALIGN(8) { *(.rela .rela*) }
>   
> -	.plt		: {
> +	.rodata		: {
> +		*(.rodata*)
> +		*(.got)
> +		*(.got.plt)
>   		*(.plt)
>   		*(.plt.*)
>   		*(.iplt)
>   		*(.igot .igot.plt)
> -	}
> -
> -	.got		: { *(.got) }
> -	.got.plt	: { *(.got.plt) }
> -
> -	.rodata		: { *(.rodata*) }		:text
> +	}						:text
>   
>   	_end = .;
>   	PROVIDE(end = .);
> diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
> index e2f8ced571d6..6e67a6524d58 100644
> --- a/arch/arm64/kernel/vdso32/vdso.lds.S
> +++ b/arch/arm64/kernel/vdso32/vdso.lds.S
> @@ -36,7 +36,15 @@ SECTIONS
>   
>   	.dynamic	: { *(.dynamic) }		:text	:dynamic
>   
> -	.rodata		: { *(.rodata*) }		:text
> +	.rodata		: {
> +		*(.rodata*)
> +		*(.got)
> +		*(.got.plt)
> +		*(.plt)
> +		*(.rel.iplt)
> +		*(.iplt)
> +		*(.igot.plt)
> +	}						:text
>   
>   	.text		: {
>   		*(.text*)
> @@ -46,18 +54,7 @@ SECTIONS
>   		*(.v4_bx)
>   	}						:text	=0xe7f001f2
>   
> -	.rel.dyn	: { *(.rel.text) }
> -
> -	.got		: { *(.got) }
> -	.rel.got	: { *(.rel.got) }
> -	.got.plt	: { *(.got.plt) }
> -	.rel.plt	: { *(.rel.plt) }
> -	.plt		: {
> -		*(.plt)
> -		*(.rel.iplt)
> -		*(.iplt)
> -		*(.igot.plt)
> -	}
> +	.rel.dyn	: { *(.rel*) }
>   
>   	ELF_DETAILS
>   	.ARM.exidx : { *(.ARM.exidx*) }

-- 
Regards,
Vincenzo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections
  2022-06-28 15:13 ` [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Joey Gouly
  2022-06-29  9:56   ` Vincenzo Frascino
@ 2022-06-29 20:10   ` Nathan Chancellor
  2022-06-30 10:21     ` Joey Gouly
  1 sibling, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2022-06-29 20:10 UTC (permalink / raw)
  To: Joey Gouly; +Cc: linux-arm-kernel, nd, Will Deacon, Vincenzo Frascino, llvm

Hi Joey,

On Tue, Jun 28, 2022 at 04:13:06PM +0100, Joey Gouly wrote:
> These show up when building with clang+lld.
> 
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  arch/arm64/kernel/vdso32/vdso.lds.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
> index 120cf422036f..e2f8ced571d6 100644
> --- a/arch/arm64/kernel/vdso32/vdso.lds.S
> +++ b/arch/arm64/kernel/vdso32/vdso.lds.S
> @@ -60,6 +60,7 @@ SECTIONS
>  	}
>  
>  	ELF_DETAILS
> +	.ARM.exidx : { *(.ARM.exidx*) }
>  	.ARM.attributes 0 : { *(.ARM.attributes) }
>  
>  	/DISCARD/	: {
> -- 
> 2.17.1
> 

This patch is now in -next as commit 5c4fb60816ea ("arm64: vdso32: add
ARM.exidx* sections"), which causes the following errors with ld.lld 11:

  ld.lld: error: could not allocate headers
  ld.lld: error: unable to place section .text at file offset [0x2A0, 0xBB1]; check your linker script for overflows
  ld.lld: error: unable to place section .comment at file offset [0xBB2, 0xC8A]; check your linker script for overflows
  ld.lld: error: unable to place section .symtab at file offset [0xC8C, 0xE0B]; check your linker script for overflows
  ld.lld: error: unable to place section .strtab at file offset [0xE0C, 0xF1C]; check your linker script for overflows
  ld.lld: error: unable to place section .shstrtab at file offset [0xF1D, 0xFAA]; check your linker script for overflows
  ld.lld: error: section .ARM.exidx file range overlaps with .hash
  >>> .ARM.exidx range is [0x90, 0xCF]
  >>> .hash range is [0xB4, 0xE3]

  ld.lld: error: section .hash file range overlaps with .ARM.attributes
  >>> .hash range is [0xB4, 0xE3]
  >>> .ARM.attributes range is [0xD0, 0x10B]

  ld.lld: error: section .ARM.attributes file range overlaps with .dynsym
  >>> .ARM.attributes range is [0xD0, 0x10B]
  >>> .dynsym range is [0xE4, 0x133]

  ld.lld: error: section .ARM.exidx virtual address range overlaps with .hash
  >>> .ARM.exidx range is [0x90, 0xCF]
  >>> .hash range is [0xB4, 0xE3]

  ld.lld: error: section .ARM.exidx load address range overlaps with .hash
  >>> .ARM.exidx range is [0x90, 0xCF]
  >>> .hash range is [0xB4, 0xE3]

I bisected LLVM to see what fixed this in ld.lld 12 and I landed on
commit ec29538af2e0 ("[ELF] Assign file offsets of non-SHF_ALLOC after
SHF_ALLOC and set sh_addr=0 to non-SHF_ALLOC") [1].

We could bump the minimum version of LLVM to 12 over this but the
following diff appears to resolve it for me, although I am not sure as
to why.

diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
index 6e67a6524d58..c25bed8e6df1 100644
--- a/arch/arm64/kernel/vdso32/vdso.lds.S
+++ b/arch/arm64/kernel/vdso32/vdso.lds.S
@@ -56,8 +56,8 @@ SECTIONS
 
 	.rel.dyn	: { *(.rel*) }
 
-	ELF_DETAILS
 	.ARM.exidx : { *(.ARM.exidx*) }
+	ELF_DETAILS
 	.ARM.attributes 0 : { *(.ARM.attributes) }
 
 	/DISCARD/	: {

I just noticed that the .ARM.exidx section (ARM_UNWIND_SECTIONS)
is placed before the sections the error mentions (ARM_DETAILS) in
arch/arm/kernel/vmlinux.lds.S, where we do not see any errors with LLVM
11. Looking at the section headers, it seems like it should be okay?

With LLVM 15 (current git) at 4274929c7ee6f442:

  arch/arm64/kernel/vdso32/vdso.so:        file format elf32-littlearm

  Sections:
  Idx Name            Size     VMA      Type
    0                 00000000 00000000
    1 .hash           00000030 000000b4
    2 .dynsym         00000050 000000e4
    3 .dynstr         0000006f 00000134
    4 .gnu.version    0000000a 000001a4
    5 .gnu.version_d  00000038 000001b0
    6 .note           00000054 000001e8
    7 .dynamic        00000058 0000023c
    8 .text           0000092a 00000294 TEXT
    9 .shstrtab       0000006d 00000000
   10 .ARM.exidx      00000040 00000bc0
   11 .ARM.attributes 0000003c 00000000

With LLVM 11 at 4274929c7ee6f442 + above diff:

  arch/arm64/kernel/vdso32/vdso.so:        file format elf32-littlearm

  Sections:
  Idx Name            Size     VMA      Type
    0                 00000000 00000000
    1 .hash           00000030 000000b4
    2 .dynsym         00000050 000000e4
    3 .dynstr         0000006f 00000134
    4 .gnu.version    0000000a 000001a4
    5 .gnu.version_d  00000038 000001b0
    6 .note           00000054 000001e8
    7 .dynamic        00000058 0000023c
    8 .rodata         00000000 000002a0 TEXT
    9 .text           00000912 000002a0 TEXT
   10 .ARM.exidx      00000040 00000bb4
   11 .shstrtab       00000075 00000000
   12 .ARM.attributes 0000003c 00000000

With LLVM 15 at 4274929c7ee6f442 + above diff:

  arch/arm64/kernel/vdso32/vdso.so:        file format elf32-littlearm

  Sections:
  Idx Name            Size     VMA      Type
    0                 00000000 00000000
    1 .hash           00000030 000000b4
    2 .dynsym         00000050 000000e4
    3 .dynstr         0000006f 00000134
    4 .gnu.version    0000000a 000001a4
    5 .gnu.version_d  00000038 000001b0
    6 .note           00000054 000001e8
    7 .dynamic        00000058 0000023c
    8 .rodata         00000000 000002a0 TEXT
    9 .text           00000912 000002a0 TEXT
   10 .ARM.exidx      00000040 00000bb4
   11 .shstrtab       00000075 00000000
   12 .ARM.attributes 0000003c 00000000

[1]: https://github.com/llvm/llvm-project/commit/ec29538af2e0886a65f479d6a533956a1c478132

Cheers,
Nathan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections
  2022-06-29 20:10   ` Nathan Chancellor
@ 2022-06-30 10:21     ` Joey Gouly
  0 siblings, 0 replies; 8+ messages in thread
From: Joey Gouly @ 2022-06-30 10:21 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: linux-arm-kernel, nd, Will Deacon, Vincenzo Frascino, llvm

Hi Nathan,

On Wed, Jun 29, 2022 at 01:10:10PM -0700, Nathan Chancellor wrote:
> Hi Joey,
> 
> On Tue, Jun 28, 2022 at 04:13:06PM +0100, Joey Gouly wrote:
> > These show up when building with clang+lld.
> > 
> > Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> > Cc: Will Deacon <will@kernel.org>
> > Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> > ---
> >  arch/arm64/kernel/vdso32/vdso.lds.S | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
> > index 120cf422036f..e2f8ced571d6 100644
> > --- a/arch/arm64/kernel/vdso32/vdso.lds.S
> > +++ b/arch/arm64/kernel/vdso32/vdso.lds.S
> > @@ -60,6 +60,7 @@ SECTIONS
> >  	}
> >  
> >  	ELF_DETAILS
> > +	.ARM.exidx : { *(.ARM.exidx*) }
> >  	.ARM.attributes 0 : { *(.ARM.attributes) }
> >  
> >  	/DISCARD/	: {
> > -- 
> > 2.17.1
> > 
> 
> This patch is now in -next as commit 5c4fb60816ea ("arm64: vdso32: add
> ARM.exidx* sections"), which causes the following errors with ld.lld 11:

Sorry for the breakage.

> 
>   ld.lld: error: could not allocate headers
>   ld.lld: error: unable to place section .text at file offset [0x2A0, 0xBB1]; check your linker script for overflows
>   ld.lld: error: unable to place section .comment at file offset [0xBB2, 0xC8A]; check your linker script for overflows
>   ld.lld: error: unable to place section .symtab at file offset [0xC8C, 0xE0B]; check your linker script for overflows
>   ld.lld: error: unable to place section .strtab at file offset [0xE0C, 0xF1C]; check your linker script for overflows
>   ld.lld: error: unable to place section .shstrtab at file offset [0xF1D, 0xFAA]; check your linker script for overflows
>   ld.lld: error: section .ARM.exidx file range overlaps with .hash
>   >>> .ARM.exidx range is [0x90, 0xCF]
>   >>> .hash range is [0xB4, 0xE3]
> 
>   ld.lld: error: section .hash file range overlaps with .ARM.attributes
>   >>> .hash range is [0xB4, 0xE3]
>   >>> .ARM.attributes range is [0xD0, 0x10B]
> 
>   ld.lld: error: section .ARM.attributes file range overlaps with .dynsym
>   >>> .ARM.attributes range is [0xD0, 0x10B]
>   >>> .dynsym range is [0xE4, 0x133]
> 
>   ld.lld: error: section .ARM.exidx virtual address range overlaps with .hash
>   >>> .ARM.exidx range is [0x90, 0xCF]
>   >>> .hash range is [0xB4, 0xE3]
> 
>   ld.lld: error: section .ARM.exidx load address range overlaps with .hash
>   >>> .ARM.exidx range is [0x90, 0xCF]
>   >>> .hash range is [0xB4, 0xE3]
> 
> I bisected LLVM to see what fixed this in ld.lld 12 and I landed on
> commit ec29538af2e0 ("[ELF] Assign file offsets of non-SHF_ALLOC after
> SHF_ALLOC and set sh_addr=0 to non-SHF_ALLOC") [1].
> 
> We could bump the minimum version of LLVM to 12 over this but the
> following diff appears to resolve it for me, although I am not sure as
> to why.
> 
> diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
> index 6e67a6524d58..c25bed8e6df1 100644
> --- a/arch/arm64/kernel/vdso32/vdso.lds.S
> +++ b/arch/arm64/kernel/vdso32/vdso.lds.S
> @@ -56,8 +56,8 @@ SECTIONS
>  
>  	.rel.dyn	: { *(.rel*) }
>  
> -	ELF_DETAILS
>  	.ARM.exidx : { *(.ARM.exidx*) }
> +	ELF_DETAILS
>  	.ARM.attributes 0 : { *(.ARM.attributes) }
>  
>  	/DISCARD/	: {
> 
> I just noticed that the .ARM.exidx section (ARM_UNWIND_SECTIONS)
> is placed before the sections the error mentions (ARM_DETAILS) in
> arch/arm/kernel/vmlinux.lds.S, where we do not see any errors with LLVM
> 11. Looking at the section headers, it seems like it should be okay?

I think it's good like this too, will you send it out as a patch?

Thanks,
Joey

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-06-30 10:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-28 15:13 [PATCH v1 0/2] vDSO linkerscript follow up Joey Gouly
2022-06-28 15:13 ` [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Joey Gouly
2022-06-29  9:56   ` Vincenzo Frascino
2022-06-29 20:10   ` Nathan Chancellor
2022-06-30 10:21     ` Joey Gouly
2022-06-28 15:13 ` [PATCH v1 2/2] arm64: vdso*: place got/plt sections in .rodata Joey Gouly
2022-06-29 10:11   ` Vincenzo Frascino
2022-06-28 17:02 ` [PATCH v1 0/2] vDSO linkerscript follow up Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).