[lld] [lld][LoongArch] Relax R_LARCH_PCALA_HI20 and R_LARCH_PCALA_LO12 (PR #112696)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 18 00:36:08 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)
----------------
ywgrit 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?
> ```
It seems that in the isPair function, it would be better to change i + 1 ! = relocs.size() to i + 1 < relocs.size() .
https://github.com/llvm/llvm-project/pull/112696
More information about the llvm-commits
mailing list