From 9b11fa1a855f1b2b98b6a21c69fb96691e9b39a2 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 13 Aug 2012 19:52:59 +0000 Subject: [PATCH] * 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. --- ld/testsuite/ChangeLog | 16 +++++++ .../ld-mips-elf/export-class-call16-def.s | 22 ++++++++++ .../ld-mips-elf/export-class-call16-n32.dd | 41 ++++++++++++++++++ .../ld-mips-elf/export-class-call16-n32.gd | 14 ++++++ .../ld-mips-elf/export-class-call16-n32.s | 20 +++++++++ .../ld-mips-elf/export-class-call16-n64.dd | 41 ++++++++++++++++++ .../ld-mips-elf/export-class-call16-n64.gd | 14 ++++++ .../ld-mips-elf/export-class-call16-n64.s | 20 +++++++++ .../export-class-call16-o32-irix.dd | 43 +++++++++++++++++++ .../ld-mips-elf/export-class-call16-o32.dd | 43 +++++++++++++++++++ .../ld-mips-elf/export-class-call16-o32.gd | 14 ++++++ .../ld-mips-elf/export-class-call16-o32.s | 22 ++++++++++ .../ld-mips-elf/export-class-call16.ld | 16 +++++++ ld/testsuite/ld-mips-elf/mips-elf.exp | 21 +++++++++ 14 files changed, 347 insertions(+) create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-def.s create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-n32.dd create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-n32.gd create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-n32.s create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-n64.dd create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-n64.gd create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-n64.s create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-o32-irix.dd create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-o32.dd create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-o32.gd create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16-o32.s create mode 100644 ld/testsuite/ld-mips-elf/export-class-call16.ld diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index b5f0e0cb555..34edbe10efc 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2012-08-13 Maciej W. Rozycki + + * 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 Laurent Desnogues Jim MacArthur 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 index 00000000000..ce82f22f3ad --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-def.s @@ -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 index 00000000000..a033972a9d5 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd @@ -0,0 +1,41 @@ + +.*: +file format .*mips.* + +Disassembly of section \.text: + +12340000 : +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 +12340020: 00000000 nop +12340024: 8f99801c lw t9,-32740\(gp\) +12340028: 04110011 bal 12340070 +1234002c: 00000000 nop +12340030: 8f998020 lw t9,-32736\(gp\) +12340034: 04110012 bal 12340080 +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 : +12340060: 03e00008 jr ra +12340064: 00000000 nop + \.\.\. + +12340070 : +12340070: 03e00008 jr ra +12340074: 00000000 nop + \.\.\. + +12340080 : +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 index 00000000000..63f4a7b0249 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-n32.gd @@ -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 index 00000000000..325e93ce277 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-n32.s @@ -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 index 00000000000..7b481aaa015 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd @@ -0,0 +1,41 @@ + +.*: +file format .*mips.* + +Disassembly of section \.text: + +123456789abc0000 : +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 +123456789abc0020: 00000000 nop +123456789abc0024: df998028 ld t9,-32728\(gp\) +123456789abc0028: 04110011 bal 123456789abc0070 +123456789abc002c: 00000000 nop +123456789abc0030: df998030 ld t9,-32720\(gp\) +123456789abc0034: 04110012 bal 123456789abc0080 +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 : +123456789abc0060: 03e00008 jr ra +123456789abc0064: 00000000 nop + \.\.\. + +123456789abc0070 : +123456789abc0070: 03e00008 jr ra +123456789abc0074: 00000000 nop + \.\.\. + +123456789abc0080 : +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 index 00000000000..a7ab2da08be --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-n64.gd @@ -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 index 00000000000..bc064af58ac --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-n64.s @@ -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 index 00000000000..cb0d2f24bda --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-o32-irix.dd @@ -0,0 +1,43 @@ + +.*: +file format .*mips.* + +Disassembly of section \.text: + +12340000 : +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 : +12340060: 03e00008 jr ra +12340064: 00000000 nop + \.\.\. + +12340070 : +12340070: 03e00008 jr ra +12340074: 00000000 nop + \.\.\. + +12340080 : +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 index 00000000000..616af2fe0cf --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd @@ -0,0 +1,43 @@ + +.*: +file format .*mips.* + +Disassembly of section \.text: + +12340000 : +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 +12340020: 00000000 nop +12340024: 8fbc0000 lw gp,0\(sp\) +12340028: 8f99801c lw t9,-32740\(gp\) +1234002c: 04110010 bal 12340070 +12340030: 00000000 nop +12340034: 8fbc0000 lw gp,0\(sp\) +12340038: 8f998020 lw t9,-32736\(gp\) +1234003c: 04110010 bal 12340080 +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 : +12340060: 03e00008 jr ra +12340064: 00000000 nop + \.\.\. + +12340070 : +12340070: 03e00008 jr ra +12340074: 00000000 nop + \.\.\. + +12340080 : +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 index 00000000000..63f4a7b0249 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-o32.gd @@ -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 index 00000000000..548395c8c02 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16-o32.s @@ -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 index 00000000000..39f6367b509 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/export-class-call16.ld @@ -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/ : { *(*) } +} diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index e4717e7fae8..62c6cb0593f 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -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"]] +} -- 2.30.2