Skip to content

Commit ca0f4fe

Browse files
nathanchancewilldeacon
authored andcommitted
arm64: Handle .ARM.attributes section in linker scripts
A recent LLVM commit [1] started generating an .ARM.attributes section similar to the one that exists for 32-bit, which results in orphan section warnings (or errors if CONFIG_WERROR is enabled) from the linker because it is not handled in the arm64 linker scripts. ld.lld: error: arch/arm64/kernel/vdso/vgettimeofday.o:(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: arch/arm64/kernel/vdso/vgetrandom.o:(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/vsprintf.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/win_minmax.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/xarray.o):(.ARM.attributes) is being placed in '.ARM.attributes' Discard the new sections in the necessary linker scripts to resolve the warnings, as the kernel and vDSO do not need to retain it, similar to the .note.gnu.property section. Cc: [email protected] Fixes: b3e5d80 ("arm64/build: Warn on orphan section placement") Link: llvm/llvm-project@ee99c4d [1] Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/20250206-arm64-handle-arm-attributes-in-linker-script-v3-1-d53d169913eb@kernel.org Signed-off-by: Will Deacon <[email protected]>
1 parent 21fed7c commit ca0f4fe

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/arm64/kernel/vdso/vdso.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ SECTIONS
4141
*/
4242
/DISCARD/ : {
4343
*(.note.GNU-stack .note.gnu.property)
44+
*(.ARM.attributes)
4445
}
4546
.note : { *(.note.*) } :text :note
4647

arch/arm64/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ SECTIONS
162162
/DISCARD/ : {
163163
*(.interp .dynamic)
164164
*(.dynsym .dynstr .hash .gnu.hash)
165+
*(.ARM.attributes)
165166
}
166167

167168
. = KIMAGE_VADDR;

0 commit comments

Comments
 (0)