]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: Handle .ARM.attributes section in linker scripts
authorNathan Chancellor <nathan@kernel.org>
Thu, 6 Feb 2025 17:21:38 +0000 (10:21 -0700)
committerWill Deacon <will@kernel.org>
Fri, 7 Feb 2025 09:56:57 +0000 (09:56 +0000)
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: stable@vger.kernel.org
Fixes: b3e5d80d0c48 ("arm64/build: Warn on orphan section placement")
Link: https://github.com/llvm/llvm-project/commit/ee99c4d4845db66c4daa2373352133f4b237c942
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250206-arm64-handle-arm-attributes-in-linker-script-v3-1-d53d169913eb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/vdso/vdso.lds.S
arch/arm64/kernel/vmlinux.lds.S

index 4ec32e86a8da22d5e2315e55ae2e86ec8e7f5f9a..47ad6944f9f088acbc52a75ad6a4f6c7a4e93be6 100644 (file)
@@ -41,6 +41,7 @@ SECTIONS
         */
        /DISCARD/       : {
                *(.note.GNU-stack .note.gnu.property)
+               *(.ARM.attributes)
        }
        .note           : { *(.note.*) }                :text   :note
 
index f84c71f04d9ea9fa1885869a2289c646b18f91a1..e73326bd3ff7e9282f3b80727e89fb8ec1fe88ea 100644 (file)
@@ -162,6 +162,7 @@ SECTIONS
        /DISCARD/ : {
                *(.interp .dynamic)
                *(.dynsym .dynstr .hash .gnu.hash)
+               *(.ARM.attributes)
        }
 
        . = KIMAGE_VADDR;