[lld] [lld][LoongArch] Print error when encountering R_LARCH_ALIGN (PR #67424)

Xi Ruoyao via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 02:56:02 PDT 2023


xry111 wrote:

> There are certainly places where alignment directives are mandatory, but I feel that reporting an error would make lld not usable for many many benign cases. Consider the scenario that if your crt1.o or crtbeginS.o have R_LARCH_ALIGN.
> 
> This interop is exactly why I warned in [loongson/LoongArch-Documentation#77](https://github.com/loongson/LoongArch-Documentation/pull/77) . At the very least, binutils should not enable `-mrelax` by default. Reporting the error is now no better than relaxing R_LARCH_ALIGN.

It is better because detecting the issue at link time is better than producing a subtly buggy link unit which will blow up at runtime.

Meanwhile I think (1) we should make lld support R_LARCH_ALIGN (even if we still ignore R_LARCH_RELAX); (2) in Glibc & GCC we can disable relax for crt*.o and lib*_nonshared.a.

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


More information about the llvm-commits mailing list