x86: replace Reg8, Reg16, Reg32, and Reg64
[deliverable/binutils-gdb.git] / gas / config / tc-mips.c
index d06143a1f94d879e424857c8167571bed916cc05..040a373adbc71cb5c72778333dd49af12295d76d 100644 (file)
@@ -1762,7 +1762,7 @@ static const struct mips_ase mips_ases[] = {
 
   { "xpa", ASE_XPA, 0,
     OPTION_XPA, OPTION_NO_XPA,
-     2,  2, -1, -1,
+    2, 2, 2, 2,
     -1 },
 
   { "mips16e2", ASE_MIPS16E2, 0,
@@ -2133,11 +2133,19 @@ mips_set_ase (const struct mips_ase *ase, struct mips_set_options *opts,
 
   /* Clear combination ASE flags, which need to be recalculated based on
      updated regular ASE settings.  */
-  opts->ase &= ~ASE_MIPS16E2_MT;
+  opts->ase &= ~(ASE_MIPS16E2_MT | ASE_XPA_VIRT);
 
   if (enabled_p)
     opts->ase |= ase->flags;
 
+  /* The Virtualization ASE has eXtended Physical Addressing (XPA)
+     instructions which are only valid when both ASEs are enabled.
+     This sets the ASE_XPA_VIRT flag when both ASEs are present.  */
+  if ((opts->ase & (ASE_XPA | ASE_VIRT)) == (ASE_XPA | ASE_VIRT))
+    {
+      opts->ase |= ASE_XPA_VIRT;
+      mask |= ASE_XPA_VIRT;
+    }
   if ((opts->ase & (ASE_MIPS16E2 | ASE_MT)) == (ASE_MIPS16E2 | ASE_MT))
     {
       opts->ase |= ASE_MIPS16E2_MT;
@@ -4889,7 +4897,7 @@ match_expression (struct mips_arg_info *arg, expressionS *value,
 }
 
 /* Try to get a constant expression from the next tokens in ARG.  Consume
-   the tokens and return return true on success, storing the constant value
+   the tokens and return true on success, storing the constant value
    in *VALUE.  */
 
 static bfd_boolean
@@ -5929,9 +5937,9 @@ match_tied_reg_operand (struct mips_arg_info *arg, unsigned int other_regno)
   return match_reg (arg, OP_REG_GP, &regno) && regno == other_regno;
 }
 
-/* Read a floating-point constant from S for LI.S or LI.D.  LENGTH is
-   the length of the value in bytes (4 for float, 8 for double) and
-   USING_GPRS says whether the destination is a GPR rather than an FPR.
+/* Try to match a floating-point constant from ARG for LI.S or LI.D.
+   LENGTH is the length of the value in bytes (4 for float, 8 for double)
+   and USING_GPRS says whether the destination is a GPR rather than an FPR.
 
    Return the constant in IMM and OFFSET as follows:
 
@@ -6125,8 +6133,8 @@ match_vu0_suffix_operand (struct mips_arg_info *arg,
   return TRUE;
 }
 
-/* S is the text seen for ARG.  Match it against OPERAND.  Return the end
-   of the argument text if the match is successful, otherwise return null.  */
+/* Try to match a token from ARG against OPERAND.  Consume the token
+   and return true on success, otherwise return false.  */
 
 static bfd_boolean
 match_operand (struct mips_arg_info *arg,
@@ -15306,7 +15314,7 @@ fix_bad_misaligned_jump_p (fixS *fixP, int shift)
    We accept BFD_RELOC_16_PCREL_S2 relocations against MIPS16 and microMIPS
    symbols or BFD_RELOC_MICROMIPS_16_PCREL_S1 relocations against regular
    MIPS symbols and associated with BAL instructions as these instructions
-   may be be converted to JALX by the linker.  */
+   may be converted to JALX by the linker.  */
 
 static bfd_boolean
 fix_bad_cross_mode_branch_p (fixS *fixP)
@@ -17141,6 +17149,7 @@ s_nan (int ignore ATTRIBUTE_UNUSED)
 static void
 s_mips_stab (int type)
 {
+  file_mips_check_options ();
   mips_mark_labels ();
   s_stab (type);
 }
@@ -18127,7 +18136,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
     {
       char *buf;
       unsigned long insn;
-      expressionS exp;
       fixS *fixp;
 
       buf = fragp->fr_literal + fragp->fr_fix;
@@ -18138,12 +18146,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          /* We generate a fixup instead of applying it right now
             because, if there are linker relaxations, we're going to
             need the relocations.  */
-         exp.X_op = O_symbol;
-         exp.X_add_symbol = fragp->fr_symbol;
-         exp.X_add_number = fragp->fr_offset;
-
-         fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, TRUE,
-                             BFD_RELOC_16_PCREL_S2);
+         fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                         fragp->fr_symbol, fragp->fr_offset,
+                         TRUE, BFD_RELOC_16_PCREL_S2);
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;
 
@@ -18259,12 +18264,10 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
              /* j or jal.  */
              insn = (RELAX_BRANCH_LINK (fragp->fr_subtype)
                      ? 0x0c000000 : 0x08000000);
-             exp.X_op = O_symbol;
-             exp.X_add_symbol = fragp->fr_symbol;
-             exp.X_add_number = fragp->fr_offset;
 
-             fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp,
-                                 FALSE, BFD_RELOC_MIPS_JMP);
+             fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                             fragp->fr_symbol, fragp->fr_offset,
+                             FALSE, BFD_RELOC_MIPS_JMP);
              fixp->fx_file = fragp->fr_file;
              fixp->fx_line = fragp->fr_line;
 
@@ -18277,18 +18280,10 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
              /* lw/ld $at, <sym>($gp)  R_MIPS_GOT16 */
              insn = HAVE_64BIT_ADDRESSES ? 0xdf800000 : 0x8f800000;
              insn |= at << OP_SH_RT;
-             exp.X_op = O_symbol;
-             exp.X_add_symbol = fragp->fr_symbol;
-             exp.X_add_number = fragp->fr_offset;
 
-             if (fragp->fr_offset)
-               {
-                 exp.X_add_symbol = make_expr_symbol (&exp);
-                 exp.X_add_number = 0;
-               }
-
-             fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp,
-                                 FALSE, BFD_RELOC_MIPS_GOT16);
+             fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                             fragp->fr_symbol, fragp->fr_offset,
+                             FALSE, BFD_RELOC_MIPS_GOT16);
              fixp->fx_file = fragp->fr_file;
              fixp->fx_line = fragp->fr_line;
 
