Revisiting c0a454b9044f

Mark Rutland mark.rutland at arm.com
Tue Jul 15 04:16:07 PDT 2025


On Mon, Jul 14, 2025 at 12:52:05PM -0700, Nathan Chancellor wrote:
> Hi all,

Hi Nethan,

> I am looking to potentially bump the minimum version of LLVM for
> building the kernel to 15.0.0 after the next merge window. In my quest
> to look for workarounds that can be dropped, I noticed that
> CONFIG_ARM64_BTI_KERNEL was disabled unconditionally for GCC in commit
> c0a454b9044f ("arm64/bti: Disable in kernel BTI when cross section
> thunks are broken") as a result of [1]. Looking at that GCC report, it
> seems like the AArch64 ABI now documents [2] the GNU toolchain's
> behavior as expected 

For context, at the time of commit c0a454b9044f, GNU LD did not handle
this appropriately, leading to runtime BTI failures where two sections
were too far apart.

GNU LD was subsequently fixed, and the ABI documentation was updated,
but I'm not sure which specific versions of GNU LD have the fix, and we
hadn't chased that up to re-enable BTI with GCC.

> and LLVM has been adjusted [3][4][5] to match. Do I need to block
> CONFIG_ARM64_BTI_KERNEL from being selected with LLVM 21.0.0?

I'm missing something; why would we need to dsiable BTI in that case?

The concern from the kernel side is simply whether we get unexpected BTI
failures. IIUC so long as compiler and linker agree we should be good,
and we simply need to forbid broken combinations.

> Or should the kernel adjust its expectations now that the ABI and
> toolchains all agree?

Yes, we can probably rework this.

IIUC we'd need to forbid BTI with:

* GCC + old GNU LD
* GCC + old LLD
* new clang + old GNU LD
* new clang + old LLD

... and can enable BTI otherwise.

Does that make sense to you?

Mark.
 
> Cheers,
> Nathan
> 
> [1]: https://gcc.gnu.org/pr106671
> [2]: https://github.com/ARM-software/abi-aa/commit/606ce44fe4d3419c15cd9ed598f18fb5d520fcfc
> [3]: https://github.com/llvm/llvm-project/commit/7af2b51e761f49974a64c3009882239cea618f2a
> [4]: https://github.com/llvm/llvm-project/commit/edf21314c98a4fe05d48f83dfab2b201ed8bfe9c
> [5]: https://github.com/llvm/llvm-project/commit/098b0d18add97dea94e16006486b2fded65e228d



More information about the linux-arm-kernel mailing list