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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 17 22:05:03 PST 2024


================
@@ -737,6 +737,17 @@ uint64_t InputSectionBase::getRelocTargetVA(Ctx &ctx, const Relocation &r,
   int64_t a = r.addend;
   switch (r.expr) {
   case R_ABS:
+    // pcalau12i,addi.[wd] => pcaddi
+    // With relaxation applied, the relocation type of the third
+    // reloc entry which corresponds to the addi.[wd] insn is converted
+    // from R_LARCH_PCALA_LO12 to R_LARCH_PCREL20_S2.
+    if (r.type == R_LARCH_PCREL20_S2) {
----------------
MaskRay wrote:

This adds overhead to R_ABS (numerous) for other targets. Should be avoided by using a new RelExpr for LoongArch.

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


More information about the llvm-commits mailing list