@@ -18302,8 +18297,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
              insn = HAVE_64BIT_ADDRESSES ? 0x64000000 : 0x24000000;
              insn |= at << OP_SH_RS | at << OP_SH_RT;
 
-             fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp,
-                                 FALSE, BFD_RELOC_LO16);
+             fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                             fragp->fr_symbol, fragp->fr_offset,
+                             FALSE, BFD_RELOC_LO16);
              fixp->fx_file = fragp->fr_file;
              fixp->fx_line = fragp->fr_line;
 
@@ -18337,13 +18333,8 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
       int type = RELAX_MICROMIPS_TYPE (fragp->fr_subtype);
       bfd_boolean short_ds;
       unsigned long insn;
-      expressionS exp;
       fixS *fixp;
 
-      exp.X_op = O_symbol;
-      exp.X_add_symbol = fragp->fr_symbol;
-      exp.X_add_number = fragp->fr_offset;
-
       fragp->fr_fix += fragp->fr_var;
 
       /* Handle 16-bit branches that fit or are forced to fit.  */
@@ -18352,14 +18343,21 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          /* We generate a fixup instead of applying it right now,
             because if there is linker relaxation, we're going to
             need the relocations.  */
-         if (type == 'D')
-           fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 2, &exp, TRUE,
-                               BFD_RELOC_MICROMIPS_10_PCREL_S1);
-         else if (type == 'E')
-           fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 2, &exp, TRUE,
-                               BFD_RELOC_MICROMIPS_7_PCREL_S1);
-         else
-           abort ();
+         switch (type)
+           {
+           case 'D':
+             fixp = fix_new (fragp, buf - fragp->fr_literal, 2,
+                             fragp->fr_symbol, fragp->fr_offset,
+                             TRUE, BFD_RELOC_MICROMIPS_10_PCREL_S1);
+             break;
+           case 'E':
+             fixp = fix_new (fragp, buf - fragp->fr_literal, 2,
+                             fragp->fr_symbol, fragp->fr_offset,
+                             TRUE, BFD_RELOC_MICROMIPS_7_PCREL_S1);
+             break;
+           default:
+             abort ();
+           }
 
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;
@@ -18378,8 +18376,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          /* We generate a fixup instead of applying it right now,
             because if there is linker relaxation, we're going to
             need the relocations.  */
