Hi ALL: there is a bug in binutils2.26 of GAS, when it's ok in binutils2.20, and report an error in binutils2.26. the case is assamble code embedded, mips32r2 and the core is mips 34kc. assamble code:do { __asm__ __volatile__( "%(mttc0\t %z0,$" "25" "," "1" "; ehb%)" : : "dJ" (0)); } while (0); then gcc will compile the assamble code into " mttc0 $0,$25,1; " when I use gas 2.26 to assamble the .s file , it report error below, but it's ok for gas 2.20 Error: opcode not supported on this processor: mips32r2 (mips32r2) `mttc0 $0,$25,1' case below: 2.s: test: mttc0 $0,$25,1; mftc0 $2,$25,0; as2.20 -G 0 -G 0 -EB -mips32r2 -mno-dsp -O2 -g -no-mdebug -mabi=32 -march=34kc --trap -o 2.o 2.s -- ok as2.26 -G 0 -G 0 -EB -mips32r2 -mno-dsp -O2 -g -no-mdebug -mabi=32 -march=34kc --trap -o 2.o 2.s -- error 2.s: Assembler messages: 2.s:3: Error: opcode not supported on this processor: mips32r2 (mips32r2) `mttc0 $0,$25,1' 2.s:4: Error: opcode not supported on this processor: mips32r2 (mips32r2) `mftc0 $2,$25,0'
Created attachment 9881 [details] proposed fix I have seen this before (and forgotten it without reporting a bug!). I believe the origin of this is actually with the new .module directive support that I added quite a long time ago. The default enabled ASEs for any given architecture are lost before they can be applied. Proposed patch is attached.
The following commit on master resolves this: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3315614d19a7fb409227298ead9b356bdbcca3bc commit 3315614d19a7fb409227298ead9b356bdbcca3bc Author: Matthew Fortune <matthew.fortune@mips.com> Date: Tue Apr 9 10:34:48 2019 -0700 [MIPS] Apply ASE information for the selected processor GAS does not enable implicit ASEs for most MIPS processors. The rework of option handling done as part of .module implementation left the implicit ASE logic broken and default enabled ASEs for most processors did not get applied. This patch ensures the ASE information is carried forward to the point where it is required. gas/ * config/tc-mips.c (mips_set_options) <init_ase>: New field. (file_mips_opts, mips_opts) <init_ase>: Initialize new field. (file_mips_check_options): Propagate initial ASE settings. (mips_after_parse_args, parse_code_option): Track the initial ASE settings for a CPU. (s_mipsset): Restore the initial ASE settings when reverting to the default arch. * testsuite/gas/mips/elf_mach_p6600.d: New test. * testsuite/gas/mips/mips.exp: Run the new test.