[clang] [lld] [Driver] Default enable LoongArch linker relaxation (PR #111488)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 15 19:06:43 PDT 2024


MaskRay wrote:

Personally I hope that `-mrelax` stays 

> > How about now?
> 
> The patch doesn't touch lld, so my suggestion is "[Driver] Default enable LoongArch linker relaxation".
> 
> Some additional comments:
> 
> * Do we need to consider the `-gsplit-dwarf` issue [MC: "error: A dwo section may not contain relocations" when building with fission + RISCV64 #56642](https://github.com/llvm/llvm-project/issues/56642) resolved by https://reviews.llvm.org/D130190 ?
> * The `--no-relax` option should be passed to linker, see [[Clang][RISCV] Forward --no-relax option to linker for RISC-V #76432](https://github.com/llvm/llvm-project/pull/76432)
> * Pass `-X` to linker to discard a plethora of `.L` symbols due to linker relaxation. See https://reviews.llvm.org/D127826

This is a good summary and there are many reasons that linker relaxation could cause trouble.
Therefore, I don't think "matching RISC-V" is a sufficient justification to enable relaxation by default on LoongArch. We need more and without that we should hold off on this patch.

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


More information about the cfe-commits mailing list