[lld] [RISCV][LLD] Zcmt RISC-V extension in lld (PR #163142)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 11:07:31 PDT 2025


================
@@ -739,6 +760,32 @@ void elf::initSymbolAnchors(Ctx &ctx) {
   }
 }
 
+static bool relaxTableJump(Ctx &ctx, const InputSection &sec, size_t i,
+                           uint64_t loc, Relocation &r, uint32_t &remove) {
+  if (!ctx.in.riscvTableJumpSection ||
+      !ctx.in.riscvTableJumpSection->isFinalized)
+    return false;
+
+  const uint32_t jalr = read32le(sec.contentMaybeDecompress().data() +
+                                 r.offset + (r.type == R_RISCV_JAL ? 0 : 4));
+  const uint8_t rd = extractBits(jalr, 11, 7);
+  int tblEntryIndex = -1;
+  if (rd == 0) {
----------------
topperc wrote:

```suggestion
  if (rd == X_X0) {
```

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


More information about the llvm-commits mailing list