[llvm] [BOLT][AArch64] Support for pointer authentication (v2) (PR #120064)

Gergely Bálint via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 04:10:31 PST 2025


================
@@ -632,8 +643,13 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
       // DW_CFA_GNU_window_save and DW_CFA_GNU_NegateRAState just use the same
       // id but mean different things. The latter is used in AArch64.
       if (Function.getBinaryContext().isAArch64()) {
-        Function.addCFIInstruction(
-            Offset, MCCFIInstruction::createNegateRAState(nullptr));
+        // Not adding OpNegateRAState since the location they are needed
+        // depends on the order of BasicBlocks, which changes during
+        // optimizations. Instead, an annotation is added to the instruction, to
+        // mark that the instruction modifies the RA State. The actual state for
+        // instructions are worked out in MarkRAStates based on these
+        // annotations.
----------------
bgergely0 wrote:

> The first sentence below is based on the fact that previously addCFIInstruction was used with OpNegateRAState, right?

Yes, but it's also based on that all other CFIs are added with `addCFIInstruction` and this one isn't, so it could look like a missing call to the addCFIInstruction function. But I will reword it a bit, so it's more clear.

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


More information about the llvm-commits mailing list