[llvm-branch-commits] [NFCI][ELF][AArch64][PAC] Teach addRelativeReloc to emit R_AARCH64_AUTH_RELATIVE (PR #171180)

Daniil Kovalev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 11 22:12:08 PST 2025


================
@@ -704,8 +704,10 @@ static void addRelativeReloc(Ctx &ctx, InputSectionBase &isec,
                              uint64_t offsetInSec, Symbol &sym, int64_t addend,
                              RelExpr expr, RelType type) {
   Partition &part = isec.getPartition(ctx);
+  bool isAArch64Auth =
+      ctx.arg.emachine == EM_AARCH64 && type == R_AARCH64_AUTH_ABS64;
 
-  if (sym.isTagged()) {
+  if (sym.isTagged() && !isAArch64Auth) {
----------------
kovdan01 wrote:

> Is the existing implementation that uses .relr.auth.dyn and/or no offset to the start of the symbol for AUTH_RELATIVE relocations against tagged symbols correct?

@jrtc27 When implementing support for `.relr.auth.dyn` initially, I was not accounting for tagged symbols. See initial PR for relr auth support just in case it helps (things might have changed over time though): #96496.

And from my side, I unfortunately can't tell you for sure if the existing implementation is correct in terms of using memtag + pauth at the same time since I've never have used such a combination.

But given the description from docs and explanation from comments in this thread above (that these two features are using different bits and are not overlapping), I suppose that the following is correct:

> it should be doing the "obvious" composition of the two.

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


More information about the llvm-branch-commits mailing list