[clang] [lld] [lld][LoongArch] Enable relaxation when --relax option is passed (PR #111488)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 13 23:03:30 PDT 2024
================
@@ -1462,6 +1462,8 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
for (;;) {
bool changed = ctx.target->needsThunks
? tc.createThunks(pass, ctx.outputSections)
+ : ctx.arg.emachine == EM_LOONGARCH && !ctx.arg.relax
----------------
ywgrit wrote:
> > Yes, it was an oversight. So for scenarios outside of align, is it necessary to determine whether or not to apply relaxation via the incoming link parameter, i.e. --relax? For example, in the relax function
>
> I'm afraid it's not necessary because R_LARCH_RELAX is converted to R_NONE by function `getRelExpr` when `--no-relax`.
>
> ```
> case R_LARCH_RELAX:
> return ctx.arg.relax ? R_RELAX_HINT : R_NONE;
> case R_LARCH_ALIGN:
> return R_RELAX_HINT
> ```
>
> Is it correct? @MQ-mengqing
Thanks for the reminder, I test both on RISCV and LoongArch, the relocation which corresponding RelExpr is R_NONE will be ignored. The changes of test files will be reverted.
https://github.com/llvm/llvm-project/pull/111488
More information about the cfe-commits
mailing list