[llvm] [AArch64][PAC] Protect the entire function if pac-ret+leaf is passed (PR #140895)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 07:39:20 PDT 2025


atrosinenko wrote:

Sorry for amending an already approved PR...

As mentioned by @efriedma-quic,

> I don't think it's a problem to reorder the DWARF here... but I'd prefer that we generate consistent DWARF for pac-ret vs. pac-ret+leaf, to avoid any future confusion.

I thought a bit more on whether it is possible to make the behavior consistent for pac-ret vs. pac-ret+leaf without introducing even more complexity to emitPrologue and emitEpilogue, and realized things can be trivially improved by reordering a few lines (1f24383b7cd1e12c3a7485bb404d7c782678eb71) - aside from CFI instructions, this affected Shadow Call Stack: I assume it is not specified in which order SCS and pac-ret hardenings are applied, but now this order is stable at least.

That change made it more obvious that WinCFI may require extra care not to reorder SEH_PACSignLR and SEH_EpilogEnd, so I opted-out of this "sign everything" change on targets using WinCFI. (0a78441eee018265301ea7b3b6b492fb69c3a8f7)

 @DanielKristofKiss are you ok with these changes?

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


More information about the llvm-commits mailing list