-         fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, TRUE,
-                             BFD_RELOC_MICROMIPS_16_PCREL_S1);
+         fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                         fragp->fr_symbol, fragp->fr_offset,
+                         TRUE, BFD_RELOC_MICROMIPS_16_PCREL_S1);
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;
 
@@ -18516,8 +18515,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          /* j/jal/jals <sym>  R_MICROMIPS_26_S1  */
          insn = al ? jal : 0xd4000000;
 
-         fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, FALSE,
-                             BFD_RELOC_MICROMIPS_JMP);
+         fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                         fragp->fr_symbol, fragp->fr_offset,
+                         FALSE, BFD_RELOC_MICROMIPS_JMP);
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;
 
@@ -18540,14 +18540,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          insn = HAVE_64BIT_ADDRESSES ? 0xdc1c0000 : 0xfc1c0000;
          insn |= at << MICROMIPSOP_SH_RT;
 
-         if (exp.X_add_number)
-           {
-             exp.X_add_symbol = make_expr_symbol (&exp);
-             exp.X_add_number = 0;
-           }
-
-         fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, FALSE,
-                             BFD_RELOC_MICROMIPS_GOT16);
+         fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                         fragp->fr_symbol, fragp->fr_offset,
+                         FALSE, BFD_RELOC_MICROMIPS_GOT16);
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;
 
@@ -18557,8 +18552,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          insn = HAVE_64BIT_ADDRESSES ? 0x5c000000 : 0x30000000;
          insn |= at << MICROMIPSOP_SH_RT | at << MICROMIPSOP_SH_RS;
 
-         fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp, FALSE,
-                             BFD_RELOC_MICROMIPS_LO16);
+         fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                         fragp->fr_symbol, fragp->fr_offset,
+                         FALSE, BFD_RELOC_MICROMIPS_LO16);
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;
 
@@ -18635,7 +18631,8 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
 
          if (pcrel_op->include_isa_bit && !need_reloc)
            {
-             if (!ELF_ST_IS_MIPS16 (S_GET_OTHER (fragp->fr_symbol)))
+             if (!mips_ignore_branch_isa
+                 && !ELF_ST_IS_MIPS16 (S_GET_OTHER (fragp->fr_symbol)))
                as_bad_where (fragp->fr_file, fragp->fr_line,
                              _("branch to a symbol in another ISA mode"));
              else if ((fragp->fr_offset & 0x1) != 0)
@@ -18762,7 +18759,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          if (need_reloc)
            {
              bfd_reloc_code_real_type reloc = BFD_RELOC_NONE;
-             expressionS exp;
              fixS *fixp;
 
              switch (type)
@@ -18779,13 +18775,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
                              _("unsupported relocation"));
              else if (ext)
                {
-                 exp.X_op = O_symbol;
-                 exp.X_add_symbol = fragp->fr_symbol;
-                 exp.X_add_number = fragp->fr_offset;
-
-                 fixp = fix_new_exp (fragp, buf - fragp->fr_literal, 4, &exp,
-                                     TRUE, reloc);
-
+                 fixp = fix_new (fragp, buf - fragp->fr_literal, 4,
+                                 fragp->fr_symbol, fragp->fr_offset,
+                                 TRUE, reloc);
                  fixp->fx_file = fragp->fr_file;
                  fixp->fx_line = fragp->fr_line;
                }
@@ -19148,10 +19140,8 @@ mips_elf_final_processing (void)
       else
        elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_EABI32;
     }
-  else if (mips_abi == N32_ABI)
-    elf_elfheader (stdoutput)->e_flags |= EF_MIPS_ABI2;
 
-  /* Nothing to do for N64_ABI.  */
+  /* Nothing to do for N32_ABI or N64_ABI.  */
 
   if (mips_32bitmode)
     elf_elfheader (stdoutput)->e_flags |= EF_MIPS_32BITMODE;
This page took 0.032797 seconds and 4 git commands to generate.