* [PATCH] arm64: Handle .ARM.attributes section in linker scripts
@ 2025-01-24 13:31 Nathan Chancellor
2025-02-04 11:54 ` Will Deacon
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2025-01-24 13:31 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: linux-arm-kernel, linux-kernel, llvm, stable, Nathan Chancellor
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'
Add this new section to the necessary linker scripts to resolve the warnings.
Cc: stable@vger.kernel.org
Fixes: b3e5d80d0c48 ("arm64/build: Warn on orphan section placement")
Link: https://github.com/llvm/llvm-project/commit/ee99c4d4845db66c4daa2373352133f4b237c942 [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/arm64/kernel/vdso/vdso.lds.S | 1 +
arch/arm64/kernel/vmlinux.lds.S | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index 4ec32e86a8da..f8418a3a2758 100644
--- a/arch/arm64/kernel/vdso/vdso.lds.S
+++ b/arch/arm64/kernel/vdso/vdso.lds.S
@@ -75,6 +75,7 @@ SECTIONS
DWARF_DEBUG
ELF_DETAILS
+ .ARM.attributes 0 : { *(.ARM.attributes) }
/DISCARD/ : {
*(.data .data.* .gnu.linkonce.d.* .sdata*)
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index f84c71f04d9e..c94942e9eb46 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -335,6 +335,7 @@ SECTIONS
STABS_DEBUG
DWARF_DEBUG
ELF_DETAILS
+ .ARM.attributes 0 : { *(.ARM.attributes) }
HEAD_SYMBOLS
---
base-commit: 1dd3393696efba1598aa7692939bba99d0cffae3
change-id: 20250123-arm64-handle-arm-attributes-in-linker-script-82aee25313ac
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] arm64: Handle .ARM.attributes section in linker scripts
2025-01-24 13:31 [PATCH] arm64: Handle .ARM.attributes section in linker scripts Nathan Chancellor
@ 2025-02-04 11:54 ` Will Deacon
0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2025-02-04 11:54 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Catalin Marinas, linux-arm-kernel, linux-kernel, llvm, stable
On Fri, Jan 24, 2025 at 06:31:57AM -0700, Nathan Chancellor wrote:
> 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'
>
> Add this new section to the necessary linker scripts to resolve the warnings.
>
> Cc: stable@vger.kernel.org
> Fixes: b3e5d80d0c48 ("arm64/build: Warn on orphan section placement")
> Link: https://github.com/llvm/llvm-project/commit/ee99c4d4845db66c4daa2373352133f4b237c942 [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> arch/arm64/kernel/vdso/vdso.lds.S | 1 +
> arch/arm64/kernel/vmlinux.lds.S | 1 +
> 2 files changed, 2 insertions(+)
Hmm. I wonder what this new attributes section is for and how it will
co-exist with .note.gnu.property in future? For example, the spec linked
form the above commit:
https://github.com/ARM-software/abi-aa/pull/230
has references to GCS, which I don't think has a corresponding feature
bit for the ELF note (at least, Linux doesn't know about it if it does).
> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
> index 4ec32e86a8da..f8418a3a2758 100644
> --- a/arch/arm64/kernel/vdso/vdso.lds.S
> +++ b/arch/arm64/kernel/vdso/vdso.lds.S
> @@ -75,6 +75,7 @@ SECTIONS
>
> DWARF_DEBUG
> ELF_DETAILS
> + .ARM.attributes 0 : { *(.ARM.attributes) }
Let's just add this to the /DISCARD/ section higher up, where we chuck
away .note.gnu.property.
> diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
> index f84c71f04d9e..c94942e9eb46 100644
> --- a/arch/arm64/kernel/vmlinux.lds.S
> +++ b/arch/arm64/kernel/vmlinux.lds.S
> @@ -335,6 +335,7 @@ SECTIONS
> STABS_DEBUG
> DWARF_DEBUG
> ELF_DETAILS
> + .ARM.attributes 0 : { *(.ARM.attributes) }
I think we should discard this too (afaict, RO_DATA() discards
.note.gnu.property via NOTES()).
Will
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-04 11:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24 13:31 [PATCH] arm64: Handle .ARM.attributes section in linker scripts Nathan Chancellor
2025-02-04 11:54 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox