[PATCH] LoongArch: adjust the default of -mexplicit-relocs by checking gas feature

Lulu Cheng chenglulu@loongson.cn
Wed Jul 27 01:34:21 GMT 2022


在 2022/7/26 下午10:15, Xi Ruoyao 写道:
>
> The following should work.  I've tested it locally by building GCC with
> both old (2.38 with patch) and new (trunk) Binutils. Ok for trunk?
>
> I simply checked as instead of ld.  If as supports explicitly
> relocations, the produced .o file won't be supported by an old ld even
> if we use -mno-explicit-relocs (because as will generate new relocation
> types for la.local etc).  So such a mismatch between as and ld can be
> considered "completely broken" and we don't need to support it.  And,
> the Alpha port also check the assembler for the default of -mexplicit-
> relocs.
>
> This should be documented in invoke.texi, but currently it does not
> mention -mexplicit-relocs for LoongArch at all.  So I'll submit the
> doclater in another patch.
>
> -- >8 --
>
> The assembly produced with -mexplicit-relocs is not supported by gas <=
> 2.39.  Check if the assembler supports explicit relocations and set the
> default accordingly.
Looks good to me.



More information about the Gcc-patches mailing list