[PATCH v2] [MIPS]: add .module mipsREV to all output asm file

YunQiang Su yunqiang.su@cipunited.com
Fri Aug 27 05:11:22 GMT 2021


在 2021/6/18 11:29, YunQiang Su 写道:
> Currently, the asm output file for MIPS has no rev info.
> It can make some trouble, for example:
>    assembler is mips1 by default,
>    gcc is fpxx by default.
> To assemble the output of gcc -S, we have to pass -mips2
> to assembler.
> 
> gcc/ChangeLog:
> 
>      * gcc/config/mips/mips.c (mips_module_isa_name): New.
>          mips_file_start: add .module mipsREV to all asm output

ping for this patch.

> ---
>   gcc/config/mips/mips.c | 37 +++++++++++++++++++++++++++++++++++++
>   1 file changed, 37 insertions(+)
> 
> diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
> index 1f1475cf400..51cc70e6ceb 100644
> --- a/gcc/config/mips/mips.c
> +++ b/gcc/config/mips/mips.c
> @@ -9877,6 +9877,40 @@ mips_mdebug_abi_name (void)
>       }
>   }
>   
> +static const char *
> +mips_module_isa_name()
> +{
> +  if (ISA_MIPS1)
> +    return "mips1";
> +  else if (ISA_MIPS2)
> +    return "mips2";
> +  else if (ISA_MIPS3)
> +    return "mips3";
> +  else if (ISA_MIPS4)
> +    return "mips4";
> +  else if (ISA_MIPS32)
> +    return "mips32";
> +  else if (ISA_MIPS32R2)
> +    return "mips32r2";
> +  else if (ISA_MIPS32R3)
> +    return "mips32r3";
> +  else if (ISA_MIPS32R5)
> +    return "mips32r5";
> +  else if (ISA_MIPS32R6)
> +    return "mips32r6";
> +  else if (ISA_MIPS64)
> +    return "mips64";
> +  else if (ISA_MIPS64R2)
> +    return "mips64r2";
> +  else if (ISA_MIPS64R3)
> +    return "mips64r3";
> +  else if (ISA_MIPS64R5)
> +    return "mips64r5";
> +  else if (ISA_MIPS64R6)
> +    return "mips64r6";
> +  gcc_unreachable ();
> +}
> +
>   /* Implement TARGET_ASM_FILE_START.  */
>   
>   static void
> @@ -9908,6 +9942,9 @@ mips_file_start (void)
>       fprintf (asm_out_file, "\t.nan\t%s\n",
>   	     mips_nan == MIPS_IEEE_754_2008 ? "2008" : "legacy");
>   
> +  fprintf (asm_out_file, "\t.module\t%s\n",
> +	   mips_module_isa_name ());
> +
>   #ifdef HAVE_AS_DOT_MODULE
>     /* Record the FP ABI.  See below for comments.  */
>     if (TARGET_NO_FLOAT)
> 



More information about the Gcc-patches mailing list