[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)

Daniil Kovalev via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 8 03:50:26 PDT 2024


================
@@ -1866,6 +1876,20 @@ void AArch64AsmPrinter::LowerMOVaddrPAC(const MachineInstr &MI) {
   assert(STI->getInstrInfo()->getInstSizeInBytes(MI) >= InstsEmitted * 4);
 }
 
+const MCExpr *
+AArch64AsmPrinter::lowerBlockAddressConstant(const BlockAddress &BA) {
+  const MCExpr *BAE = AsmPrinter::lowerBlockAddressConstant(BA);
+  const Function &Fn = *BA.getFunction();
+
+  if (std::optional<uint16_t> BADisc =
+          STI->getPtrAuthBlockAddressDiscriminator(Fn))
+    return AArch64AuthMCExpr::create(BAE, *BADisc, AArch64PACKey::IA,
+                                     /* HasAddressDiversity= */ false,
----------------
kovdan01 wrote:

Nit: it looks like that across llvm it's more common not to leave spaces inside comment in such case https://llvm.org/docs/CodingStandards.html#comment-formatting

```suggestion
                                     /*HasAddressDiversity=*/ false,
```

Feel free to ignore

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


More information about the cfe-commits mailing list