* ld-mips-elf/export-class-call16-o32.dd: New test.
authorMaciej W. Rozycki <macro@linux-mips.org>
Mon, 13 Aug 2012 19:52:59 +0000 (19:52 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Mon, 13 Aug 2012 19:52:59 +0000 (19:52 +0000)
* 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.

14 files changed:
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/export-class-call16-def.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-n32.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-n32.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-n32.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-n64.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-n64.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-n64.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-o32-irix.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-o32.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-o32.gd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16-o32.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/export-class-call16.ld [new file with mode: 0644]
ld/testsuite/ld-mips-elf/mips-elf.exp

index b5f0e0cb5552c3ed1b297ddb4151481365b28da9..34edbe10efc3df9dd478efd67c63c21211815cfd 100644 (file)
@@ -1,3 +1,19 @@
+2012-08-13  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * 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.
+
 2012-08-13  Ian Bolton  <ian.bolton@arm.com>
             Laurent Desnogues  <laurent.desnogues@arm.com>
             Jim MacArthur  <jim.macarthur@arm.com>
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-def.s b/ld/testsuite/ld-mips-elf/export-class-call16-def.s
new file mode 100644 (file)
index 0000000..ce82f22
--- /dev/null
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd b/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd
new file mode 100644 (file)
index 0000000..a033972
--- /dev/null
@@ -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
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n32.gd b/ld/testsuite/ld-mips-elf/export-class-call16-n32.gd
new file mode 100644 (file)
index 0000000..63f4a7b
--- /dev/null
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n32.s b/ld/testsuite/ld-mips-elf/export-class-call16-n32.s
new file mode 100644 (file)
index 0000000..325e93c
--- /dev/null
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd b/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd
new file mode 100644 (file)
index 0000000..7b481aa
--- /dev/null
@@ -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
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n64.gd b/ld/testsuite/ld-mips-elf/export-class-call16-n64.gd
new file mode 100644 (file)
index 0000000..a7ab2da
--- /dev/null
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n64.s b/ld/testsuite/ld-mips-elf/export-class-call16-n64.s
new file mode 100644 (file)
index 0000000..bc064af
--- /dev/null
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-o32-irix.dd b/ld/testsuite/ld-mips-elf/export-class-call16-o32-irix.dd
new file mode 100644 (file)
index 0000000..cb0d2f2
--- /dev/null
@@ -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
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd b/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd
new file mode 100644 (file)
index 0000000..616af2f
--- /dev/null
@@ -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
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-o32.gd b/ld/testsuite/ld-mips-elf/export-class-call16-o32.gd
new file mode 100644 (file)
index 0000000..63f4a7b
--- /dev/null
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-o32.s b/ld/testsuite/ld-mips-elf/export-class-call16-o32.s
new file mode 100644 (file)
index 0000000..548395c
--- /dev/null
@@ -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
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16.ld b/ld/testsuite/ld-mips-elf/export-class-call16.ld
new file mode 100644 (file)
index 0000000..39f6367
--- /dev/null
@@ -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 e4717e7fae8a2ee5096a5ddc8f56d9ca2ab22f76..62c6cb0593f5ef5dff532643844feb4500c6d187 100644 (file)
@@ -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"]]
+}