* elf32-mips.c (elf_mips_howto_table_rel): Change definition of
authorThiemo Seufer <ths@networkno.de>
Sun, 2 Mar 2003 21:30:15 +0000 (21:30 +0000)
committerThiemo Seufer <ths@networkno.de>
Sun, 2 Mar 2003 21:30:15 +0000 (21:30 +0000)
R_MIPS_PC16 to rightshift 2.
(elf_reloc_map mips_reloc_map): Map to rightshifted BFD reloc.
(bfd_elf32_bfd_reloc_type_lookup): Support
BFD_RELOC_MIPSEMB_16_PCREL_S2.
* elf64-mips.c (mips_elf64_howto_table_rel): Change definition of
R_MIPS_PC16 to rightshift 2.
(mips_elf64_howto_table_rela): Likewise.
(mips_reloc_map): Map to rightshifted BFD reloc.
* elfn32-mips.c: The same as in elf64-mips.c.
* elfxx-mips.c (mips_elf_got_for_ibfd): Typo in comment.
(mips_elf_calculate_relocation): Handle rightshifted addends for
R_MIPS_PC16.
* reloc.c (BFD_RELOC_MIPSEMB_16_PCREL_S2): New BFD relocation for
MIPS Embedded PIC. Remove superfluous empty COMMENT.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
* config/tc-mips.c (append_insn): Add handling of
BFD_RELOC_MIPSEMB_16_PCREL_S2. Avoid emitting unneeded
BFD_RELOC_16_PCREL_S2 relocs and add earlier warnings about
misaligned address and reange overflow.
(macro_build): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2. Add
earlier warnings about misaligned address and reange overflow.
(mips_ip): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2.
(md_apply_fix): Likewise. Fix warning output.
(tc_gen_reloc): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2.
Allow BFD_RELOC_16_PCREL_S2 for all ABIs.
(md_convert_frag): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2.
* gas/mips/bge.d: Reactivate external branch tests.
* gas/mips/bge.s: Likewise.
* gas/mips/bgeu.d: Likewise.
* gas/mips/bgeu.s: Likewise.
* gas/mips/blt.d: Likewise.
* gas/mips/blt.s: Likewise.
* gas/mips/bltu.d: Likewise.
* gas/mips/bltu.s: Likewise.
* gas/mips/branch-misc-2.d: New File.
* gas/mips/branch-misc-2.l: Remove.
* gas/mips/mips.exp: Adjust branch-misc-2 test.

