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. The same situation is for some CPU has extension insn. Octeon is an example. So we can just add ".set arch=octeon". If an ASE is enabled, .module ase will also be used. --- 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 493d3de48..ade5d7041 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9896,6 +9896,43 @@ mips_file_start (void) else fputs ("\t.module\tnooddspreg\n", asm_out_file); + fprintf (asm_out_file, "\t.module\tarch=%s\n", mips_arch_info->name); + /* FIXME: DSPR3 is not supported by GCC? gas does support it */ + if (TARGET_DSPR2) + fputs ("\t.module\tdspr2\n", asm_out_file); + else if (TARGET_DSP) + fputs ("\t.module\tdsp\n", asm_out_file); + if (TARGET_EVA) + fputs ("\t.module\teva\n", asm_out_file); + if (TARGET_MCU) + fputs ("\t.module\tmcu\n", asm_out_file); + if (TARGET_MDMX) + fputs ("\t.module\tmdmx\n", asm_out_file); + if (TARGET_MIPS3D) + fputs ("\t.module\tmips3d\n", asm_out_file); + if (TARGET_MT) + fputs ("\t.module\tmt\n", asm_out_file); + if (TARGET_SMARTMIPS) + fputs ("\t.module\tsmartmips\n", asm_out_file); + if (TARGET_VIRT) + fputs ("\t.module\tvirt\n", asm_out_file); + if (TARGET_MSA) + fputs ("\t.module\tmsa\n", asm_out_file); + if (TARGET_XPA) + fputs ("\t.module\txpa\n", asm_out_file); + /* FIXME: MIPS16E2 is not supported by GCC? gas does support it */ + if (TARGET_CRC) + fputs ("\t.module\tcrc\n", asm_out_file); + if (TARGET_GINV) + fputs ("\t.module\tginv\n", asm_out_file); + if (TARGET_LOONGSON_MMI) + fputs ("\t.module\tloongson-mmi\n", asm_out_file); + /* FIXME: LOONGSON-CAM is not supported by GCC? gas does support it */ + if (TARGET_LOONGSON_EXT2) + fputs ("\t.module\tloongson-ext2\n", asm_out_file); + else if (TARGET_LOONGSON_EXT) + fputs ("\t.module\tloongson-ext\n", asm_out_file); + #else #ifdef HAVE_AS_GNU_ATTRIBUTE { -- 2.30.2