[lld] [lld][LoongArch] Relax R_LARCH_PCALA_HI20 and R_LARCH_PCALA_LO12 (PR #112696)

Jinyang He via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 23:29:31 PDT 2024


================
@@ -782,6 +886,10 @@ static bool relax(Ctx &ctx, InputSection &sec) {
       }
       break;
     }
+    case R_LARCH_PCALA_HI20:
+      if (isPair(relocs, i) && relocs[i + 2].type == R_LARCH_PCALA_LO12)
----------------
MQ-mengqing wrote:

```
R_LARCH_PCALA_HI20   <-   i
R_LARCH_RELAX             <- i + 1 == reloc.size() - 1
END

Check relaxable(reloc, i) is OK.
When check relaxable(reloc, i + 2), due to the "i + 2 + 1" != reloc.size() is true, may it overflow?

```

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


More information about the llvm-commits mailing list