[clang] [lld] [lld][LoongArch] Enable relaxation when --relax option is passed (PR #111488)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 18:14:35 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:

> > ctx.arg.relax is used here because we want to determine whether or not to apply relaxation based on the parameters passed at the time of linking.
> 
> I don't think so. R_LARCH_ALIGN should be handled unconditionally, otherwise the code may be unaligned.

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

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


More information about the llvm-commits mailing list