[PATCH] D135103: RFC: [AArch64] Add SEH_Nop for PAC/BTI instructions in prologues/epilogues

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 15:25:29 PDT 2022


efriedma added a comment.

For the following example:

  int f(void g(), int a) { g(); return a; }

If I compile with the following command:

  cl /c a.c /d2guardsignret

llvm-readobj gives me the following:

  File: a.obj
  Format: COFF-ARM64
  Arch: aarch64
  AddressSize: 64bit
  UnwindInformation [
    RuntimeFunction {
      Function: f (0x0)
      ExceptionRecord: $unwind$f (0x0)
      ExceptionData {
        FunctionLength: 40
        Version: 0
        ExceptionData: No
        EpiloguePacked: Yes
        EpilogueOffset: 0
        ByteCodeLength: 8
        Prologue [
          0xd600              ; stp x19, lr, [sp, #0]
          0x01                ; sub sp, #16
          0xfc                ; Bad opcode!
          0xe4                ; end
        ]
      }
    }
  ]

So apparently there is, in fact, a way to encode this, using the undocumented opcode 0xfc.  Why this isn't documented, I have no idea.

------

Mapping BTI instructions to no-ops seems fine; I can't imagine any other encoding makes sense, even if Microsoft does implement it at some point.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135103/new/

https://reviews.llvm.org/D135103



More information about the llvm-commits mailing list