[lld] [PAC][lld][AArch64][ELF] Support signed TLSDESC (PR #113817)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 21:41:04 PST 2025


================
@@ -1328,6 +1328,20 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
     return 1;
   }
 
+  // Do not optimize signed TLSDESC (as described in pauthabielf64 to LE/IE).
----------------
kovdan01 wrote:

Please let me know if d67040d145047137645655a1140607db20e2695f addresses your concern or if smth else should be done.

I've moved these two if statements to `handleAArch64PAuthTlsRelocation` helper which is called in case of `ctx.arg.emachine == EM_AARCH64` at the beginning of `handleTlsRelocation`. Also, added check against AArch64 when adding `NEEDS_TLSDESC_NONAUTH` flag (to ensure that we do not change behavior for other targets; this check is not necessary right now though).

This still changes `handleTlsRelocation` and I'm not sure if it addresses your comment, but, it looks like that if we try to create a completely separate handler for AArch64, it would require code duplication inside that handler and also we'll have an additional if statement against AArch64 when calling `handleTlsRelocation` from `scanOne`, and this looks undesirable as well.

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


More information about the llvm-commits mailing list