21 files changed:
bfd/ChangeLog
bfd/bfd-in2.h
bfd/elf32-mips.c
bfd/elf64-mips.c
bfd/elfn32-mips.c
bfd/elfxx-mips.c
bfd/libbfd.h
bfd/reloc.c
gas/ChangeLog
gas/config/tc-mips.c
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/bge.d
gas/testsuite/gas/mips/bge.s
gas/testsuite/gas/mips/bgeu.d
gas/testsuite/gas/mips/bgeu.s
gas/testsuite/gas/mips/blt.d
gas/testsuite/gas/mips/blt.s
gas/testsuite/gas/mips/bltu.d
gas/testsuite/gas/mips/bltu.s
gas/testsuite/gas/mips/branch-misc-2.d [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp

index 869d5c56b3d3b4ed305c9860ed7de823ffee9a37..17123869e500645701aa2cdbea7c3df9c729af0b 100644 (file)
@@ -1,3 +1,23 @@
+2003-03-02  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+       * elf32-mips.c (elf_mips_howto_table_rel): Change definition of
+       R_MIPS_PC16 to rightshift 2.
+       (elf_reloc_map mips_reloc_map): Map to rightshifted BFD reloc.
+       (bfd_elf32_bfd_reloc_type_lookup): Support
+       BFD_RELOC_MIPSEMB_16_PCREL_S2.
+       * elf64-mips.c (mips_elf64_howto_table_rel): Change definition of
+       R_MIPS_PC16 to rightshift 2.
+       (mips_elf64_howto_table_rela): Likewise.
+       (mips_reloc_map): Map to rightshifted BFD reloc.
+       * elfn32-mips.c: The same as in elf64-mips.c.
+       * elfxx-mips.c (mips_elf_got_for_ibfd): Typo in comment.
+       (mips_elf_calculate_relocation): Handle rightshifted addends for
+       R_MIPS_PC16.
+       * reloc.c (BFD_RELOC_MIPSEMB_16_PCREL_S2): New BFD relocation for
+       MIPS Embedded PIC. Remove superfluous empty COMMENT.
+       * libbfd.h: Regenerate.
+       * bfd-in2.h: Regenerate.
+
 2003-02-28  Richard Henderson  <rth@redhat.com>
 
        * elfxx-ia64.c (elfNN_ia64_relax_section): Correct bounds
index 2385c409a5cd38b16ba0e8bf0bde441c9e892d3f..9540eeb26a285b607074c6e8039049bf97d5831d 100644 (file)
@@ -2331,6 +2331,9 @@ to compensate for the borrow when the low bits are added.  */
 /* Like BFD_RELOC_LO16, but PC relative.  */
   BFD_RELOC_PCREL_LO16,
 
+/* Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC.  */
+  BFD_RELOC_MIPSEMB_16_PCREL_S2,
+
 /* Relocation against a MIPS literal section.  */
   BFD_RELOC_MIPS_LITERAL,
 
index 1399f0031287e52d0d722c21b7b1af68be67b3f2..cf705d502f04db1ce490c568a78fb997e526d49a 100644 (file)
@@ -261,9 +261,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -1401,7 +1403,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
   { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
   { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
-  { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+  { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
   { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
   { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
@@ -1458,7 +1460,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
       return &elf_mips_gnu_rel_hi16;
     case BFD_RELOC_PCREL_LO16:
       return &elf_mips_gnu_rel_lo16;
-    case BFD_RELOC_16_PCREL_S2:
+    case BFD_RELOC_MIPSEMB_16_PCREL_S2:
       return &elf_mips_gnu_rel16_s2;
     case BFD_RELOC_64_PCREL:
       return &elf_mips_gnu_pcrel64;
index d29f2862ea673be1429a54696225787823860563..807ddf5f22fd7997bb62f179fa4a7764c5d18ac1 100644 (file)
@@ -300,9 +300,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -795,9 +797,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -1894,7 +1898,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
   /* There is no BFD reloc for R_MIPS_REL32.  */
   { BFD_RELOC_64, R_MIPS_64 },
   { BFD_RELOC_CTOR, R_MIPS_64 },
-  { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+  { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   { BFD_RELOC_HI16_S, R_MIPS_HI16 },
   { BFD_RELOC_LO16, R_MIPS_LO16 },
   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
index 00a0e88c1cead9bb0cee73fa7296cec326019a0c..b2d745bdfbc308b01a956636a28793ce74f57449 100644 (file)
@@ -275,9 +275,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -772,9 +774,11 @@ static reloc_howto_type elf_mips_howto_table_rela[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -1837,7 +1841,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
   /* There is no BFD reloc for R_MIPS_REL32.  */
   { BFD_RELOC_CTOR, R_MIPS_32 },
   { BFD_RELOC_64, R_MIPS_64 },
-  { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+  { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   { BFD_RELOC_HI16_S, R_MIPS_HI16 },
   { BFD_RELOC_LO16, R_MIPS_LO16 },
   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
index 2295fa8b17cd402a588757b280eed927c19da92c..6ca4f063af2bb28cce062e6669175be023ac439b 100644 (file)
@@ -496,7 +496,6 @@ static struct mips_got_info *mips_elf_got_for_ibfd
 static bfd *reldyn_sorting_bfd;
 
 /* Nonzero if ABFD is using the N32 ABI.  */
-
 #define ABI_N32_P(abfd) \
   ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
 
@@ -2130,7 +2129,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2)
   return e1->bfd == e2->bfd;
 }
 
-/* In a multi-got link, determine the GOT to be used for IBDF.  G must
+/* In a multi-got link, determine the GOT to be used for IBFD.  G must
    be the master GOT data.  */
 
 static struct mips_got_info *
@@ -3316,12 +3315,6 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
       value &= howto->dst_mask;
       break;
 
-    case R_MIPS_GNU_REL16_S2:
-      value = symbol + mips_elf_sign_extend (addend << 2, 18) - p;
-      overflowed_p = mips_elf_overflow_p (value, 18);
-      value = (value >> 2) & howto->dst_mask;
-      break;
-
     case R_MIPS_GNU_REL_HI16:
       /* Instead of subtracting 'p' here, we should be subtracting the
         equivalent value for the LO part of the reloc, since the value
@@ -3450,8 +3443,10 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
       break;
 
     case R_MIPS_PC16:
-      value = mips_elf_sign_extend (addend, 16) + symbol - p;
-      overflowed_p = mips_elf_overflow_p (value, 16);
+    case R_MIPS_GNU_REL16_S2:
+      value = mips_elf_sign_extend (addend << 2, 18) + symbol - p;
+      overflowed_p = mips_elf_overflow_p (value, 18);
+      value = (value >> 2) & howto->dst_mask;
       break;
 
     case R_MIPS_GOT_HI16:
index 222b23dcb5dfe15bc974ca6cba5496de2e1ab331..14978ba862fe4e1f08ed65ca4e54c2fefbecf53f 100644 (file)
@@ -850,6 +850,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_LO16",
   "BFD_RELOC_PCREL_HI16_S",
   "BFD_RELOC_PCREL_LO16",
+  "BFD_RELOC_MIPSEMB_16_PCREL_S2",
   "BFD_RELOC_MIPS_LITERAL",
   "BFD_RELOC_MIPS_GOT16",
   "BFD_RELOC_MIPS_CALL16",
index 9f8a952c591f1f2d2dfbea13bb3c2b70e16a967e..45660c8387e425667e8b80605ef203632e33508a 100644 (file)
@@ -2080,7 +2080,10 @@ ENUM
   BFD_RELOC_PCREL_LO16
 ENUMDOC
   Like BFD_RELOC_LO16, but PC relative.
-
+ENUM
+  BFD_RELOC_MIPSEMB_16_PCREL_S2
+ENUMDOC
+  Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC.
 ENUM
   BFD_RELOC_MIPS_LITERAL
 ENUMDOC
@@ -2150,7 +2153,6 @@ ENUMX
 ENUMDOC
   Fujitsu Frv Relocations.
 COMMENT
-COMMENT
 ENUMDOC
   MIPS ELF relocations.
 
index f9fc360051cc80f3b8c46452088ee3039a1be47e..dc46fb38dbf13e1b263b40046a9a9afe409dde80 100644 (file)
@@ -1,3 +1,17 @@
+2003-03-02  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+       * config/tc-mips.c (append_insn): Add handling of
+       BFD_RELOC_MIPSEMB_16_PCREL_S2. Avoid emitting unneeded
+       BFD_RELOC_16_PCREL_S2 relocs and add earlier warnings about
+       misaligned address and reange overflow.
+       (macro_build): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2. Add
+       earlier warnings about misaligned address and reange overflow.
+       (mips_ip): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2.
+       (md_apply_fix): Likewise. Fix warning output.
+       (tc_gen_reloc): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2.
+       Allow BFD_RELOC_16_PCREL_S2 for all ABIs.
+       (md_convert_frag): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2.
+
 2003-02-21  Nick Clifton  <nickc@redhat.com>
 
        * NEWS: Mention availability of test generator program.
index e075cc9cf553afcac2c5a76e1164a3936b854524..c71d3308ca84aaaa8e4913ec912bc0e632f2baed 100644 (file)
@@ -2018,7 +2018,8 @@ append_insn (place, ip, address_expr, reloc_type)
 
   if (place == NULL
       && address_expr
-      && *reloc_type == BFD_RELOC_16_PCREL_S2
+      && (*reloc_type == BFD_RELOC_16_PCREL_S2
+         || *reloc_type == BFD_RELOC_MIPSEMB_16_PCREL_S2)
       && (pinfo & INSN_UNCOND_BRANCH_DELAY || pinfo & INSN_COND_BRANCH_DELAY
          || pinfo & INSN_COND_BRANCH_LIKELY)
       && mips_relax_branch
@@ -2140,6 +2141,18 @@ append_insn (place, ip, address_expr, reloc_type)
              break;
 
            case BFD_RELOC_16_PCREL_S2:
+             if ((address_expr->X_add_number & 3) != 0)
+               as_bad (_("branch to misaligned address (0x%lx)"),
+                       (unsigned long) address_expr->X_add_number);
+             if (mips_relax_branch)
+               goto need_reloc;
+             if ((address_expr->X_add_number + 0x20000) & ~0x3ffff)
+               as_bad (_("branch address range overflow (0x%lx)"),
+                       (unsigned long) address_expr->X_add_number);
+             ip->insn_opcode |= (address_expr->X_add_number >> 2) & 0xffff;
+             break;
+
+           case BFD_RELOC_MIPSEMB_16_PCREL_S2:
              goto need_reloc;
 
            default:
@@ -2154,7 +2167,8 @@ append_insn (place, ip, address_expr, reloc_type)
            {
              fixp[0] = fix_new_exp (frag_now, f - frag_now->fr_literal, 4,
                                     address_expr,
-                                    *reloc_type == BFD_RELOC_16_PCREL_S2,
+                                    (*reloc_type == BFD_RELOC_16_PCREL_S2
+                                     || *reloc_type == BFD_RELOC_MIPSEMB_16_PCREL_S2),
                                     reloc_type[0]);
 
              /* These relocations can have an addend that won't fit in
@@ -3104,20 +3118,32 @@ macro_build (place, counter, ep, name, fmt, va_alist)
 
        case 'p':
          assert (ep != NULL);
+
          /*
           * This allows macro() to pass an immediate expression for
           * creating short branches without creating a symbol.
-          * Note that the expression still might come from the assembly
-          * input, in which case the value is not checked for range nor
-          * is a relocation entry generated (yuck).
+          *
+          * We don't allow branch relaxation for these branches, as
+          * they should only appear in ".set nomacro" anyway.
           */
          if (ep->X_op == O_constant)
            {
+             if ((ep->X_add_number & 3) != 0)
+               as_bad (_("branch to misaligned address (0x%lx)"),
+                       (unsigned long) ep->X_add_number);
+             if ((ep->X_add_number + 0x20000) & ~0x3ffff)
+               as_bad (_("branch address range overflow (0x%lx)"),
+                       (unsigned long) ep->X_add_number);
              insn.insn_opcode |= (ep->X_add_number >> 2) & 0xffff;
              ep = NULL;
            }
          else
-           *r = BFD_RELOC_16_PCREL_S2;
+           {
+             if (mips_pic == EMBEDDED_PIC)
+               *r = BFD_RELOC_MIPSEMB_16_PCREL_S2;
+             else
+               *r = BFD_RELOC_16_PCREL_S2;
+           }
          continue;
 
        case 'a':
@@ -9154,7 +9180,10 @@ mips_ip (str, ip)
              continue;
 
            case 'p':           /* pc relative offset */
-             *offset_reloc = BFD_RELOC_16_PCREL_S2;
+             if (mips_pic == EMBEDDED_PIC)
+               *offset_reloc = BFD_RELOC_MIPSEMB_16_PCREL_S2;
+             else
+               *offset_reloc = BFD_RELOC_16_PCREL_S2;
              my_getExpression (&offset_expr, s);
              s = expr_end;
              continue;
@@ -11171,7 +11200,8 @@ md_apply_fix3 (fixP, valP, seg)
          /* BFD's REL handling, for MIPS, is _very_ weird.
             This gives the right results, but it can't possibly
             be the way things are supposed to work.  */
-         if (fixP->fx_r_type != BFD_RELOC_16_PCREL_S2
+         if ((fixP->fx_r_type != BFD_RELOC_16_PCREL_S2
+              && fixP->fx_r_type != BFD_RELOC_MIPSEMB_16_PCREL_S2)
              || S_GET_SEGMENT (fixP->fx_addsy) != undefined_section)
            value += fixP->fx_frag->fr_address + fixP->fx_where;
        }
@@ -11341,9 +11371,10 @@ md_apply_fix3 (fixP, valP, seg)
       break;
 
     case BFD_RELOC_16_PCREL_S2:
+    case BFD_RELOC_MIPSEMB_16_PCREL_S2:
       if ((value & 0x3) != 0)
        as_bad_where (fixP->fx_file, fixP->fx_line,
-                     _("Branch to odd address (%lx)"), (long) value);
+                     _("Branch to misaligned address (%lx)"), (long) value);
 
       /*
        * We need to save the bits in the instruction since fixup_segment()
@@ -11356,8 +11387,7 @@ md_apply_fix3 (fixP, valP, seg)
         do the store, so it must be done here.  This is probably
         a bug somewhere.  */
       if (!fixP->fx_done
-         && (fixP->fx_r_type != BFD_RELOC_16_PCREL_S2
-             || fixP->fx_addsy == NULL                 /* ??? */
+         && (fixP->fx_addsy == NULL                    /* ??? */
              || ! S_IS_DEFINED (fixP->fx_addsy)))
        value -= fixP->fx_frag->fr_address + fixP->fx_where;
 
@@ -13351,6 +13381,7 @@ tc_gen_reloc (section, fixp)
        case BFD_RELOC_32_PCREL:
        case BFD_RELOC_64_PCREL:
        case BFD_RELOC_16_PCREL_S2:
+       case BFD_RELOC_MIPSEMB_16_PCREL_S2:
        case BFD_RELOC_PCREL_HI16_S:
        case BFD_RELOC_PCREL_LO16:
          break;
@@ -13374,17 +13405,7 @@ tc_gen_reloc (section, fixp)
     reloc->addend += S_GET_VALUE (fixp->fx_addsy);
 #endif
 
-  /* To support a PC relative reloc when generating embedded PIC code
-     for ECOFF, we use a Cygnus extension.  We check for that here to
-     make sure that we don't let such a reloc escape normally.  */
-  if ((OUTPUT_FLAVOR == bfd_target_ecoff_flavour
-       || OUTPUT_FLAVOR == bfd_target_elf_flavour)
-      && code == BFD_RELOC_16_PCREL_S2
-      && mips_pic != EMBEDDED_PIC)
-    reloc->howto = NULL;
-  else
-    reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
-
+  reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
   if (reloc->howto == NULL)
     {
       as_bad_where (fixp->fx_file, fixp->fx_line,
@@ -13470,8 +13491,9 @@ md_convert_frag (abfd, asec, fragp)
          exp.X_add_number = fragp->fr_offset;
 
          fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal,
-                             4, &exp, 1,
-                             BFD_RELOC_16_PCREL_S2);
+                             4, &exp, 1, ((mips_pic == EMBEDDED_PIC)
+                                          ? BFD_RELOC_MIPSEMB_16_PCREL_S2
+                                          : BFD_RELOC_16_PCREL_S2));
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;
 
index f4d9e736a541d53eea0e4851d8f4ea6a58ccaa64..c3a4788521c6bff1d5440e483431277685eb63dc 100644 (file)
@@ -1,3 +1,17 @@
+2003-03-02  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+       * gas/mips/bge.d: Reactivate external branch tests.
+       * gas/mips/bge.s: Likewise.
+       * gas/mips/bgeu.d: Likewise.
+       * gas/mips/bgeu.s: Likewise.
+       * gas/mips/blt.d: Likewise.
+       * gas/mips/blt.s: Likewise.
+       * gas/mips/bltu.d: Likewise.
+       * gas/mips/bltu.s: Likewise.
+       * gas/mips/branch-misc-2.d: New File.
+       * gas/mips/branch-misc-2.l: Remove.
+       * gas/mips/mips.exp: Adjust branch-misc-2 test.
+
 2003-02-21  Nick Clifton  <nickc@redhat.com>
 
        * gas/all/test-gen.c: New file: Framework for automatically
index 7924c024d2cb2cbdcbaf78b903466332b7c690e7..26952deff8edb7925ae5ce8efebfb46f5ea792ae 100644 (file)
@@ -51,20 +51,20 @@ Disassembly of section .text:
 0+00a8 <[^>]*> slt     at,a1,a0
 0+00ac <[^>]*> bnezl   at,0+0000 <text_label>
 0+00b0 <[^>]*> nop
-#0+00b4 <[^>]*> slt    at,a0,a1
-#0+00b8 <[^>]*> beqz   at,000000b8 <text_label\+0xb8>
-#[     ]*b8: R_MIPS_PC16       external_label
-#0+00bc <[^>]*> nop
-#0+00c0 <[^>]*> slt    at,a1,a0
-#0+00c4 <[^>]*> bnez   at,000000c4 <text_label\+0xc4>
-#[     ]*c4: R_MIPS_PC16       external_label
-#0+00c8 <[^>]*> nop
-#0+00cc <[^>]*> slt    at,a0,a1
-#0+00d0 <[^>]*> beqzl  at,000000d0 <text_label\+0xd0>
-#[     ]*d0: R_MIPS_PC16       external_label
-#0+00d4 <[^>]*> nop
-#0+00d8 <[^>]*> slt    at,a1,a0
-#0+00dc <[^>]*> bnezl  at,000000dc <text_label\+0xdc>
-#[     ]*dc: R_MIPS_PC16       external_label
-#0+00e0 <[^>]*> nop
+0+00b4 <[^>]*> slt     at,a0,a1
+0+00b8 <[^>]*> beqz    at,000000b8 <text_label\+0xb8>
+     ]*b8: R_MIPS_PC16       external_label
+0+00bc <[^>]*> nop
+0+00c0 <[^>]*> slt     at,a1,a0
+0+00c4 <[^>]*> bnez    at,000000c4 <text_label\+0xc4>
+     ]*c4: R_MIPS_PC16       external_label
+0+00c8 <[^>]*> nop
+0+00cc <[^>]*> slt     at,a0,a1
+0+00d0 <[^>]*> beqzl   at,000000d0 <text_label\+0xd0>
+     ]*d0: R_MIPS_PC16       external_label
+0+00d4 <[^>]*> nop
+0+00d8 <[^>]*> slt     at,a1,a0
+0+00dc <[^>]*> bnezl   at,000000dc <text_label\+0xdc>
+     ]*dc: R_MIPS_PC16       external_label
+0+00e0 <[^>]*> nop
        ...
index bedab79401d513d1ed5ad24da5bf89b36d508d73..4b4e58f6d69bad91c5a64ff4b84ace7ad27b957e 100644 (file)
@@ -25,10 +25,10 @@ text_label:
        bgtl    $4,$5,text_label
 
 # Branch to an external label.
-#      bge     $4,$5,external_label
-#      bgt     $4,$5,external_label
-#      bgel    $4,$5,external_label
-#      bgtl    $4,$5,external_label
+       bge     $4,$5,external_label
+       bgt     $4,$5,external_label
+       bgel    $4,$5,external_label
+       bgtl    $4,$5,external_label
 
 # Round to a 16 byte boundary, for ease in testing multiple targets.
        nop
index d927956416f79cea24d92ffcecb826aff8ba9ac1..ace226e9eb406861728e372b95293e3b58b17cf6 100644 (file)
@@ -45,20 +45,20 @@ Disassembly of section .text:
 0+0090 <[^>]*> sltu    at,a1,a0
 0+0094 <[^>]*> bnezl   at,0+0000 <text_label>
 0+0098 <[^>]*> nop
-#0+009c <[^>]*> sltu   at,a0,a1
-#0+00a0 <[^>]*> beqz   at,000000a0 <text_label\+0xa0>
-#[     ]*a0: R_MIPS_PC16       external_label
-#0+00a4 <[^>]*> nop
-#0+00a8 <[^>]*> sltu   at,a1,a0
-#0+00ac <[^>]*> bnez   at,000000ac <text_label\+0xac>
-#[     ]*ac: R_MIPS_PC16       external_label
-#0+00b0 <[^>]*> nop
-#0+00b4 <[^>]*> sltu   at,a0,a1
-#0+00b8 <[^>]*> beqzl  at,000000b8 <text_label\+0xb8>
-#[     ]*b8: R_MIPS_PC16       external_label
-#0+00bc <[^>]*> nop
-#0+00c0 <[^>]*> sltu   at,a1,a0
-#0+00c4 <[^>]*> bnezl  at,000000c4 <text_label\+0xc4>
-#[     ]*c4: R_MIPS_PC16       external_label
-#0+00c8 <[^>]*> nop
+0+009c <[^>]*> sltu    at,a0,a1
+0+00a0 <[^>]*> beqz    at,000000a0 <text_label\+0xa0>
+     ]*a0: R_MIPS_PC16       external_label
+0+00a4 <[^>]*> nop
+0+00a8 <[^>]*> sltu    at,a1,a0
+0+00ac <[^>]*> bnez    at,000000ac <text_label\+0xac>
+     ]*ac: R_MIPS_PC16       external_label
+0+00b0 <[^>]*> nop
+0+00b4 <[^>]*> sltu    at,a0,a1
+0+00b8 <[^>]*> beqzl   at,000000b8 <text_label\+0xb8>
+     ]*b8: R_MIPS_PC16       external_label
+0+00bc <[^>]*> nop
+0+00c0 <[^>]*> sltu    at,a1,a0
+0+00c4 <[^>]*> bnezl   at,000000c4 <text_label\+0xc4>
+     ]*c4: R_MIPS_PC16       external_label
+0+00c8 <[^>]*> nop
        ...
index 8a5244c73a60105c1b103c28425cfab0ad673c30..cccd584f780a4d38d1bb20a946514180e7a7ad08 100644 (file)
@@ -23,10 +23,10 @@ text_label:
        bgtul   $4,$5,text_label
 
 # Branch to an external label.
-#      bgeu    $4,$5,external_label
-#      bgtu    $4,$5,external_label
-#      bgeul   $4,$5,external_label
-#      bgtul   $4,$5,external_label
+       bgeu    $4,$5,external_label
+       bgtu    $4,$5,external_label
+       bgeul   $4,$5,external_label
+       bgtul   $4,$5,external_label
 
 # Round to a 16 byte boundary, for ease in testing multiple targets.
        nop
index ca6d8b5e8ad5a34381f74a87338aba473037ff6f..fdc7c4ba38ec33496df71817ad7f972d2759caea 100644 (file)
@@ -51,20 +51,20 @@ Disassembly of section .text:
 0+00a8 <[^>]*> slt     at,a1,a0
 0+00ac <[^>]*> beqzl   at,0+0000 <text_label>
 0+00b0 <[^>]*> nop
-#0+00b4 <[^>]*> slt    at,a0,a1
-#0+00b8 <[^>]*> bnez   at,000000b8 <text_label\+0xb8>
-#[     ]*b8: R_MIPS_PC16       external_label
-#0+00bc <[^>]*> nop
-#0+00c0 <[^>]*> slt    at,a1,a0
-#0+00c4 <[^>]*> beqz   at,000000c4 <text_label\+0xc4>
-#[     ]*c4: R_MIPS_PC16       external_label
-#0+00c8 <[^>]*> nop
-#0+00cc <[^>]*> slt    at,a0,a1
-#0+00d0 <[^>]*> bnezl  at,000000d0 <text_label\+0xd0>
-#[     ]*d0: R_MIPS_PC16       external_label
-#0+00d4 <[^>]*> nop
-#0+00d8 <[^>]*> slt    at,a1,a0
-#0+00dc <[^>]*> beqzl  at,000000dc <text_label\+0xdc>
-#[     ]*dc: R_MIPS_PC16       external_label
-#0+00e0 <[^>]*> nop
+0+00b4 <[^>]*> slt     at,a0,a1
+0+00b8 <[^>]*> bnez    at,000000b8 <text_label\+0xb8>
+     ]*b8: R_MIPS_PC16       external_label
+0+00bc <[^>]*> nop
+0+00c0 <[^>]*> slt     at,a1,a0
+0+00c4 <[^>]*> beqz    at,000000c4 <text_label\+0xc4>
+     ]*c4: R_MIPS_PC16       external_label
+0+00c8 <[^>]*> nop
+0+00cc <[^>]*> slt     at,a0,a1
+0+00d0 <[^>]*> bnezl   at,000000d0 <text_label\+0xd0>
+     ]*d0: R_MIPS_PC16       external_label
+0+00d4 <[^>]*> nop
+0+00d8 <[^>]*> slt     at,a1,a0
+0+00dc <[^>]*> beqzl   at,000000dc <text_label\+0xdc>
+     ]*dc: R_MIPS_PC16       external_label
+0+00e0 <[^>]*> nop
        ...
