[lld] [ELF] Add target-specific relocation scanning for AArch64 (PR #181099)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 03:33:25 PST 2026


================
@@ -539,20 +539,22 @@ static void implementPatch(Ctx &ctx, uint64_t adrpAddr, uint64_t patcheeOffset,
   // Case 1: R_AARCH64_JUMP26 branch relocation. We have already patched this
   // instance of the erratum on a previous patch and altered the relocation. We
   // have nothing more to do.
-  // Case 2: A TLS Relaxation R_RELAX_TLS_IE_TO_LE. In this case the ADRP that
-  // we read will be transformed into a MOVZ later so we actually don't match
-  // the sequence and have nothing more to do.
-  // Case 3: A load/store register (unsigned immediate) class relocation. There
-  // are two of these R_AARCH_LD64_ABS_LO12_NC and R_AARCH_LD64_GOT_LO12_NC and
-  // they are both absolute. We need to add the same relocation to the patch,
-  // and replace the relocation with a R_AARCH_JUMP26 branch relocation.
-  // Case 4: No relocation. We must create a new R_AARCH64_JUMP26 branch
-  // relocation at the offset.
+  // Case 2: A TLS IE to LE optimization. In this case the ADRP that we read
+  // will be transformed into a MOVZ later so we actually don't match the
+  // sequence and have nothing more to do. Case 3: A load/store register
----------------
smithp35 wrote:

Would it be possible to line Case 3: and Case 4: at the start of the line? It makes it easier to find them in the text. 
```
// will be transformed into a MOVZ later so we actually don't match the
// sequence and have nothing more to do.
// Case 3: A load/store register (unsigned immediate) class relocation. There
```


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


More information about the llvm-commits mailing list