aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-11-23 14:04:18 +0000
committerDaniel Jacobowitz <drow@false.org>2005-11-23 14:04:18 +0000
commitbad36eacdad37042c4efb1c5fbf48476b47de82b (patch)
tree09ba18d0af929dc68344a1788a63c3d48f0613e7 /gas
parenta14199dbd52888ecea9fc3d0e0f2c264c172f29c (diff)
downloadgdb-bad36eacdad37042c4efb1c5fbf48476b47de82b.zip
gdb-bad36eacdad37042c4efb1c5fbf48476b47de82b.tar.gz
gdb-bad36eacdad37042c4efb1c5fbf48476b47de82b.tar.bz2
bfd/
* elf32-mips.c (elf_mips_howto_table_rel): Use rightshift 2 for R_MIPS_PC16. (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16. (bfd_elf32_bfd_reloc_type_lookup): Don't handle BFD_RELOC_16_PCREL_S2. * elf64-mips.c (mips_elf64_howto_table_rel): Use rightshift 2 for R_MIPS_PC16. (mips_elf64_howto_table_rela): Likewise. (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16. (bfd_elf64_bfd_reloc_type_lookup): Don't handle BFD_RELOC_16_PCREL_S2. * elfn32-mips.c (elf_mips_howto_table_rel): Use rightshift 2 for R_MIPS_PC16. (elf_mips_howto_table_rela): Likewise. (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16. (bfd_elf32_bfd_reloc_type_lookup): Don't handle BFD_RELOC_16_PCREL_S2. * elfxx-mips.c: Formatting fixes. (mips_elf_calculate_relocation): Handle R_MIPS_GNU_REL16_S2 and R_MIPS_PC16 identically. gas/ * config/tc-mips.c (append_insn): Handle BFD_RELOC_16_PCREL_S2. (macro_build): Complain for invalid branch displacements. (mips_validate_fix): Delete. (md_apply_fix): Re-add pcrel support for branches. Use consistent text for misaligned branch targets. (tc_gen_reloc: Re-add pcrel support for branches. Handle strange BFD pcrel processing. Remove error for unresolved branches. * config/tc-mips.h (TC_VALIDATE_FIX, mips_validate_fix): Delete. gas/testsuite/ * gas/mips/bge.d, gas/mips/bge.s, gas/mips/bgeu.d, gas/mips/bgeu.s, gas/mips/blt.d, gas/mips/blt.s, gas/mips/bltu.d, gas/mips/bltu.s: Reactivate external branch tests. * gas/mips/branch-misc-2.d, gas/mips/branch-misc-2pic.d, gas/mips/branch-misc-2-64.d, gas/mips/branch-misc-2pic-64.d: New tests. * gas/mips/branch-misc-2.l, gas/mips/branch-misc-2pic.l, gas/testsuite/gas/mips/branch-misc-2pic.s: Remove. * gas/mips/mips.exp: Adjust branch-misc-2 tests. Add 64-bit variants.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog12
-rw-r--r--gas/config/tc-mips.c144
-rw-r--r--gas/config/tc-mips.h9
-rw-r--r--gas/testsuite/ChangeLog14
-rw-r--r--gas/testsuite/gas/mips/bge.d32
-rw-r--r--gas/testsuite/gas/mips/bge.s8
-rw-r--r--gas/testsuite/gas/mips/bgeu.d32
-rw-r--r--gas/testsuite/gas/mips/bgeu.s8
-rw-r--r--gas/testsuite/gas/mips/blt.d32
-rw-r--r--gas/testsuite/gas/mips/blt.s8
-rw-r--r--gas/testsuite/gas/mips/bltu.d32
-rw-r--r--gas/testsuite/gas/mips/bltu.s8
-rw-r--r--gas/testsuite/gas/mips/branch-misc-2-64.d62
-rw-r--r--gas/testsuite/gas/mips/branch-misc-2.d43
-rw-r--r--gas/testsuite/gas/mips/branch-misc-2.l4
-rw-r--r--gas/testsuite/gas/mips/branch-misc-2pic-64.d62
-rw-r--r--gas/testsuite/gas/mips/branch-misc-2pic.d44
-rw-r--r--gas/testsuite/gas/mips/branch-misc-2pic.l10
-rw-r--r--gas/testsuite/gas/mips/branch-misc-2pic.s43
-rw-r--r--gas/testsuite/gas/mips/mips.exp6
20 files changed, 364 insertions, 249 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c403707..04d9727 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,15 @@
+2005-11-23 Daniel Jacobowitz <dan@codesourcery.com>
+ Thiemo Seufer <ths@networkno.de>
+
+ * config/tc-mips.c (append_insn): Handle BFD_RELOC_16_PCREL_S2.
+ (macro_build): Complain for invalid branch displacements.
+ (mips_validate_fix): Delete.
+ (md_apply_fix): Re-add pcrel support for branches. Use consistent
+ text for misaligned branch targets.
+ (tc_gen_reloc: Re-add pcrel support for branches. Handle strange
+ BFD pcrel processing. Remove error for unresolved branches.
+ * config/tc-mips.h (TC_VALIDATE_FIX, mips_validate_fix): Delete.
+
2005-11-22 James E Wilson <wilson@specifix.com>
* config/tc-ia64.c (emit_one_bundle): Perform last_slot < 0 check
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 4f1afea..557fb40 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -2410,7 +2410,16 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
break;
case BFD_RELOC_16_PCREL_S2:
- goto need_reloc;
+ 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;
default:
internalError ();
@@ -3139,15 +3148,22 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
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;
}
@@ -11361,83 +11377,6 @@ mips_force_relocation (fixS *fixp)
return 0;
}
-/* This hook is called before a fix is simplified. We don't really
- decide whether to skip a fix here. Rather, we turn global symbols
- used as branch targets into local symbols, such that they undergo
- simplification. We can only do this if the symbol is defined and
- it is in the same section as the branch. If this doesn't hold, we
- emit a better error message than just saying the relocation is not
- valid for the selected object format.
-
- FIXP is the fix-up we're going to try to simplify, SEG is the
- segment in which the fix up occurs. The return value should be
- non-zero to indicate the fix-up is valid for further
- simplifications. */
-
-int
-mips_validate_fix (struct fix *fixP, asection *seg)
-{
- /* There's a lot of discussion on whether it should be possible to
- use R_MIPS_PC16 to represent branch relocations. The outcome
- seems to be that it can, but gas/bfd are very broken in creating
- RELA relocations for this, so for now we only accept branches to
- symbols in the same section. Anything else is of dubious value,
- since there's no guarantee that at link time the symbol would be
- in range. Even for branches to local symbols this is arguably
- wrong, since it we assume the symbol is not going to be
- overridden, which should be possible per ELF library semantics,
- but then, there isn't a dynamic relocation that could be used to
- this effect, and the target would likely be out of range as well.
-
- Unfortunately, it seems that there is too much code out there
- that relies on branches to symbols that are global to be resolved
- as if they were local, like the IRIX tools do, so we do it as
- well, but with a warning so that people are reminded to fix their
- code. If we ever get back to using R_MIPS_PC16 for branch
- targets, this entire block should go away (and probably the
- whole function). */
-
- if (fixP->fx_r_type == BFD_RELOC_16_PCREL_S2
- && ((OUTPUT_FLAVOR == bfd_target_ecoff_flavour
- || OUTPUT_FLAVOR == bfd_target_elf_flavour)
- || bfd_reloc_type_lookup (stdoutput, BFD_RELOC_16_PCREL_S2) == NULL)
- && fixP->fx_addsy)
- {
- if (! S_IS_DEFINED (fixP->fx_addsy))
- {
- as_bad_where (fixP->fx_file, fixP->fx_line,
- _("Cannot branch to undefined symbol."));
- /* Avoid any further errors about this fixup. */
- fixP->fx_done = 1;
- }
- else if (S_GET_SEGMENT (fixP->fx_addsy) != seg)
- {
- as_bad_where (fixP->fx_file, fixP->fx_line,
- _("Cannot branch to symbol in another section."));
- fixP->fx_done = 1;
- }
- else if (S_IS_EXTERNAL (fixP->fx_addsy))
- {
- symbolS *sym = fixP->fx_addsy;
-
- if (mips_pic == SVR4_PIC)
- as_warn_where (fixP->fx_file, fixP->fx_line,
- _("Pretending global symbol used as branch target is local."));
-
- fixP->fx_addsy = symbol_create (S_GET_NAME (sym),
- S_GET_SEGMENT (sym),
- S_GET_VALUE (sym),
- symbol_get_frag (sym));
- copy_symbol_attributes (fixP->fx_addsy, sym);
- S_CLEAR_EXTERNAL (fixP->fx_addsy);
- assert (symbol_resolved_p (sym));
- symbol_mark_resolved (fixP->fx_addsy);
- }
- }
-
- return 1;
-}
-
/* Apply a fixup to the object file. */
void
@@ -11462,7 +11401,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
buf = (bfd_byte *) (fixP->fx_frag->fr_literal + fixP->fx_where);
- assert (! fixP->fx_pcrel);
+ assert (! fixP->fx_pcrel || fixP->fx_r_type == BFD_RELOC_16_PCREL_S2);
/* Don't treat parts of a composite relocation as done. There are two
reasons for this:
@@ -11474,7 +11413,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
constants. The easiest way of dealing with the pathological
exceptions is to generate a relocation against STN_UNDEF and
leave everything up to the linker. */
- if (fixP->fx_addsy == NULL && fixP->fx_tcbit == 0)
+ if (fixP->fx_addsy == NULL && ! fixP->fx_pcrel && fixP->fx_tcbit == 0)
fixP->fx_done = 1;
switch (fixP->fx_r_type)
@@ -11519,7 +11458,6 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_MIPS16_GPREL:
case BFD_RELOC_MIPS16_HI16:
case BFD_RELOC_MIPS16_HI16_S:
- assert (! fixP->fx_pcrel);
/* Nothing needed to do. The value comes from the reloc entry */
break;
@@ -11589,7 +11527,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_16_PCREL_S2:
if ((*valP & 0x3) != 0)
as_bad_where (fixP->fx_file, fixP->fx_line,
- _("Branch to odd address (%lx)"), (long) *valP);
+ _("Branch to misaligned address (%lx)"), (long) *valP);
/*
* We need to save the bits in the instruction since fixup_segment()
@@ -13307,8 +13245,24 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
- assert (! fixp->fx_pcrel);
- reloc->addend = fixp->fx_addnumber;
+ if (fixp->fx_pcrel)
+ {
+ assert (fixp->fx_r_type == BFD_RELOC_16_PCREL_S2);
+
+ /* At this point, fx_addnumber is "symbol offset - pcrel address".
+ Relocations want only the symbol offset. */
+ reloc->addend = fixp->fx_addnumber + reloc->address;
+ if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+ {
+ /* A gruesome hack which is a result of the gruesome gas
+ reloc handling. What's worse, for COFF (as opposed to
+ ECOFF), we might need yet another copy of reloc->address.
+ See bfd_install_relocation. */
+ reloc->addend += reloc->address;
+ }
+ }
+ else
+ reloc->addend = fixp->fx_addnumber;
/* Since the old MIPS ELF ABI uses Rel instead of Rela, encode the vtable
entry to be used in the relocation's section offset. */
@@ -13320,18 +13274,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
code = fixp->fx_r_type;
- /* To support a PC relative reloc, we used a Cygnus extension.
- We check for that here to make sure that we don't let such a
- reloc escape normally. (FIXME: This was formerly used by
- embedded-PIC support, but is now used by branch handling in
- general. That probably should be fixed.) */
- if ((OUTPUT_FLAVOR == bfd_target_ecoff_flavour
- || OUTPUT_FLAVOR == bfd_target_elf_flavour)
- && code == BFD_RELOC_16_PCREL_S2)
- 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,
@@ -13408,8 +13351,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *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, BFD_RELOC_16_PCREL_S2);
fixp->fx_file = fragp->fr_file;
fixp->fx_line = fragp->fr_line;
diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
index e657f3c..bc642b0 100644
--- a/gas/config/tc-mips.h
+++ b/gas/config/tc-mips.h
@@ -122,15 +122,6 @@ extern int mips_force_relocation (struct fix *);
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
(! SEG_NORMAL (SEG) || mips_force_relocation (FIX))
-/* We use this to turn branches to global symbols into branches to
- local symbols, so that they can be simplified. */
-#define TC_VALIDATE_FIX(fixp, this_segment, skip_label) \
- do \
- if (! mips_validate_fix ((fixp), (this_segment))) \
- goto skip_label; \
- while (0)
-extern int mips_validate_fix (struct fix *, asection *);
-
/* Register mask variables. These are set by the MIPS assembly code
and used by ECOFF and possibly other object file formats. */
extern unsigned long mips_gprmask;
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 94317f9..a2a665e 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2005-11-23 Daniel Jacobowitz <dan@codesourcery.com>
+ Thiemo Seufer <ths@networkno.de>
+
+ * gas/mips/bge.d, gas/mips/bge.s, gas/mips/bgeu.d, gas/mips/bgeu.s,
+ gas/mips/blt.d, gas/mips/blt.s, gas/mips/bltu.d,
+ gas/mips/bltu.s: Reactivate external branch tests.
+ * gas/mips/branch-misc-2.d, gas/mips/branch-misc-2pic.d,
+ gas/mips/branch-misc-2-64.d, gas/mips/branch-misc-2pic-64.d: New
+ tests.
+ * gas/mips/branch-misc-2.l, gas/mips/branch-misc-2pic.l,
+ gas/testsuite/gas/mips/branch-misc-2pic.s: Remove.
+ * gas/mips/mips.exp: Adjust branch-misc-2 tests. Add 64-bit
+ variants.
+
2005-11-22 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* gas/all/quad.d: Add -j "\$DATA\$". Modify regexp to check for
diff --git a/gas/testsuite/gas/mips/bge.d b/gas/testsuite/gas/mips/bge.d
index 189ae3f..2ef2850 100644
--- a/gas/testsuite/gas/mips/bge.d
+++ b/gas/testsuite/gas/mips/bge.d
@@ -52,20 +52,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
...
diff --git a/gas/testsuite/gas/mips/bge.s b/gas/testsuite/gas/mips/bge.s
index bedab79..4b4e58f 100644
--- a/gas/testsuite/gas/mips/bge.s
+++ b/gas/testsuite/gas/mips/bge.s
@@ -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
diff --git a/gas/testsuite/gas/mips/bgeu.d b/gas/testsuite/gas/mips/bgeu.d
index b367e0e..4c0753b 100644
--- a/gas/testsuite/gas/mips/bgeu.d
+++ b/gas/testsuite/gas/mips/bgeu.d
@@ -46,20 +46,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
...
diff --git a/gas/testsuite/gas/mips/bgeu.s b/gas/testsuite/gas/mips/bgeu.s
index 8a5244c..cccd584 100644
--- a/gas/testsuite/gas/mips/bgeu.s
+++ b/gas/testsuite/gas/mips/bgeu.s
@@ -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
diff --git a/gas/testsuite/gas/mips/blt.d b/gas/testsuite/gas/mips/blt.d
index fc6aa19..fb2914a 100644
--- a/gas/testsuite/gas/mips/blt.d
+++ b/gas/testsuite/gas/mips/blt.d
@@ -52,20 +52,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
...
diff --git a/gas/testsuite/gas/mips/blt.s b/gas/testsuite/gas/mips/blt.s
index cdeff16..9b2ed08 100644
--- a/gas/testsuite/gas/mips/blt.s
+++ b/gas/testsuite/gas/mips/blt.s
@@ -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
diff --git a/gas/testsuite/gas/mips/bltu.d b/gas/testsuite/gas/mips/bltu.d
index 945d2a4..308afdf 100644
--- a/gas/testsuite/gas/mips/bltu.d
+++ b/gas/testsuite/gas/mips/bltu.d
@@ -46,20 +46,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
...
diff --git a/gas/testsuite/gas/mips/bltu.s b/gas/testsuite/gas/mips/bltu.s
index 88034e8..602b7b2 100644
--- a/gas/testsuite/gas/mips/bltu.s
+++ b/gas/testsuite/gas/mips/bltu.s
@@ -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-64.d b/gas/testsuite/gas/mips/branch-misc-2-64.d
new file mode 100644
index 0000000..0b56d97
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-misc-2-64.d
@@ -0,0 +1,62 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch-misc-2-64
+#source: branch-misc-2.s
+#as: -64 -non_shared
+
+# Test the backward branches to globals symbols in current file.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+003c <[^>]*> 04110000 bal 0000000000000040 <x\+0x4>
+[ ]*3c: R_MIPS_PC16 g1\+0xfffffffffffffffc
+[ ]*3c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*3c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0040 <[^>]*> 00000000 nop
+0+0044 <[^>]*> 04110000 bal 0000000000000048 <x\+0xc>
+[ ]*44: R_MIPS_PC16 g2\+0xfffffffffffffffc
+[ ]*44: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*44: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0048 <[^>]*> 00000000 nop
+0+004c <[^>]*> 04110000 bal 0000000000000050 <x\+0x14>
+[ ]*4c: R_MIPS_PC16 g3\+0xfffffffffffffffc
+[ ]*4c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*4c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0050 <[^>]*> 00000000 nop
+0+0054 <[^>]*> 04110000 bal 0000000000000058 <x\+0x1c>
+[ ]*54: R_MIPS_PC16 g4\+0xfffffffffffffffc
+[ ]*54: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*54: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0058 <[^>]*> 00000000 nop
+0+005c <[^>]*> 04110000 bal 0000000000000060 <x\+0x24>
+[ ]*5c: R_MIPS_PC16 g5\+0xfffffffffffffffc
+[ ]*5c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*5c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0060 <[^>]*> 00000000 nop
+0+0064 <[^>]*> 04110000 bal 0000000000000068 <x\+0x2c>
+[ ]*64: R_MIPS_PC16 g6\+0xfffffffffffffffc
+[ ]*64: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*64: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0068 <[^>]*> 00000000 nop
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+00a8 <[^>]*> 10000000 b 00000000000000ac <g6\+0x4>
+[ ]*a8: R_MIPS_PC16 x1\+0xfffffffffffffffc
+[ ]*a8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*a8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+00ac <[^>]*> 00000000 nop
+0+00b0 <[^>]*> 10000000 b 00000000000000b4 <g6\+0xc>
+[ ]*b0: R_MIPS_PC16 x2\+0xfffffffffffffffc
+[ ]*b0: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*b0: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+00b4 <[^>]*> 00000000 nop
+0+00b8 <[^>]*> 10000000 b 00000000000000bc <g6\+0x14>
+[ ]*b8: R_MIPS_PC16 \.data\+0xfffffffffffffffc
+[ ]*b8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*b8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+00bc <[^>]*> 00000000 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
index 0000000..7ba5dbc
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-misc-2.d
@@ -0,0 +1,43 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch-misc-2
+#as: -32 -non_shared
+
+# 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
+0+00b8 <[^>]*> 1000ffff b 000000b8 <g6\+0x10>
+[ ]*b8: R_MIPS_PC16 \.data
+0+00bc <[^>]*> 00000000 nop
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/branch-misc-2.l b/gas/testsuite/gas/mips/branch-misc-2.l
deleted file mode 100644
index a66aaa6..0000000
--- a/gas/testsuite/gas/mips/branch-misc-2.l
+++ /dev/null
@@ -1,4 +0,0 @@
-.*: Assembler messages:
-.*:35: Error: Cannot branch to undefined symbol.
-.*:36: Error: Cannot branch to undefined symbol.
-.*:37: Error: Cannot branch to symbol in another section.
diff --git a/gas/testsuite/gas/mips/branch-misc-2pic-64.d b/gas/testsuite/gas/mips/branch-misc-2pic-64.d
new file mode 100644
index 0000000..dadde87
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-misc-2pic-64.d
@@ -0,0 +1,62 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch-misc-2-64
+#source: branch-misc-2.s
+#as: -64 -call_shared
+
+# Test the backward branches to globals symbols in current file.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+003c <[^>]*> 04110000 bal 0000000000000040 <x\+0x4>
+[ ]*3c: R_MIPS_PC16 g1\+0xfffffffffffffffc
+[ ]*3c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*3c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0040 <[^>]*> 00000000 nop
+0+0044 <[^>]*> 04110000 bal 0000000000000048 <x\+0xc>
+[ ]*44: R_MIPS_PC16 g2\+0xfffffffffffffffc
+[ ]*44: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*44: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0048 <[^>]*> 00000000 nop
+0+004c <[^>]*> 04110000 bal 0000000000000050 <x\+0x14>
+[ ]*4c: R_MIPS_PC16 g3\+0xfffffffffffffffc
+[ ]*4c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*4c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0050 <[^>]*> 00000000 nop
+0+0054 <[^>]*> 04110000 bal 0000000000000058 <x\+0x1c>
+[ ]*54: R_MIPS_PC16 g4\+0xfffffffffffffffc
+[ ]*54: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*54: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0058 <[^>]*> 00000000 nop
+0+005c <[^>]*> 04110000 bal 0000000000000060 <x\+0x24>
+[ ]*5c: R_MIPS_PC16 g5\+0xfffffffffffffffc
+[ ]*5c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*5c: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0060 <[^>]*> 00000000 nop
+0+0064 <[^>]*> 04110000 bal 0000000000000068 <x\+0x2c>
+[ ]*64: R_MIPS_PC16 g6\+0xfffffffffffffffc
+[ ]*64: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*64: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+0068 <[^>]*> 00000000 nop
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+00a8 <[^>]*> 10000000 b 00000000000000ac <g6\+0x4>
+[ ]*a8: R_MIPS_PC16 x1\+0xfffffffffffffffc
+[ ]*a8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*a8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+00ac <[^>]*> 00000000 nop
+0+00b0 <[^>]*> 10000000 b 00000000000000b4 <g6\+0xc>
+[ ]*b0: R_MIPS_PC16 x2\+0xfffffffffffffffc
+[ ]*b0: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*b0: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+00b4 <[^>]*> 00000000 nop
+0+00b8 <[^>]*> 10000000 b 00000000000000bc <g6\+0x14>
+[ ]*b8: R_MIPS_PC16 \.data\+0xfffffffffffffffc
+[ ]*b8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+[ ]*b8: R_MIPS_NONE \*ABS\*\+0xfffffffffffffffc
+0+00bc <[^>]*> 00000000 nop
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/branch-misc-2pic.d b/gas/testsuite/gas/mips/branch-misc-2pic.d
new file mode 100644
index 0000000..516b490
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-misc-2pic.d
@@ -0,0 +1,44 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch-misc-2pic
+#source: branch-misc-2.s
+#as: -32 -call_shared
+
+# 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
+0+00b8 <[^>]*> 1000ffff b 000000b8 <g6\+0x10>
+[ ]*b8: R_MIPS_PC16 \.data
+0+00bc <[^>]*> 00000000 nop
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/branch-misc-2pic.l b/gas/testsuite/gas/mips/branch-misc-2pic.l
deleted file mode 100644
index 3ddc97a..0000000
--- a/gas/testsuite/gas/mips/branch-misc-2pic.l
+++ /dev/null
@@ -1,10 +0,0 @@
-.*: Assembler messages:
-.*:21: Warning: Pretending global symbol used as branch target is local.
-.*:22: Warning: Pretending global symbol used as branch target is local.
-.*:23: Warning: Pretending global symbol used as branch target is local.
-.*:24: Warning: Pretending global symbol used as branch target is local.
-.*:25: Warning: Pretending global symbol used as branch target is local.
-.*:26: Warning: Pretending global symbol used as branch target is local.
-.*:35: Error: Cannot branch to undefined symbol.
-.*:36: Error: Cannot branch to undefined symbol.
-.*:37: Error: Cannot branch to symbol in another section.
diff --git a/gas/testsuite/gas/mips/branch-misc-2pic.s b/gas/testsuite/gas/mips/branch-misc-2pic.s
deleted file mode 100644
index 3167289..0000000
--- a/gas/testsuite/gas/mips/branch-misc-2pic.s
+++ /dev/null
@@ -1,43 +0,0 @@
-# Source file used to test the backward branches to globals in this file.
-
- .globl g1 .text
- .globl g2 .text
- .globl g3 .text
- .globl g4 .text
- .globl g5 .text
- .globl g6 .text
-
- .globl x1 .text
-
- .text
-g1:
- .space 20
-g2:
- .space 20
-g3:
- .space 20
-
-x:
- bal g1
- bal g2
- bal g3
- bal g4
- bal g5
- bal g6
-
- .space 20
-g4:
- .space 20
-g5:
- .space 20
-g6:
-
- b x1
- b x2
- b .Ldata
-
-# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
- .space 8
-
- .data
-.Ldata:
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 174aea4..2599777 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -427,8 +427,10 @@ 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" "-32 -non_shared" [mips_arch_list_matching mips1]
- run_list_test_arches "branch-misc-2pic" "-32 -call_shared" [mips_arch_list_matching mips1]
+ run_dump_test_arches "branch-misc-2" [mips_arch_list_matching mips1]
+ run_dump_test_arches "branch-misc-2pic" [mips_arch_list_matching mips1]
+ run_dump_test_arches "branch-misc-2-64" [mips_arch_list_matching mips3]
+ run_dump_test_arches "branch-misc-2pic-64" [mips_arch_list_matching mips3]
run_dump_test "branch-misc-3"
run_dump_test "branch-swap"