index cdeff16d7837c7deee87d8126e8ccc58a217372d..9b2ed08524f396cd7d6212d7df6073ab87f1ae6d 100644 (file)
@@ -25,10 +25,10 @@ text_label:
        blel    $4,$5,text_label
 
 # Branch to an external label.
-#      blt     $4,$5,external_label
-#      ble     $4,$5,external_label
-#      bltl    $4,$5,external_label
-#      blel    $4,$5,external_label
+       blt     $4,$5,external_label
+       ble     $4,$5,external_label
+       bltl    $4,$5,external_label
+       blel    $4,$5,external_label
 
 # Round to a 16 byte boundary, for ease in testing multiple targets.
        nop
index 5b147318f7c0527575e360bb2b447d80fd464753..f6fbfbb2aee2cc41548d9228f922e0be2189b748 100644 (file)
@@ -45,20 +45,20 @@ Disassembly of section .text:
 0+0090 <[^>]*> sltu    at,a1,a0
 0+0094 <[^>]*> beqzl   at,0+0000 <text_label>
 0+0098 <[^>]*> nop
-#0+009c <[^>]*> sltu   at,a0,a1
-#0+00a0 <[^>]*> bnez   at,000000a0 <text_label\+0xa0>
-#[     ]*a0: R_MIPS_PC16       external_label
-#0+00a4 <[^>]*> nop
-#0+00a8 <[^>]*> sltu   at,a1,a0
-#0+00ac <[^>]*> beqz   at,000000ac <text_label\+0xac>
-#[     ]*ac: R_MIPS_PC16       external_label
-#0+00b0 <[^>]*> nop
-#0+00b4 <[^>]*> sltu   at,a0,a1
-#0+00b8 <[^>]*> bnezl  at,000000b8 <text_label\+0xb8>
-#[     ]*b8: R_MIPS_PC16       external_label
-#0+00bc <[^>]*> nop
-#0+00c0 <[^>]*> sltu   at,a1,a0
-#0+00c4 <[^>]*> beqzl  at,000000c4 <text_label\+0xc4>
-#[     ]*c4: R_MIPS_PC16       external_label
-#0+00c8 <[^>]*> nop
+0+009c <[^>]*> sltu    at,a0,a1
+0+00a0 <[^>]*> bnez    at,000000a0 <text_label\+0xa0>
+     ]*a0: R_MIPS_PC16       external_label
+0+00a4 <[^>]*> nop
+0+00a8 <[^>]*> sltu    at,a1,a0
+0+00ac <[^>]*> beqz    at,000000ac <text_label\+0xac>
+     ]*ac: R_MIPS_PC16       external_label
+0+00b0 <[^>]*> nop
+0+00b4 <[^>]*> sltu    at,a0,a1
+0+00b8 <[^>]*> bnezl   at,000000b8 <text_label\+0xb8>
+     ]*b8: R_MIPS_PC16       external_label
+0+00bc <[^>]*> nop
+0+00c0 <[^>]*> sltu    at,a1,a0
+0+00c4 <[^>]*> beqzl   at,000000c4 <text_label\+0xc4>
+     ]*c4: R_MIPS_PC16       external_label
+0+00c8 <[^>]*> nop
        ...
