[llvm-branch-commits] [lld] [PAC][lld] Use braa instr in PAC PLT sequence with valid PAuth core info (PR #113945)

Peter Smith via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 4 09:35:36 PST 2024


================
@@ -1096,8 +1113,10 @@ void AArch64BtiPac::writePlt(uint8_t *buf, const Symbol &sym,
   relocateNoSym(buf + 4, R_AARCH64_LDST64_ABS_LO12_NC, gotPltEntryAddr);
   relocateNoSym(buf + 8, R_AARCH64_ADD_ABS_LO12_NC, gotPltEntryAddr);
 
-  if (pacEntry)
-    memcpy(buf + sizeof(addrInst), pacBr, sizeof(pacBr));
+  if (pacEntryKind != PEK_NoAuth)
+    memcpy(buf + sizeof(addrInst),
+           pacEntryKind == PEK_AuthHint ? pacHintBr : pacBr,
----------------
smithp35 wrote:

Could be a possibility to make pacHintBr and pacBr into an array indexed by pacEntryKind.
```
memcpy(buf + sizeof(addrInst),
  pacBrInstrs[pacEntryKind],
  sizeof(pacBrInstrs[pacEntryKind]));
```

Not sure if it is worth the trouble though.

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


More information about the llvm-branch-commits mailing list