Skip to content

Commit 4dc9b28

Browse files
brooniewilldeacon
authored andcommitted
arm64: Depend on newer binutils when building PAC
Versions of binutils prior to 2.33.1 don't understand the ELF notes that are added by modern compilers to indicate the PAC and BTI options used to build the code. This causes them to emit large numbers of warnings in the form: aarch64-linux-gnu-nm: warning: .tmp_vmlinux.kallsyms2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000 during the kernel build which is currently causing quite a bit of disruption for automated build testing using clang. In commit 15cd0e6 (arm64: Kconfig: ptrauth: Add binutils version check to fix mismatch) we added a dependency on binutils to avoid this issue when building with versions of GCC that emit the notes but did not do so for clang as it was believed that the existing check for .cfi_negate_ra_state was already requiring a new enough binutils. This does not appear to be the case for some versions of binutils (eg, the binutils in Debian 10) so instead refactor so we require a new enough GNU binutils in all cases other than when we are using an old GCC version that does not emit notes. Other, more exotic, combinations of tools are possible such as using clang, lld and gas together are possible and may have further problems but rather than adding further version checks it looks like the most robust thing will be to just test that we can build cleanly with the configured tools but that will require more review and discussion so do this for now to address the immediate problem disrupting build testing. Reported-by: KernelCI <[email protected]> Reported-by: Nick Desaulniers <[email protected]> Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Link: ClangBuiltLinux#1054 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 2d07196 commit 4dc9b28

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,9 +1518,9 @@ config ARM64_PTR_AUTH
15181518
default y
15191519
depends on !KVM || ARM64_VHE
15201520
depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
1521-
# GCC 9.1 and later inserts a .note.gnu.property section note for PAC
1521+
# Modern compilers insert a .note.gnu.property section note for PAC
15221522
# which is only understood by binutils starting with version 2.33.1.
1523-
depends on !CC_IS_GCC || GCC_VERSION < 90100 || LD_VERSION >= 233010000
1523+
depends on LD_IS_LLD || LD_VERSION >= 233010000 || (CC_IS_GCC && GCC_VERSION < 90100)
15241524
depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
15251525
depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
15261526
help

0 commit comments

Comments
 (0)