This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] MIPS/LD/testsuite: Verify microMIPS LA25 stub generation


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0375b0a53725b5b0bddcf8d31b707909f91afcb0

commit 0375b0a53725b5b0bddcf8d31b707909f91afcb0
Author: Maciej W. Rozycki <macro@imgtec.com>
Date:   Wed Aug 10 22:10:30 2016 +0100

    MIPS/LD/testsuite: Verify microMIPS LA25 stub generation
    
    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.

Diff:
---
 ld/ChangeLog                                       | 14 +++++++
 ld/testsuite/ld-mips-elf/mips-elf.exp              | 38 +++++++++++++++++
 .../ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd  | 42 +++++++++++++++++++
 .../ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd  |  5 +++
 .../ld-mips-elf/pic-and-nonpic-1-micromips.dd      | 48 ++++++++++++++++++++++
 .../ld-mips-elf/pic-and-nonpic-1-micromips.nd      |  8 ++++
 .../ld-mips-elf/pic-and-nonpic-1a-micromips.s      | 31 ++++++++++++++
 .../ld-mips-elf/pic-and-nonpic-1b-micromips.s      | 10 +++++
 8 files changed, 196 insertions(+)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index cc7d915..62970c7 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,17 @@
+2016-08-10  Maciej W. Rozycki  <macro@imgtec.com>
+
+	* 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.
+
 2016-08-09  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/20436
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 731f419..9696156 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -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 {
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd
new file mode 100644
index 0000000..6478aea
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd
@@ -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
+	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd
new file mode 100644
index 0000000..c219cad
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd
new file mode 100644
index 0000000..96801c1
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd
@@ -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
+	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd
new file mode 100644
index 0000000..73397e3
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s
new file mode 100644
index 0000000..6fe04ef
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s
new file mode 100644
index 0000000..1eff309
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s
@@ -0,0 +1,10 @@
+	.abicalls
+	.option	pic0
+	.global	__start
+	.set	micromips
+	.ent	__start
+__start:
+	jal	f1
+	jal	f2
+	jal	f3
+	.end	__start


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]