[llvm] Do not use R12 for indirect tail calls with PACBTI (PR #82661)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 03:33:38 PDT 2024


ostannard wrote:

> I don't think you need to use "sign-return-address"="all" in the test [here](https://github.com/ostannard/llvm-project/blob/6758bbbc95400bb82772433d4897e6aa272421dc/llvm/test/CodeGen/AArch64/branch-target-enforcement-indirect-calls.ll) then.

That's true, I don't think I realised at the time that it wasn't needed, but since `sign-return-address` is automatically enabled by `branch-protection-pauth-lr`, I don't think we need change the test.

> I don't see the r14 spilled here. So does this mean the PAC/AUT should not have been added to this function?

`r14` is being spilled by the `push	{r7, lr}` instruction (`lr` is an alias for `r14`), because it is clobbered by the inline assembly (`~{lr}` in the constraint string), so the compiler is correct to emit the PAC/AUT instructions here. Instead, your change needs to trigger here, and prevent r12 being used by the `bx` instruction.

https://github.com/llvm/llvm-project/pull/82661


More information about the llvm-commits mailing list