Skip to content

Commit 9abfb2c

Browse files
nathanchancegregkh
authored andcommitted
arm64: Handle .ARM.attributes section in linker scripts
commit ca0f4fe upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 78be8f7 commit 9abfb2c

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
@@ -37,6 +37,7 @@ SECTIONS
3737
*/
3838
/DISCARD/ : {
3939
*(.note.GNU-stack .note.gnu.property)
40+
*(.ARM.attributes)
4041
}
4142
.note : { *(.note.*) } :text :note
4243

arch/arm64/kernel/vmlinux.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ SECTIONS
139139
/DISCARD/ : {
140140
*(.interp .dynamic)
141141
*(.dynsym .dynstr .hash .gnu.hash)
142+
*(.ARM.attributes)
142143
}
143144

144145
. = KIMAGE_VADDR;

0 commit comments

Comments
 (0)