From: Nathan Chancellor <nathan@kernel.org> To: Joey Gouly <joey.gouly@arm.com> Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com, Will Deacon <will@kernel.org>, Vincenzo Frascino <vincenzo.frascino@arm.com>, llvm@lists.linux.dev Subject: Re: [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Date: Wed, 29 Jun 2022 13:10:10 -0700 [thread overview] Message-ID: <YryxouOYOJLM+DDK@dev-arch.thelio-3990X> (raw) In-Reply-To: <20220628151307.35561-2-joey.gouly@arm.com> 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
WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org> To: Joey Gouly <joey.gouly@arm.com> Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com, Will Deacon <will@kernel.org>, Vincenzo Frascino <vincenzo.frascino@arm.com>, llvm@lists.linux.dev Subject: Re: [PATCH v1 1/2] arm64: vdso32: add ARM.exidx* sections Date: Wed, 29 Jun 2022 13:10:10 -0700 [thread overview] Message-ID: <YryxouOYOJLM+DDK@dev-arch.thelio-3990X> (raw) In-Reply-To: <20220628151307.35561-2-joey.gouly@arm.com> 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
next prev parent reply other threads:[~2022-06-29 20:10 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 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 [this message] 2022-06-29 20:10 ` Nathan Chancellor 2022-06-30 10:21 ` Joey Gouly 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YryxouOYOJLM+DDK@dev-arch.thelio-3990X \ --to=nathan@kernel.org \ --cc=joey.gouly@arm.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=llvm@lists.linux.dev \ --cc=nd@arm.com \ --cc=vincenzo.frascino@arm.com \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.