[PATCH v2] LoongArch: Set the default ABI for the loongarch*-elf target

WANG Xuerui i.swmail@xen0n.name
Fri Dec 12 07:23:57 GMT 2025


On 12/12/25 11:28, Lulu Cai wrote:
> The ABI setting for the elf target was ommitted in commit "db614f37cab".
> Set the default ABI for elf to support the loongarch*-elf.
It could be *very* beneficial for readers to include **exactly which 
ABI** was set as the default, in the title and commit message...
>
> In addition, test case failures caused by the loongarch*-elf linker not
> supporting relevant options have also been fixed.
nit: skipped, not fixed ;-)
>
> gas/
>
>          * config/tc-loongarch.c (loongarch_after_parse_args): Set
> 	  default ABI for others.
>
> ld/
>
>          * testsuite/ld-loongarch-elf/la32.d: Skip tests when not
> 	  supported.
>          * testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Likewise.
>          * testsuite/ld-loongarch-elf/relax.exp: Likewise.
>
> ---
> Changes from v1:
>    - Skip more unsupported tests.
>
> v1: https://sourceware.org/pipermail/binutils/2025-December/146428.html
> ---
>   gas/config/tc-loongarch.c                     |   3 +-
>   ld/testsuite/ld-loongarch-elf/la32.d          |   1 +
>   .../ld-loongarch-elf/ld-loongarch-elf.exp     |  26 ++--
>   ld/testsuite/ld-loongarch-elf/relax.exp       | 136 +++++++++---------
>   4 files changed, 89 insertions(+), 77 deletions(-)
>
> diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
> index e049427956c..5f7d3a3522c 100644
> --- a/gas/config/tc-loongarch.c
> +++ b/gas/config/tc-loongarch.c
> @@ -314,7 +314,8 @@ loongarch_after_parse_args ()
>         else if (strcmp (TARGET_OS, "linux-gnu") == 0)
>   	LARCH_opts.ase_abi = EF_LOONGARCH_ABI_DOUBLE_FLOAT;
>         else
> -	as_fatal (_("unsupport TARGET_OS %s"), TARGET_OS);
> +	/* To support lonngarch*-elf, the ABI needs to be set.  */
> +	LARCH_opts.ase_abi = EF_LOONGARCH_ABI_DOUBLE_FLOAT;

Just "to support loongarch*-elf targets" would be enough, because one 
doesn't describe "what was done" in comments, rather "why" and "how". 
The code should be self-explanatory otherwise.

So the default is apparently the ILP32D or LP64D i.e. double-float ABI, 
better put it in the title and commit message as "default to the 
double-float ABI" so people wouldn't have to read up to here to figure 
it out...



More information about the Binutils mailing list