This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed 4/4] MIPS/LD/testsuite: Verify microMIPS LA25 stub generation
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: <binutils at sourceware dot org>
- Cc: Faraz Shahbazker <faraz dot shahbazker at imgtec dot com>
- Date: Wed, 10 Aug 2016 22:36:23 +0100
- Subject: [committed 4/4] MIPS/LD/testsuite: Verify microMIPS LA25 stub generation
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.00.1608091554160.4471@tp.orcam.me.uk>
Repeat `PIC and non-PIC test 1' checks for microMIPS LA25 stubs,
covering code generation and stub symbol annotation.
ld/
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd: New
test.
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd: New
test.
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s: New test
source.
* testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s: New test
source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
---
binutils-mips-cross-mode-la25-test.diff
Index: binutils/ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
--- binutils.orig/ld/testsuite/ld-mips-elf/mips-elf.exp 2016-08-10 12:48:18.558855684 +0100
+++ binutils/ld/testsuite/ld-mips-elf/mips-elf.exp 2016-08-10 21:41:34.633794932 +0100
@@ -357,6 +357,8 @@ if { $linux_gnu } {
#
# The third test checks that we do the same when linking the
# result of the first link (with no other source files).
+ #
+ # We then repeat the same three tests for microMIPS stubs.
run_ld_link_tests {
{"PIC and non-PIC test 1 (relocatable)" "-r -melf32btsmip" ""
"-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s}
@@ -375,6 +377,42 @@ if { $linux_gnu } {
{{objdump -dr pic-and-nonpic-1.dd}
{readelf --symbols pic-and-nonpic-1.nd}}
"pic-and-nonpic-1-static2.o"}
+ {"PIC and non-PIC test 1, microMIPS (relocatable)"
+ "-r -melf32btsmip" ""
+ "-32 -EB -mips2"
+ {pic-and-nonpic-1a-micromips.s pic-and-nonpic-1b-micromips.s}
+ {{objdump -dr pic-and-nonpic-1-micromips-rel.dd}
+ {readelf --symbols pic-and-nonpic-1-micromips-rel.nd}}
+ "pic-and-nonpic-1-micromips-rel.o"}
+ {"PIC and non-PIC test 1, microMIPS (static 1)"
+ "-melf32btsmip -Tpic-and-nonpic-1.ld" ""
+ "-32 -EB -mips2"
+ {pic-and-nonpic-1a-micromips.s pic-and-nonpic-1b-micromips.s}
+ {{objdump -dr pic-and-nonpic-1-micromips.dd}
+ {readelf --symbols pic-and-nonpic-1-micromips.nd}}
+ "pic-and-nonpic-1-micromips-static1.o"}
+ }
+ # The final executable produced with the following test is supposed
+ # to be the same as one produced with the preceding test, however
+ # as noted in PR ld/20453 it is not. Consequently output from
+ # `objdump -dr' is not the same either. Expect:
+ #
+ # regexp_diff match failure
+ # regexp "^ 4103c: f001 0415 jalx 41054 <f3>$"
+ # line " 4103c: f001 0400 jalx 41000 <.pic.f3>"
+ #
+ # from the test below due to this problem.
+ setup_kfail "mips*-*-*" "ld/20453"
+ # The final check below should be folded into the `run_ld_link_tests'
+ # call above once `setup_kfail' has been removed.
+ run_ld_link_tests {
+ {"PIC and non-PIC test 1, microMIPS (static 2)"
+ "-melf32btsmip -Tpic-and-nonpic-1.ld \
+ tmpdir/pic-and-nonpic-1-micromips-rel.o" ""
+ "" {}
+ {{objdump -dr pic-and-nonpic-1-micromips.dd}
+ {readelf --symbols pic-and-nonpic-1-micromips.nd}}
+ "pic-and-nonpic-1-micromips-static2.o"}
}
run_dump_test "pic-and-nonpic-2"
run_ld_link_tests {
Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd 2016-08-10 20:45:05.600801556 +0100
@@ -0,0 +1,42 @@
+
+.*
+
+Disassembly of section \.text:
+
+00000000 <f1>:
+ 0: 41bc 0000 lui gp,0x0
+ 0: R_MICROMIPS_HI16 _gp_disp
+ 4: 339c 0000 addiu gp,gp,0
+ 4: R_MICROMIPS_LO16 _gp_disp
+ 8: 033c e150 addu gp,gp,t9
+ c: f400 0000 jal 0 .*
+ c: R_MICROMIPS_26_S1 f3
+ 10: 0000 0000 nop
+ 14: 45bf jrc ra
+
+00000016 <f2>:
+ 16: 41bc 0000 lui gp,0x0
+ 16: R_MICROMIPS_HI16 _gp_disp
+ 1a: 339c 0000 addiu gp,gp,0
+ 1a: R_MICROMIPS_LO16 _gp_disp
+ 1e: 033c e150 addu gp,gp,t9
+ 22: 45bf jrc ra
+
+00000024 <f3>:
+ 24: 3c1c0000 lui gp,0x0
+ 24: R_MIPS_HI16 _gp_disp
+ 28: 279c0000 addiu gp,gp,0
+ 28: R_MIPS_LO16 _gp_disp
+ 2c: 0399e021 addu gp,gp,t9
+
+00000030 <__start>:
+ 30: f400 0000 jal 0 .*
+ 30: R_MICROMIPS_26_S1 f1
+ 34: 0000 0000 nop
+ 38: f400 0000 jal 0 .*
+ 38: R_MICROMIPS_26_S1 f2
+ 3c: 0000 0000 nop
+ 40: f400 0000 jal 0 .*
+ 40: R_MICROMIPS_26_S1 f3
+ 44: 0000 0000 nop
+ \.\.\.
Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd 2016-08-10 20:45:05.614008484 +0100
@@ -0,0 +1,5 @@
+#...
+.*: 00000024 +12 +FUNC +GLOBAL +DEFAULT +\[MIPS PIC\] .* f3
+.*: 00000030 +24 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* __start
+.*: 00000016 +14 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS, MIPS PIC\] .* f2
+.*: 00000000 +22 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS, MIPS PIC\] .* f1
Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd 2016-08-10 20:45:05.633226287 +0100
@@ -0,0 +1,48 @@
+
+.*
+
+Disassembly of section \.text:
+
+00041000 <\.pic\.f3>:
+ 41000: 3c190004 lui t9,0x4
+ 41004: 08010415 j 41054 <f3>
+ 41008: 27391054 addiu t9,t9,4180
+ 4100c: 00000000 nop
+
+00041010 <\.pic\.f2>:
+ 41010: 41b9 0004 lui t9,0x4
+ 41014: d402 0823 j 41046 <f2>
+ 41018: 3339 1047 addiu t9,t9,4167
+ \.\.\.
+
+00041028 <\.pic\.f1>:
+ 41028: 41b9 0004 lui t9,0x4
+ 4102c: 3339 1031 addiu t9,t9,4145
+
+00041030 <f1>:
+ 41030: 41bc 0002 lui gp,0x2
+ 41034: 339c 6fcf addiu gp,gp,28623
+ 41038: 033c e150 addu gp,gp,t9
+ 4103c: f001 0415 jalx 41054 <f3>
+ 41040: 0000 0000 nop
+ 41044: 45bf jrc ra
+
+00041046 <f2>:
+ 41046: 41bc 0002 lui gp,0x2
+ 4104a: 339c 6fb9 addiu gp,gp,28601
+ 4104e: 033c e150 addu gp,gp,t9
+ 41052: 45bf jrc ra
+
+00041054 <f3>:
+ 41054: 3c1c0002 lui gp,0x2
+ 41058: 279c6fac addiu gp,gp,28588
+ 4105c: 0399e021 addu gp,gp,t9
+
+00041060 <__start>:
+ 41060: f402 0814 jal 41028 <\.pic\.f1>
+ 41064: 0000 0000 nop
+ 41068: f402 0808 jal 41010 <\.pic\.f2>
+ 4106c: 0000 0000 nop
+ 41070: f001 0400 jalx 41000 <\.pic\.f3>
+ 41074: 0000 0000 nop
+ \.\.\.
Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd 2016-08-10 20:45:05.656425528 +0100
@@ -0,0 +1,8 @@
+#...
+.*: 00068000 +0 +NOTYPE +LOCAL +DEFAULT +ABS _gp
+.*: 00041028 +8 +FUNC +LOCAL +DEFAULT +\[MICROMIPS\] .* .pic.f1
+.*: 00041010 +16 +FUNC +LOCAL +DEFAULT +\[MICROMIPS\] .* .pic.f2
+.*: 00041054 +12 +FUNC +GLOBAL +DEFAULT .* f3
+.*: 00041060 +24 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* __start
+.*: 00041046 +14 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* f2
+.*: 00041030 +22 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* f1
Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s 2016-08-10 20:45:05.682724773 +0100
@@ -0,0 +1,31 @@
+ .abicalls
+ .global f1
+ .global f2
+ .global f3
+ .set micromips
+ .ent f1
+f1:
+ .set noreorder
+ .cpload $25
+ .set reorder
+ .option pic0
+ jal f3
+ .option pic2
+ jr $31
+ .end f1
+
+ .ent f2
+f2:
+ .set noreorder
+ .cpload $25
+ .set reorder
+ jr $31
+ .end f2
+
+ .set nomicromips
+ .ent f3
+f3:
+ .set noreorder
+ .cpload $25
+ .set reorder
+ .end f3
Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s 2016-08-10 20:45:05.699949948 +0100
@@ -0,0 +1,10 @@
+ .abicalls
+ .option pic0
+ .global __start
+ .set micromips
+ .ent __start
+__start:
+ jal f1
+ jal f2
+ jal f3
+ .end __start