arm64: vdso32: Small fixes for ld.lld 11 and CONFIG_DEBUG_INFO
cover arm64: vdso32: Small fixes for ld.lld 11 and CONFIG_DEBUG_INFO
Hi all,
This small series fixes two issues I noticed with the orphan section warnings in the 32-bit vDSO. See the individual commits for the boring details.
They are based on for-next/vdso. I compiled with LLVM 11, LLVM 15, and GCC 12.1.0 + binutils 2.38 with no additional warnings/errors.
Nathan Chancellor (2):
arm64: vdso32: Shuffle .ARM.exidx section above ELF_DETAILS
arm64: vdso32: Add DWARF_DEBUG
arch/arm64/kernel/vdso32/vdso.lds.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
base-commit: 4274929c7ee6f442c3f89c5da64d112a9de4a6ba
Signature · 1 line
2.37.0
PATCH 1/2 arm64: vdso32: Shuffle .ARM.exidx section above ELF_DETAILS
When building the 32-bit vDSO after commit 5c4fb60816ea ("arm64: vdso32:
add ARM.exidx* sections"), ld.lld 11 fails to link:
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
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.exidx range is [
0x90,0xCF]
.hash range is [0xB4,0xE3]
ld.lld: error: section .hash file range overlaps with .ARM.attributes
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.hash range is [
0xB4,0xE3]
.ARM.attributes range is [0xD0,0x10B]
ld.lld: error: section .ARM.attributes file range overlaps with .dynsym
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.attributes range is [
0xD0,0x10B]
.dynsym range is [0xE4,0x133]
ld.lld: error: section .ARM.exidx virtual address range overlaps with .hash
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.exidx range is [
0x90,0xCF]
.hash range is [0xB4,0xE3]
ld.lld: error: section .ARM.exidx load address range overlaps with .hash
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.exidx range is [
0x90,0xCF]
.hash range is [0xB4,0xE3]
This was fixed in ld.lld 12 with a change to match GNU ld's semantics of placing non-SHF_ALLOC sections after SHF_ALLOC sections.
To workaround this issue, move the .ARM.exidx section before the .comment, .symtab, .strtab, and .shstrtab sections (ELF_DETAILS) so that those sections remain contiguous with the .ARM.attributes section.
--- arch/arm64/kernel/vdso32/vdso.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/vdso32/vdso.lds.S +1 -1
@@ -56,8 +56,8 @@ SECTIONS .rel.dyn : { *(.rel*) } - ELF_DETAILS .ARM.exidx : { *(.ARM.exidx*) } + ELF_DETAILS .ARM.attributes 0 : { *(.ARM.attributes) } /DISCARD/ : {
Signature · 1 line
2.37.0
Re: [PATCH 1/2] arm64: vdso32: Shuffle .ARM.exidx section above ELF_DETAILS
Quoted 29 lines · Nathan Chancellor
When building the 32-bit vDSO after commit
5c4fb60816ea("arm64: vdso32:
add ARM.exidx* sections"), ld.lld 11 fails to link: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 .hashQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.exidx range is [
0x90,0xCF]
.hash range is [0xB4,0xE3]ld.lld: error: section .hash file range overlaps with .ARM.attributes
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.hash range is [
0xB4,0xE3]
.ARM.attributes range is [0xD0,0x10B]ld.lld: error: section .ARM.attributes file range overlaps with .dynsym
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.attributes range is [
0xD0,0x10B]
.dynsym range is [0xE4,0x133]ld.lld: error: section .ARM.exidx virtual address range overlaps with .hash
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.exidx range is [
0x90,0xCF]
.hash range is [0xB4,0xE3]ld.lld: error: section .ARM.exidx load address range overlaps with .hash
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.ARM.exidx range is [
0x90,0xCF]
.hash range is [0xB4,0xE3]
Quoted 8 lines
This was fixed in ld.lld 12 with a change to match GNU ld's semantics of placing non-SHF_ALLOC sections after
SHF_ALLOCsections.To workaround this issue, move the .ARM.exidx section before the .comment, .symtab, .strtab, and .shstrtab sections (
ELF_DETAILS) so that those sections remain contiguous with the .ARM.attributes section.Fixes 5c4fb60816ea ("arm64: vdso32: add ARM.exidx* sections")
This should have been included to point out the exact commit that fixed this in ld.lld, I can resend if necessary (since I also screwed up the [email protected] domain...)
Quoted 22 lines
Signed-off-by Nathan Chancellor <[email protected]>--- arch/arm64/kernel/vdso32/vdso.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kernel/vdso32/vdso.lds.S +1
-1@@ -56,8 +56,8 @@ SECTIONS .rel.dyn : { *(.rel*) } - ELF_DETAILS .ARM.exidx : { *(.ARM.exidx*) } + ELF_DETAILS .ARM.attributes 0 : { *(.ARM.attributes) } /DISCARD/ : {Signature · 1 line
2.37.0
PATCH 2/2 arm64: vdso32: Add DWARF_DEBUG
In reply to Nathan ChancellorWhen building the 32-bit vDSO with LLVM 15 and CONFIG_DEBUG_INFO, there are the following orphan section warnings:
ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_abbrev) is being placed in '.debug_abbrev' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_info) is being placed in '.debug_info' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_str_offsets) is being placed in '.debug_str_offsets' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_str) is being placed in '.debug_str' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_addr) is being placed in '.debug_addr' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_line) is being placed in '.debug_line' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_line_str) is being placed in '.debug_line_str' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_loclists) is being placed in '.debug_loclists' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_abbrev) is being placed in '.debug_abbrev' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_info) is being placed in '.debug_info' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_rnglists) is being placed in '.debug_rnglists' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_str_offsets) is being placed in '.debug_str_offsets' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_str) is being placed in '.debug_str' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_addr) is being placed in '.debug_addr' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_frame) is being placed in '.debug_frame' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_line) is being placed in '.debug_line' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_line_str) is being placed in '.debug_line_str'
These are DWARF5 sections, as that is the implicit default version for clang-14 and newer when just '-g' is used. All DWARF sections are handled by the DWARF_DEBUG macro from include/asm-generic/vmlinux.lds.h so use that macro here to fix the warnings regardless of DWARF version.
--- arch/arm64/kernel/vdso32/vdso.lds.S | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/vdso32/vdso.lds.S +1 -0
@@ -57,6 +57,7 @@ SECTIONS .rel.dyn : { *(.rel*) } .ARM.exidx : { *(.ARM.exidx*) } + DWARF_DEBUG ELF_DETAILS .ARM.attributes 0 : { *(.ARM.attributes) }
Signature · 1 line
2.37.0
Re: [PATCH 2/2] arm64: vdso32: Add DWARF_DEBUG
Quoted 22 lines · Nathan Chancellor
When building the 32-bit vDSO with LLVM 15 and
CONFIG_DEBUG_INFO, there are the following orphan section warnings:ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_abbrev) is being placed in '.debug_abbrev' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_info) is being placed in '.debug_info' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_str_offsets) is being placed in '.debug_str_offsets' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_str) is being placed in '.debug_str' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_addr) is being placed in '.debug_addr' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_line) is being placed in '.debug_line' ld.lld: warning: arch/arm64/kernel/vdso32/note.o:(.debug_line_str) is being placed in '.debug_line_str' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_loclists) is being placed in '.debug_loclists' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_abbrev) is being placed in '.debug_abbrev' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_info) is being placed in '.debug_info' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_rnglists) is being placed in '.debug_rnglists' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_str_offsets) is being placed in '.debug_str_offsets' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_str) is being placed in '.debug_str' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_addr) is being placed in '.debug_addr' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_frame) is being placed in '.debug_frame' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_line) is being placed in '.debug_line' ld.lld: warning: arch/arm64/kernel/vdso32/vgettimeofday.o:(.debug_line_str) is being placed in '.debug_line_str'
Quoted 1 line
These are DWARF5 sections, as that is the implicit default version for
Most of these are DWARF v5, but some like .debug_info and .debug_line are DWARF v2; this isn't specifically a DWARF v5 issue, more so just an issue with CONFIG_DEBUG_INFO. Not worth a v2 IMO though. Thanks for the patch!
Quoted 25 lines
clang-14 and newer when just '-g' is used. All DWARF sections are handled by the
DWARF_DEBUGmacro frominclude/asm-generic/vmlinux.lds.hso use that macro here to fix the warnings regardless of DWARF version.Fixes 9d4775b332e1 ("arm64: vdso32: enable orphan handling for VDSO")Signed-off-by Nathan Chancellor <[email protected]>--- arch/arm64/kernel/vdso32/vdso.lds.S | 1 + 1 file changed, 1 insertion(+)arch/arm64/kernel/vdso32/vdso.lds.S +1
-1@@ -57,6 +57,7 @@ SECTIONS .rel.dyn : { *(.rel*) } .ARM.exidx : { *(.ARM.exidx*) } + DWARF_DEBUG ELF_DETAILS .ARM.attributes 0 : { *(.ARM.attributes) } --2.37.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 8 lines · Nathan Chancellor
This small series fixes two issues I noticed with the orphan section warnings in the 32-bit vDSO. See the individual commits for the boring details.
They are based on for-next/vdso. I compiled with LLVM 11, LLVM 15, and GCC 12.1.0 + binutils 2.38 with no additional warnings/errors.
[...]
Applied to arm64 (for-next/vdso), thanks!
[1/2] arm64: vdso32: Shuffle .ARM.exidx section above ELF_DETAILS
https://git.kernel.org/arm64/c/859716b4131f [2/2] arm64: vdso32: Add DWARF_DEBUG https://git.kernel.org/arm64/c/9e07352ef779
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev