[PATCH 3/3] MIPS/LD/test: Protected symbol relocation processing

Maciej W. Rozycki macro@codesourcery.com
Thu Aug 9 01:28:00 GMT 2012


Hi,

 This set of test cases complements the protected symbol relocation 
processing and IRIX DT_MIPS_OPTIONS processing fixes previously posted.  
No failures with the usual set of 23 MIPS targets.  OK to apply?

2012-08-08  Maciej W. Rozycki  <macro@codesourcery.com>

	ld/testsuite/
	* ld-mips-elf/export-class-call16-o32.dd: New test.
	* ld-mips-elf/export-class-call16-o32-irix.dd: New test.
	* ld-mips-elf/export-class-call16-o32.gd: New test.
	* ld-mips-elf/export-class-call16-n32.dd: New test.
	* ld-mips-elf/export-class-call16-n32.gd: New test.
	* ld-mips-elf/export-class-call16-n64.dd: New test.
	* ld-mips-elf/export-class-call16-n64.gd: New test.
	* ld-mips-elf/export-class-call16-def.s: New test source.
	* ld-mips-elf/export-class-call16-o32.s: New test source.
	* ld-mips-elf/export-class-call16-n32.s: New test source.
	* ld-mips-elf/export-class-call16-n64.s: New test source.
	* ld-mips-elf/export-class-call16.ld: New test linker script.
	* ld-mips-elf/mips-elf.exp: Run the new tests.

  Maciej

binutils-bfd-mips-protected-call16-test.diff
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-def.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-def.s	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,22 @@
+	.text
+	.balign		16
+	.xdef		protected_foo
+	.protected	protected_foo
+	.ent		protected_foo
+protected_foo:
+	jr		$31
+	.end		protected_foo
+	.balign		16
+	.xdef		hidden_foo
+	.hidden		hidden_foo
+	.ent		hidden_foo
+hidden_foo:
+	jr		$31
+	.end		hidden_foo
+	.balign		16
+	.xdef		internal_foo
+	.internal	internal_foo
+	.ent		internal_foo
+internal_foo:
+	jr		$31
+	.end		internal_foo
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16.ld
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16.ld	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,16 @@
+ENTRY (foo);
+SECTIONS
+{
+  .text : { *(.text) }
+  HIDDEN (_gp = ALIGN(16) + 0x7ff0);
+  .got : { *(.got) }
+  .dynamic : { *(.dynamic) }
+  .hash : { *(.hash) }
+  .dynsym : { *(.dynsym) }
+  .dynstr : { *(.dynstr) }
+  .pdr : { *(.pdr) }
+  .shstrtab : { *(.shstrtab) }
+  .symtab : { *(.symtab) }
+  .strtab : { *(.strtab) }
+  /DISCARD/ : { *(*) }
+}
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n32.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n32.s	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,20 @@
+	.text
+	.balign		16
+	.xdef		foo
+	.ent		foo
+foo:
+	.frame		$29, 16, $31
+	.mask		0x90000000, -8
+	addiu		$29, -16
+	sd		$31, 8($29)
+	.cpsetup	$25, 0, foo
+	jal		protected_foo
+	jal		hidden_foo
+	jal		internal_foo
+	.cpreturn
+	ld		$31, 8($29)
+	addiu		$29, 16
+	jr		$31
+	.end		foo
+	.balign		4
+	.space		8
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n64.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n64.s	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,20 @@
+	.text
+	.balign		16
+	.xdef		foo
+	.ent		foo
+foo:
+	.frame		$29, 16, $31
+	.mask		0x90000000, -8
+	daddiu		$29, -16
+	sd		$31, 8($29)
+	.cpsetup	$25, 0, foo
+	jal		protected_foo
+	jal		hidden_foo
+	jal		internal_foo
+	.cpreturn
+	ld		$31, 8($29)
+	daddiu		$29, 16
+	jr		$31
+	.end		foo
+	.balign		4
+	.space		8
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32.s	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,22 @@
+	.text
+	.balign		16
+	.xdef		foo
+	.ent		foo
+foo:
+	.frame		$29, 8, $31
+	.mask		0x80000000, -4
+	.set		noreorder
+	.cpload		$25
+	.set		reorder
+	addiu		$29, -8
+	sw		$31, 4($29)
+	.cprestore	0
+	jal		protected_foo
+	jal		hidden_foo
+	jal		internal_foo
+	lw		$31, 4($29)
+	addiu		$29, 8
+	jr		$31
+	.end		foo
+	.balign		4
+	.space		8
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
--- binutils-fsf-trunk-quilt.orig/ld/testsuite/ld-mips-elf/mips-elf.exp	2012-08-08 22:03:56.000000000 +0100
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/mips-elf.exp	2012-08-08 22:25:08.671785439 +0100
@@ -648,3 +648,24 @@ if { $linux_gnu } {
 
 # MIPS16 and microMIPS interlinking test.
 run_dump_test "mips16-and-micromips"
+
+# Export class call relocation tests.
+set abis [concat o32 [expr {$has_newabi ? "n32 n64" : ""}]]
+foreach { abi } $abis {
+    set loadaddr [string map \
+	{o32 0x12340000 n32 0x12340000 n64 0x123456789abc0000} $abi]
+    set suff [subst \
+	[expr { [istarget *-*-irix*] \
+		? [string map {o32 o32-irix n32 n32 n64 n64} $abi] \
+		: $abi }]]
+    run_ld_link_tests [list \
+	[list \
+	    "MIPS export class call relocation test ($abi)" \
+	    "$abi_ldflags($abi) -shared -Ttext $loadaddr -T export-class-call16.ld" \
+	    "$abi_asflags($abi) -mips3 -KPIC" \
+	    [list export-class-call16-${abi}.s export-class-call16-def.s] \
+	    [list \
+		"objdump -d export-class-call16-${suff}.dd" \
+		"readelf -A export-class-call16-${abi}.gd"] \
+	    "export-class-call16-${abi}.so"]]
+}
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,41 @@
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+12340000 <foo>:
+12340000:	27bdfff0 	addiu	sp,sp,-16
+12340004:	ffbf0008 	sd	ra,8\(sp\)
+12340008:	ffbc0000 	sd	gp,0\(sp\)
+1234000c:	3c1c0001 	lui	gp,0x1
+12340010:	279c8080 	addiu	gp,gp,-32640
+12340014:	0399e021 	addu	gp,gp,t9
+12340018:	8f998018 	lw	t9,-32744\(gp\)
+1234001c:	04110010 	bal	12340060 <protected_foo>
+12340020:	00000000 	nop
+12340024:	8f99801c 	lw	t9,-32740\(gp\)
+12340028:	04110011 	bal	12340070 <hidden_foo>
+1234002c:	00000000 	nop
+12340030:	8f998020 	lw	t9,-32736\(gp\)
+12340034:	04110012 	bal	12340080 <internal_foo>
+12340038:	00000000 	nop
+1234003c:	dfbc0000 	ld	gp,0\(sp\)
+12340040:	dfbf0008 	ld	ra,8\(sp\)
+12340044:	03e00008 	jr	ra
+12340048:	27bd0010 	addiu	sp,sp,16
+	\.\.\.
+
+12340060 <protected_foo>:
+12340060:	03e00008 	jr	ra
+12340064:	00000000 	nop
+	\.\.\.
+
+12340070 <hidden_foo>:
+12340070:	03e00008 	jr	ra
+12340074:	00000000 	nop
+	\.\.\.
+
+12340080 <internal_foo>:
+12340080:	03e00008 	jr	ra
+12340084:	00000000 	nop
+	\.\.\.
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n32.gd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n32.gd	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,14 @@
+
+Primary GOT:
+ Canonical gp value: 12348080
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  12340090 -32752\(gp\) 00000000 Lazy resolver
+  12340094 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  12340098 -32744\(gp\) 12340060
+  1234009c -32740\(gp\) 12340070
+  123400a0 -32736\(gp\) 12340080
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,41 @@
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+123456789abc0000 <foo>:
+123456789abc0000:	67bdfff0 	daddiu	sp,sp,-16
+123456789abc0004:	ffbf0008 	sd	ra,8\(sp\)
+123456789abc0008:	ffbc0000 	sd	gp,0\(sp\)
+123456789abc000c:	3c1c0001 	lui	gp,0x1
+123456789abc0010:	279c8080 	addiu	gp,gp,-32640
+123456789abc0014:	0399e02d 	daddu	gp,gp,t9
+123456789abc0018:	df998020 	ld	t9,-32736\(gp\)
+123456789abc001c:	04110010 	bal	123456789abc0060 <protected_foo>
+123456789abc0020:	00000000 	nop
+123456789abc0024:	df998028 	ld	t9,-32728\(gp\)
+123456789abc0028:	04110011 	bal	123456789abc0070 <hidden_foo>
+123456789abc002c:	00000000 	nop
+123456789abc0030:	df998030 	ld	t9,-32720\(gp\)
+123456789abc0034:	04110012 	bal	123456789abc0080 <internal_foo>
+123456789abc0038:	00000000 	nop
+123456789abc003c:	dfbc0000 	ld	gp,0\(sp\)
+123456789abc0040:	dfbf0008 	ld	ra,8\(sp\)
+123456789abc0044:	03e00008 	jr	ra
+123456789abc0048:	67bd0010 	daddiu	sp,sp,16
+	\.\.\.
+
+123456789abc0060 <protected_foo>:
+123456789abc0060:	03e00008 	jr	ra
+123456789abc0064:	00000000 	nop
+	\.\.\.
+
+123456789abc0070 <hidden_foo>:
+123456789abc0070:	03e00008 	jr	ra
+123456789abc0074:	00000000 	nop
+	\.\.\.
+
+123456789abc0080 <internal_foo>:
+123456789abc0080:	03e00008 	jr	ra
+123456789abc0084:	00000000 	nop
+	\.\.\.
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n64.gd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-n64.gd	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,14 @@
+
+Primary GOT:
+ Canonical gp value: 123456789abc8080
+
+ Reserved entries:
+           Address     Access          Initial Purpose
+  123456789abc0090 -32752\(gp\) 0000000000000000 Lazy resolver
+  123456789abc0098 -32744\(gp\) 8000000000000000 Module pointer \(GNU extension\)
+
+ Local entries:
+           Address     Access          Initial
+  123456789abc00a0 -32736\(gp\) 123456789abc0060
+  123456789abc00a8 -32728\(gp\) 123456789abc0070
+  123456789abc00b0 -32720\(gp\) 123456789abc0080
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32-irix.dd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32-irix.dd	2012-08-08 22:59:01.030570231 +0100
@@ -0,0 +1,43 @@
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+12340000 <foo>:
+12340000:	3c1c0001 	lui	gp,0x1
+12340004:	279c8080 	addiu	gp,gp,-32640
+12340008:	0399e021 	addu	gp,gp,t9
+1234000c:	27bdfff8 	addiu	sp,sp,-8
+12340010:	afbf0004 	sw	ra,4\(sp\)
+12340014:	afbc0000 	sw	gp,0\(sp\)
+12340018:	8f998018 	lw	t9,-32744\(gp\)
+1234001c:	0320f809 	jalr	t9
+12340020:	00000000 	nop
+12340024:	8fbc0000 	lw	gp,0\(sp\)
+12340028:	8f99801c 	lw	t9,-32740\(gp\)
+1234002c:	0320f809 	jalr	t9
+12340030:	00000000 	nop
+12340034:	8fbc0000 	lw	gp,0\(sp\)
+12340038:	8f998020 	lw	t9,-32736\(gp\)
+1234003c:	0320f809 	jalr	t9
+12340040:	00000000 	nop
+12340044:	8fbc0000 	lw	gp,0\(sp\)
+12340048:	8fbf0004 	lw	ra,4\(sp\)
+1234004c:	03e00008 	jr	ra
+12340050:	27bd0008 	addiu	sp,sp,8
+	\.\.\.
+
+12340060 <protected_foo>:
+12340060:	03e00008 	jr	ra
+12340064:	00000000 	nop
+	\.\.\.
+
+12340070 <hidden_foo>:
+12340070:	03e00008 	jr	ra
+12340074:	00000000 	nop
+	\.\.\.
+
+12340080 <internal_foo>:
+12340080:	03e00008 	jr	ra
+12340084:	00000000 	nop
+	\.\.\.
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,43 @@
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+12340000 <foo>:
+12340000:	3c1c0001 	lui	gp,0x1
+12340004:	279c8080 	addiu	gp,gp,-32640
+12340008:	0399e021 	addu	gp,gp,t9
+1234000c:	27bdfff8 	addiu	sp,sp,-8
+12340010:	afbf0004 	sw	ra,4\(sp\)
+12340014:	afbc0000 	sw	gp,0\(sp\)
+12340018:	8f998018 	lw	t9,-32744\(gp\)
+1234001c:	04110010 	bal	12340060 <protected_foo>
+12340020:	00000000 	nop
+12340024:	8fbc0000 	lw	gp,0\(sp\)
+12340028:	8f99801c 	lw	t9,-32740\(gp\)
+1234002c:	04110010 	bal	12340070 <hidden_foo>
+12340030:	00000000 	nop
+12340034:	8fbc0000 	lw	gp,0\(sp\)
+12340038:	8f998020 	lw	t9,-32736\(gp\)
+1234003c:	04110010 	bal	12340080 <internal_foo>
+12340040:	00000000 	nop
+12340044:	8fbc0000 	lw	gp,0\(sp\)
+12340048:	8fbf0004 	lw	ra,4\(sp\)
+1234004c:	03e00008 	jr	ra
+12340050:	27bd0008 	addiu	sp,sp,8
+	\.\.\.
+
+12340060 <protected_foo>:
+12340060:	03e00008 	jr	ra
+12340064:	00000000 	nop
+	\.\.\.
+
+12340070 <hidden_foo>:
+12340070:	03e00008 	jr	ra
+12340074:	00000000 	nop
+	\.\.\.
+
+12340080 <internal_foo>:
+12340080:	03e00008 	jr	ra
+12340084:	00000000 	nop
+	\.\.\.
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32.gd
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/export-class-call16-o32.gd	2012-08-08 22:25:08.671785439 +0100
@@ -0,0 +1,14 @@
+
+Primary GOT:
+ Canonical gp value: 12348080
+
+ Reserved entries:
+   Address     Access  Initial Purpose
+  12340090 -32752\(gp\) 00000000 Lazy resolver
+  12340094 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+   Address     Access  Initial
+  12340098 -32744\(gp\) 12340060
+  1234009c -32740\(gp\) 12340070
+  123400a0 -32736\(gp\) 12340080



More information about the Binutils mailing list