This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
mips branches broken between 2002-09-05 and 2002-09-06
- From: cgd at broadcom dot com
- To: binutils at sources dot redhat dot com
- Cc: echristo at redhat dot com,amodra at bigpond dot net dot au
- Date: 09 Sep 2002 23:53:59 -0700
- Subject: mips branches broken between 2002-09-05 and 2002-09-06
Between 2002-09-05 00:00GMT and 2002-09-06 00:00GMT, mips branches to
global symbols in the same file were broken. I think this is probably
fallout from the big reloc rewrite, which IIRC explicitly didn't
include all of the changes necessary for MIPS.
anyway, the new tests below all pass as of 2002-09-05. as of
2002-09-06, the branch-misc-2 tests fail.
As a result of the changes in that time period:
(a) branches to global symbols (in the same file) are now
relocated against the actual target symbols,
(b) I suspect as a result of (a) and mishandling the offset in
the instructions, the the instructions/relocs in the .o files
are likely incorrect, and
(c) as a result, the offsets in the final link end up being
incorrect.
If (a) is The Right Thing, then the gas branch-misc-2.d file needs to
be adjusted to cope. The rest should be correct in either case.
(I don't know if it's kosher to have ld tests reach over into the gas
test dir, but, well, it seems like a good idea to me, or at least
better than duplicating the test source.)
It seems that as part of the changes during approximately that time
period, as well, a few of the MIPS tests had their labels made
non-global (presumably to avoid test failures due to the
relocated-related changes), so those tests would not show the failures
(even if the branches were to non-zero offsets). (as it was, the
branches were to non-zero offsets and therefore would not have shown
the changes, but if they had... changing the tests would have been a
real lose!) I'd say that those changes are unnecessary, and the right
thing to do is to adjust the expected output (if a change is expected)
instead.
(Suggestion to others writing tests: zero offsets, either relative to
. or to start of file, are bad! OK, fine, test zero offsets if you
want, but also tests other things!)
Eric, once the right thing for (a) is decided, either please either
tell me to apply this, tell me to adjust and apply, or just do it
yourself. 8-)
(And you might want to back out the removal of 'global-ness' from
certain symbols...)
cgd
============================================================================
[ gas/testsuite/ChangeLog ]
2002-09-09 Chris Demetriou <cgd@broadcom.com>
* gas/mips/branch-misc-1.d: New file.
* gas/mips/branch-misc-1.s: New file.
* gas/mips/branch-misc-2.s: New file.
* gas/mips/branch-misc-2.d: New file.
* gas/mips/mips.exp: Run new tests.
[ ld/testsuite/ChangeLog ]
2002-09-09 Chris Demetriou <cgd@broadcom.com>
* ld-mips-elf/branch-misc-1.d: New file.
* ld-mips-elf/branch-misc-2.d: New file.
* ld-mips-elf/mips-elf.exp: Run new tests.
Index: gas/testsuite/gas/mips/branch-misc-1.d
===================================================================
RCS file: gas/testsuite/gas/mips/branch-misc-1.d
diff -N gas/testsuite/gas/mips/branch-misc-1.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/mips/branch-misc-1.d 10 Sep 2002 06:34:15 -0000
@@ -0,0 +1,27 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch-misc-1
+
+# Test the branches to local symbols in current file.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+003c <[^>]*> 0411fff0 bal 00000000 <l1>
+0+0040 <[^>]*> 00000000 nop
+0+0044 <[^>]*> 0411fff3 bal 00000014 <l2>
+0+0048 <[^>]*> 00000000 nop
+0+004c <[^>]*> 0411fff6 bal 00000028 <l3>
+0+0050 <[^>]*> 00000000 nop
+0+0054 <[^>]*> 0411000a bal 00000080 <l4>
+0+0058 <[^>]*> 00000000 nop
+0+005c <[^>]*> 0411000d bal 00000094 <l5>
+0+0060 <[^>]*> 00000000 nop
+0+0064 <[^>]*> 04110010 bal 000000a8 <l6>
+0+0068 <[^>]*> 00000000 nop
+ \.\.\.
+ \.\.\.
+ \.\.\.
+ \.\.\.
Index: gas/testsuite/gas/mips/branch-misc-1.s
===================================================================
RCS file: gas/testsuite/gas/mips/branch-misc-1.s
diff -N gas/testsuite/gas/mips/branch-misc-1.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/mips/branch-misc-1.s 10 Sep 2002 06:34:15 -0000
@@ -0,0 +1,27 @@
+# Source file used to test the branches to locals in this file.
+
+ .text
+l1:
+ .space 20
+l2:
+ .space 20
+l3:
+ .space 20
+
+x:
+ bal l1
+ bal l2
+ bal l3
+ bal l4
+ bal l5
+ bal l6
+
+ .space 20
+l4:
+ .space 20
+l5:
+ .space 20
+l6:
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .space 8
Index: gas/testsuite/gas/mips/branch-misc-2.d
===================================================================
RCS file: gas/testsuite/gas/mips/branch-misc-2.d
diff -N gas/testsuite/gas/mips/branch-misc-2.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/mips/branch-misc-2.d 10 Sep 2002 06:34:15 -0000
@@ -0,0 +1,27 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch-misc-2
+
+# Test the branches to global symbols in current file.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+003c <[^>]*> 0411fff0 bal 00000000 <g1>
+0+0040 <[^>]*> 00000000 nop
+0+0044 <[^>]*> 0411fff3 bal 00000014 <g2>
+0+0048 <[^>]*> 00000000 nop
+0+004c <[^>]*> 0411fff6 bal 00000028 <g3>
+0+0050 <[^>]*> 00000000 nop
+0+0054 <[^>]*> 0411000a bal 00000080 <g4>
+0+0058 <[^>]*> 00000000 nop
+0+005c <[^>]*> 0411000d bal 00000094 <g5>
+0+0060 <[^>]*> 00000000 nop
+0+0064 <[^>]*> 04110010 bal 000000a8 <g6>
+0+0068 <[^>]*> 00000000 nop
+ \.\.\.
+ \.\.\.
+ \.\.\.
+ \.\.\.
Index: gas/testsuite/gas/mips/branch-misc-2.s
===================================================================
RCS file: gas/testsuite/gas/mips/branch-misc-2.s
diff -N gas/testsuite/gas/mips/branch-misc-2.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/mips/branch-misc-2.s 10 Sep 2002 06:34:15 -0000
@@ -0,0 +1,34 @@
+# 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
+
+ .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:
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .space 8
Index: gas/testsuite/gas/mips/mips.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips.exp,v
retrieving revision 1.40
diff -u -p -r1.40 mips.exp
--- gas/testsuite/gas/mips/mips.exp 12 Aug 2002 08:30:50 -0000 1.40
+++ gas/testsuite/gas/mips/mips.exp 10 Sep 2002 06:34:15 -0000
@@ -56,6 +56,8 @@ if { [istarget mips*-*-*] } then {
run_dump_test "bgeu"
run_dump_test "blt"
run_dump_test "bltu"
+ run_dump_test "branch-misc-1"
+ run_dump_test "branch-misc-2"
if $ilocks {
run_dump_test "div-ilocks"
Index: ld/testsuite/ld-mips-elf/branch-misc-1.d
===================================================================
RCS file: ld/testsuite/ld-mips-elf/branch-misc-1.d
diff -N ld/testsuite/ld-mips-elf/branch-misc-1.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-mips-elf/branch-misc-1.d 10 Sep 2002 06:34:18 -0000
@@ -0,0 +1,30 @@
+#name: MIPS branch-misc-1
+#source: ../../../gas/testsuite/gas/mips/branch-misc-1.s
+#objdump: --prefix-addresses -tdr --show-raw-insn
+#ld: -Ttext 0x400000 -e 0x400000
+
+.*: file format elf.*mips.*
+
+#...
+
+Disassembly of section \.text:
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+40003c <[^>]*> 0411fff0 bal 0+400000 <[^>]*>
+0+400040 <[^>]*> 00000000 nop
+0+400044 <[^>]*> 0411fff3 bal 0+400014 <[^>]*>
+0+400048 <[^>]*> 00000000 nop
+0+40004c <[^>]*> 0411fff6 bal 0+400028 <[^>]*>
+0+400050 <[^>]*> 00000000 nop
+0+400054 <[^>]*> 0411000a bal 0+400080 <[^>]*>
+0+400058 <[^>]*> 00000000 nop
+0+40005c <[^>]*> 0411000d bal 0+400094 <[^>]*>
+0+400060 <[^>]*> 00000000 nop
+0+400064 <[^>]*> 04110010 bal 0+4000a8 <[^>]*>
+0+400068 <[^>]*> 00000000 nop
+ \.\.\.
+ \.\.\.
+ \.\.\.
+ \.\.\.
+#pass
Index: ld/testsuite/ld-mips-elf/branch-misc-2.d
===================================================================
RCS file: ld/testsuite/ld-mips-elf/branch-misc-2.d
diff -N ld/testsuite/ld-mips-elf/branch-misc-2.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-mips-elf/branch-misc-2.d 10 Sep 2002 06:34:18 -0000
@@ -0,0 +1,30 @@
+#name: MIPS branch-misc-2
+#source: ../../../gas/testsuite/gas/mips/branch-misc-2.s
+#objdump: --prefix-addresses -tdr --show-raw-insn
+#ld: -Ttext 0x400000 -e 0x400000
+
+.*: file format elf.*mips.*
+
+#...
+
+Disassembly of section \.text:
+ \.\.\.
+ \.\.\.
+ \.\.\.
+0+40003c <[^>]*> 0411fff0 bal 0+400000 <[^>]*>
+0+400040 <[^>]*> 00000000 nop
+0+400044 <[^>]*> 0411fff3 bal 0+400014 <[^>]*>
+0+400048 <[^>]*> 00000000 nop
+0+40004c <[^>]*> 0411fff6 bal 0+400028 <[^>]*>
+0+400050 <[^>]*> 00000000 nop
+0+400054 <[^>]*> 0411000a bal 0+400080 <[^>]*>
+0+400058 <[^>]*> 00000000 nop
+0+40005c <[^>]*> 0411000d bal 0+400094 <[^>]*>
+0+400060 <[^>]*> 00000000 nop
+0+400064 <[^>]*> 04110010 bal 0+4000a8 <[^>]*>
+0+400068 <[^>]*> 00000000 nop
+ \.\.\.
+ \.\.\.
+ \.\.\.
+ \.\.\.
+#pass
Index: ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/mips-elf.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mips-elf.exp
--- ld/testsuite/ld-mips-elf/mips-elf.exp 26 Jul 2002 18:56:25 -0000 1.4
+++ ld/testsuite/ld-mips-elf/mips-elf.exp 10 Sep 2002 06:34:18 -0000
@@ -42,5 +42,8 @@ if { [istarget mips*-*-*] } then {
run_dump_test "mips16-1"
run_dump_test "region1"
+
+ run_dump_test "branch-misc-1"
+ run_dump_test "branch-misc-2"
}
}