11From git@z Thu Jan 1 00:00:00 1970
2- Subject: [PATCH] arm64: Handle .ARM.attributes section in linker scripts
2+ Subject: [PATCH v2 ] arm64: Handle .ARM.attributes section in linker scripts
33From: Nathan Chancellor <
[email protected] >
4- Date: Fri, 24 Jan 2025 06:31:57 -0700
5- Message-Id: <20250124 -arm64-handle-arm-attributes-in-linker-script-v1 -1-74135b6cf349 @kernel.org>
4+ Date: Tue, 04 Feb 2025 10:48:55 -0700
5+ Message-Id: <20250204 -arm64-handle-arm-attributes-in-linker-script-v2 -1-d684097f5554 @kernel.org>
66MIME-Version: 1.0
77Content-Type: text/plain; charset="utf-8"
88Content-Transfer-Encoding: 7bit
@@ -19,42 +19,49 @@ because it is not handled in the arm64 linker scripts.
1919 ld.lld: error: vmlinux.a(lib/win_minmax.o):(.ARM.attributes) is being placed in '.ARM.attributes'
2020 ld.lld: error: vmlinux.a(lib/xarray.o):(.ARM.attributes) is being placed in '.ARM.attributes'
2121
22- Add this new section to the necessary linker scripts to resolve the warnings.
22+ Discard the new sections in the necessary linker scripts to resolve the
23+ warnings, as the kernel and vDSO do not need to retain it, similar to
24+ the .note.gnu.property section.
2325
24262527Fixes: b3e5d80d0c48 ("arm64/build: Warn on orphan section placement")
2628Link: https://github.com/llvm/llvm-project/commit/ee99c4d4845db66c4daa2373352133f4b237c942 [1]
27- Link: https://lore.kernel.org/r/20250124 -arm64-handle-arm-attributes-in-linker-script-v1 -1-74135b6cf349 @kernel.org
29+ Link: https://lore.kernel.org/r/20250204 -arm64-handle-arm-attributes-in-linker-script-v2 -1-d684097f5554 @kernel.org
2830Signed-off-by: Nathan Chancellor <
[email protected] >
31+ ---
32+ Changes in v2:
33+ - Discard the section instead of adding it to the final artifacts to
34+ mirror the .note.gnu.property section handling (Will).
35+ - Link to v1: https://lore.kernel.org/r/20250124-arm64-handle-arm-attributes-in-linker-script-v1-1-74135b6cf349@kernel.org
2936---
3037 arch/arm64/kernel/vdso/vdso.lds.S | 1 +
3138 arch/arm64/kernel/vmlinux.lds.S | 1 +
3239 2 files changed, 2 insertions(+)
3340
3441diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
35- index 4ec32e86a8da..f8418a3a2758 100644
42+ index 4ec32e86a8da..8095fef66209 100644
3643--- a/arch/arm64/kernel/vdso/vdso.lds.S
3744+++ b/arch/arm64/kernel/vdso/vdso.lds.S
38- @@ -75,6 +75,7 @@ SECTIONS
39-
40- DWARF_DEBUG
41- ELF_DETAILS
42- + .ARM.attributes 0 : { *(.ARM.attributes) }
43-
44- /DISCARD/ : {
45+ @@ -80,6 +80,7 @@ SECTIONS
4546 *(.data .data.* .gnu.linkonce.d.* .sdata*)
47+ *(.bss .sbss .dynbss .dynsbss)
48+ *(.eh_frame .eh_frame_hdr)
49+ + *(.ARM.attributes)
50+ }
51+ }
52+
4653diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
47- index f84c71f04d9e..c94942e9eb46 100644
54+ index f84c71f04d9e..e73326bd3ff7 100644
4855--- a/arch/arm64/kernel/vmlinux.lds.S
4956+++ b/arch/arm64/kernel/vmlinux.lds.S
50- @@ -335,6 +335,7 @@ SECTIONS
51- STABS_DEBUG
52- DWARF_DEBUG
53- ELF_DETAILS
54- + .ARM.attributes 0 : { *(.ARM.attributes) }
55-
56- HEAD_SYMBOLS
57+ @@ -162,6 +162,7 @@ SECTIONS
58+ /DISCARD/ : {
59+ *(.interp .dynamic)
60+ *(.dynsym .dynstr .hash .gnu.hash)
61+ + *(.ARM.attributes)
62+ }
5763
64+ . = KIMAGE_VADDR;
5865
5966---
6067base-commit: 1dd3393696efba1598aa7692939bba99d0cffae3
0 commit comments