index 88034e8bc0cfce2742e5027444cae40122ac31b0..602b7b283d65559ca26e511d90832e20b72d96b8 100644 (file)
@@ -23,10 +23,10 @@ text_label:
        bleul   $4,$5,text_label
 
 # Branch to an external label.
-#      bltu    $4,$5,external_label
-#      bleu    $4,$5,external_label
-#      bltul   $4,$5,external_label
-#      bleul   $4,$5,external_label
+       bltu    $4,$5,external_label
+       bleu    $4,$5,external_label
+       bltul   $4,$5,external_label
+       bleul   $4,$5,external_label
 
 # Round to a 16 byte boundary, for ease in testing multiple targets.
        nop
diff --git a/gas/testsuite/gas/mips/branch-misc-2.d b/gas/testsuite/gas/mips/branch-misc-2.d
new file mode 100644 (file)
index 0000000..a9df3ab
--- /dev/null
@@ -0,0 +1,39 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch-misc-2
+
+# Test the backward branches to globals symbols in current file.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+       \.\.\.
+       \.\.\.
+       \.\.\.
+0+003c <[^>]*> 0411ffff        bal     0000003c <x>
+[      ]*3c: R_MIPS_PC16       g1
+0+0040 <[^>]*> 00000000        nop
+0+0044 <[^>]*> 0411ffff        bal     00000044 <x\+0x8>
+[      ]*44: R_MIPS_PC16       g2
+0+0048 <[^>]*> 00000000        nop
+0+004c <[^>]*> 0411ffff        bal     0000004c <x\+0x10>
+[      ]*4c: R_MIPS_PC16       g3
+0+0050 <[^>]*> 00000000        nop
+0+0054 <[^>]*> 0411ffff        bal     00000054 <x\+0x18>
+[      ]*54: R_MIPS_PC16       g4
+0+0058 <[^>]*> 00000000        nop
+0+005c <[^>]*> 0411ffff        bal     0000005c <x\+0x20>
+[      ]*5c: R_MIPS_PC16       g5
+0+0060 <[^>]*> 00000000        nop
+0+0064 <[^>]*> 0411ffff        bal     00000064 <x\+0x28>
+[      ]*64: R_MIPS_PC16       g6
+0+0068 <[^>]*> 00000000        nop
+       \.\.\.
+       \.\.\.
+       \.\.\.
+0+00a8 <[^>]*> 1000ffff        b       000000a8 <g6>
+[      ]*a8: R_MIPS_PC16       x1
+0+00ac <[^>]*> 00000000        nop
+0+00b0 <[^>]*> 1000ffff        b       000000b0 <g6\+0x8>
+[      ]*b0: R_MIPS_PC16       x2
+0+00b4 <[^>]*> 00000000        nop
+       \.\.\.
index eaf7d37e1d55deb2548dcec857d1795acf887f09..91bb12dde85d9fe02ef8f833a22d0220a13edadc 100644 (file)
@@ -407,7 +407,7 @@ if { [istarget mips*-*-*] } then {
     run_dump_test_arches "blt"         [mips_arch_list_matching mips2]
     run_dump_test_arches "bltu"                [mips_arch_list_matching mips2]
     run_dump_test_arches "branch-misc-1" [mips_arch_list_matching mips1]
-    run_list_test_arches "branch-misc-2" "" [mips_arch_list_matching mips1]
+    run_dump_test_arches "branch-misc-2" [mips_arch_list_matching mips1]
 
     if $ilocks {
        run_dump_test "div-ilocks"