From 1581972d79ebd85e077a6beb849d6db6d4c2aac9 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Sat, 27 Jul 2013 22:28:29 +0000 Subject: [PATCH] * ld-vax-elf/export-class-call.dd: New test. * ld-vax-elf/export-class-call.rd: New test. * ld-vax-elf/export-class-call.xd: New test. * ld-vax-elf/export-class-data.dd: New test. * ld-vax-elf/export-class-data.rd: New test. * ld-vax-elf/export-class-data.xd: New test. * ld-vax-elf/export-class.ld: New test linker script. * ld-vax-elf/export-class-call.s: New test source. * ld-vax-elf/export-class-data.s: New test source. * ld-vax-elf/export-class-def.s: New test source. * ld-vax-elf/vax-elf.exp: Run the new tests. * ld-vax-elf/vax-export-class.rd: New test. * ld-vax-elf/vax-export-class.xd: New test. * ld-vax-elf/export-class.exp: New test script. --- ld/testsuite/ChangeLog | 17 +++++ ld/testsuite/ld-vax-elf/export-class-call.dd | 26 +++++++ ld/testsuite/ld-vax-elf/export-class-call.rd | 1 + ld/testsuite/ld-vax-elf/export-class-call.s | 10 +++ ld/testsuite/ld-vax-elf/export-class-call.xd | 2 + ld/testsuite/ld-vax-elf/export-class-data.dd | 26 +++++++ ld/testsuite/ld-vax-elf/export-class-data.rd | 3 + ld/testsuite/ld-vax-elf/export-class-data.s | 10 +++ ld/testsuite/ld-vax-elf/export-class-data.xd | 4 + ld/testsuite/ld-vax-elf/export-class-def.s | 22 ++++++ ld/testsuite/ld-vax-elf/export-class.exp | 80 ++++++++++++++++++++ ld/testsuite/ld-vax-elf/export-class.ld | 16 ++++ ld/testsuite/ld-vax-elf/vax-elf.exp | 23 ++++++ ld/testsuite/ld-vax-elf/vax-export-class.rd | 11 +++ ld/testsuite/ld-vax-elf/vax-export-class.xd | 11 +++ 15 files changed, 262 insertions(+) create mode 100644 ld/testsuite/ld-vax-elf/export-class-call.dd create mode 100644 ld/testsuite/ld-vax-elf/export-class-call.rd create mode 100644 ld/testsuite/ld-vax-elf/export-class-call.s create mode 100644 ld/testsuite/ld-vax-elf/export-class-call.xd create mode 100644 ld/testsuite/ld-vax-elf/export-class-data.dd create mode 100644 ld/testsuite/ld-vax-elf/export-class-data.rd create mode 100644 ld/testsuite/ld-vax-elf/export-class-data.s create mode 100644 ld/testsuite/ld-vax-elf/export-class-data.xd create mode 100644 ld/testsuite/ld-vax-elf/export-class-def.s create mode 100644 ld/testsuite/ld-vax-elf/export-class.exp create mode 100644 ld/testsuite/ld-vax-elf/export-class.ld create mode 100644 ld/testsuite/ld-vax-elf/vax-export-class.rd create mode 100644 ld/testsuite/ld-vax-elf/vax-export-class.xd diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 947ea0ef8e6..d58967ef158 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2013-07-27 Maciej W. Rozycki + + * ld-vax-elf/export-class-call.dd: New test. + * ld-vax-elf/export-class-call.rd: New test. + * ld-vax-elf/export-class-call.xd: New test. + * ld-vax-elf/export-class-data.dd: New test. + * ld-vax-elf/export-class-data.rd: New test. + * ld-vax-elf/export-class-data.xd: New test. + * ld-vax-elf/export-class.ld: New test linker script. + * ld-vax-elf/export-class-call.s: New test source. + * ld-vax-elf/export-class-data.s: New test source. + * ld-vax-elf/export-class-def.s: New test source. + * ld-vax-elf/vax-elf.exp: Run the new tests. + * ld-vax-elf/vax-export-class.rd: New test. + * ld-vax-elf/vax-export-class.xd: New test. + * ld-vax-elf/export-class.exp: New test script. + 2013-07-27 Maciej W. Rozycki * ld-vax-elf/got-local-exe.xd: New test. diff --git a/ld/testsuite/ld-vax-elf/export-class-call.dd b/ld/testsuite/ld-vax-elf/export-class-call.dd new file mode 100644 index 00000000000..c860d799fce --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-call.dd @@ -0,0 +1,26 @@ + +.*: +file format .*vax.* + +Disassembly of section \.text: + +12340000 : +12340000: 00 00 \.word 0x0000 # Entry mask: < > +12340002: fb 00 ef 0f calls \$0x0,12340018 +12340006: 00 00 00 +12340009: fb 00 ef 0b calls \$0x0,1234001b +1234000d: 00 00 00 +12340010: fb 00 ef 07 calls \$0x0,1234001e +12340014: 00 00 00 +12340017: 04 ret + +12340018 : +12340018: 00 00 \.word 0x0000 # Entry mask: < > +1234001a: 04 ret + +1234001b : +1234001b: 00 00 \.word 0x0000 # Entry mask: < > +1234001d: 04 ret + +1234001e : +1234001e: 00 00 \.word 0x0000 # Entry mask: < > +12340020: 04 ret diff --git a/ld/testsuite/ld-vax-elf/export-class-call.rd b/ld/testsuite/ld-vax-elf/export-class-call.rd new file mode 100644 index 00000000000..b852c168953 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-call.rd @@ -0,0 +1 @@ +There are no relocations in this file\. diff --git a/ld/testsuite/ld-vax-elf/export-class-call.s b/ld/testsuite/ld-vax-elf/export-class-call.s new file mode 100644 index 00000000000..14640450e6c --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-call.s @@ -0,0 +1,10 @@ + .text + .globl foo + .type foo, @function +foo: + .word 0 + calls $0, protected_foo + calls $0, hidden_foo + calls $0, internal_foo + ret + .size foo, . - foo diff --git a/ld/testsuite/ld-vax-elf/export-class-call.xd b/ld/testsuite/ld-vax-elf/export-class-call.xd new file mode 100644 index 00000000000..1f4ee9d6144 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-call.xd @@ -0,0 +1,2 @@ +Hex dump of section '\.got': + 0x12340024 34003412 00000000 00000000 00000000 .* diff --git a/ld/testsuite/ld-vax-elf/export-class-data.dd b/ld/testsuite/ld-vax-elf/export-class-data.dd new file mode 100644 index 00000000000..c2be30c3b03 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-data.dd @@ -0,0 +1,26 @@ + +.*: +file format .*vax.* + +Disassembly of section \.text: + +12340000 : +12340000: 00 00 \.word 0x0000 # Entry mask: < > +12340002: 9e ff 2c 00 movab \*12340034 <_GLOBAL_OFFSET_TABLE_\+0x10>,r0 +12340006: 00 00 50 +12340009: 9e ef 0c 00 movab 1234001b ,r0 +1234000d: 00 00 50 +12340010: 9e ef 08 00 movab 1234001e ,r0 +12340014: 00 00 50 +12340017: 04 ret + +12340018 : +12340018: 00 00 \.word 0x0000 # Entry mask: < > +1234001a: 04 ret + +1234001b : +1234001b: 00 00 \.word 0x0000 # Entry mask: < > +1234001d: 04 ret + +1234001e : +1234001e: 00 00 \.word 0x0000 # Entry mask: < > +12340020: 04 ret diff --git a/ld/testsuite/ld-vax-elf/export-class-data.rd b/ld/testsuite/ld-vax-elf/export-class-data.rd new file mode 100644 index 00000000000..aaac804a462 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-data.rd @@ -0,0 +1,3 @@ +Relocation section '\.rela\.got' at offset 0x[0-9a-f]+ contains 1 entries: + * Offset * Info * Type * Sym\. *Value * Sym\. * Name * \+ * Addend +12340034 [0-9a-f]+14 R_VAX_GLOB_DAT 12340018 protected_foo \+ 0 diff --git a/ld/testsuite/ld-vax-elf/export-class-data.s b/ld/testsuite/ld-vax-elf/export-class-data.s new file mode 100644 index 00000000000..fd7edf9b74f --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-data.s @@ -0,0 +1,10 @@ + .text + .globl foo + .type foo, @function +foo: + .word 0 + movab protected_foo, %r0 + movab hidden_foo, %r0 + movab internal_foo, %r0 + ret + .size foo, . - foo diff --git a/ld/testsuite/ld-vax-elf/export-class-data.xd b/ld/testsuite/ld-vax-elf/export-class-data.xd new file mode 100644 index 00000000000..f5d3c1b7396 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-data.xd @@ -0,0 +1,4 @@ +Hex dump of section '\.got': + NOTE: This section has relocations against it, but these have NOT been applied to this dump\. + 0x12340024 38003412 00000000 00000000 00000000 .* + 0x12340034 00000000 .* diff --git a/ld/testsuite/ld-vax-elf/export-class-def.s b/ld/testsuite/ld-vax-elf/export-class-def.s new file mode 100644 index 00000000000..a548dbfa28f --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class-def.s @@ -0,0 +1,22 @@ + .text + .globl protected_foo + .type protected_foo, @function + .protected protected_foo +protected_foo: + .word 0 + ret + .size protected_foo, . - protected_foo + .globl hidden_foo + .type hidden_foo, @function + .hidden hidden_foo +hidden_foo: + .word 0 + ret + .size hidden_foo, . - hidden_foo + .globl internal_foo + .type internal_foo, @function + .internal internal_foo +internal_foo: + .word 0 + ret + .size internal_foo, . - internal_foo diff --git a/ld/testsuite/ld-vax-elf/export-class.exp b/ld/testsuite/ld-vax-elf/export-class.exp new file mode 100644 index 00000000000..83df77011f9 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class.exp @@ -0,0 +1,80 @@ +# Expect script for symbol export classes, VAX variation. +# +# Copyright 2013 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# +# Written by Maciej W. Rozycki +# + +# Exclude non-Linux targets; feel free to include your favorite one +# if you like. +if { ![istarget vax*-*-linux*] } { + return +} + +set testname "VAX symbol export class test" + +# Build an auxiliary shared object with conflicting versioned symbol +# definitions. +run_ld_link_tests [list \ + [list \ + "$testname (auxiliary shared object)" \ + "-shared -version-script ../ld-elf/export-class-lib.ver" "" \ + "-k" \ + { ../ld-elf/export-class-lib.s } \ + {} \ + "vax-export-class-lib.so" \ + ] \ +] + +# Build a static object that pulls symbol definitions. It has to come +# first before the auxiliary shared object and other static objects on +# the linker's command line and hence we need to build it separately. +run_ld_link_tests [list \ + [list \ + "$testname (initial static object)" \ + "-r" "" \ + "" \ + { ../ld-elf/export-class-ref.s } \ + {} \ + "vax-export-class-ref-r.o" \ + ] \ +] + +# Build static objects that satisfy symbol dependencies and preempt +# shared-object symbol definitions, and link all the objects built into +# the final shared object. The command-line order of objects linked is +# important to make sure the linker correctly preempts versioned symbols +# from the auxiliary shared object and is as follows: ref, lib, dep, def. +# Get a dump to make sure symbol dependencies are resolved internally. +run_ld_link_tests [list \ + [list \ + "$testname (final shared object)" \ + "-shared -Tdata=0x12340000 tmpdir/vax-export-class-ref-r.o tmpdir/vax-export-class-lib.so" "" \ + "-k" \ + { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \ + [list \ + [list readelf -r vax-export-class.rd] \ + [list readelf "-x .data" vax-export-class.xd] \ + ] \ + "vax-export-class.so" \ + ] \ +] diff --git a/ld/testsuite/ld-vax-elf/export-class.ld b/ld/testsuite/ld-vax-elf/export-class.ld new file mode 100644 index 00000000000..054d044d4a6 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/export-class.ld @@ -0,0 +1,16 @@ +ENTRY (foo); +SECTIONS +{ + .text : { *(.text) } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + .rela.got : { *(.rela.got) } + .plt : { *(.plt) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .shstrtab : { *(.shstrtab) } + .symtab : { *(.symtab) } + .strtab : { *(.strtab) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-vax-elf/vax-elf.exp b/ld/testsuite/ld-vax-elf/vax-elf.exp index ae5d9ef24b7..440e2dadcbb 100644 --- a/ld/testsuite/ld-vax-elf/vax-elf.exp +++ b/ld/testsuite/ld-vax-elf/vax-elf.exp @@ -82,3 +82,26 @@ run_ld_link_tests [list \ {} \ { { readelf "-x .got" got-local-lib.xd } } \ "got-local-lib.so"]] + +# Export class relocation tests. +run_ld_link_tests [list \ + [list \ + "VAX export class call relocation test" \ + "-shared -Ttext 0x12340000 -T export-class.ld" "" \ + "-k" \ + [list export-class-call.s export-class-def.s] \ + [list \ + [list objdump -d export-class-call.dd] \ + [list readelf -r export-class-call.rd] \ + [list readelf "-x .got" export-class-call.xd]] \ + "export-class-call.so"] \ + [list \ + "VAX export class data relocation test" \ + "-shared -Ttext 0x12340000 -T export-class.ld" "" \ + "-k" \ + [list export-class-data.s export-class-def.s] \ + [list \ + [list objdump -d export-class-data.dd] \ + [list readelf -r export-class-data.rd] \ + [list readelf "-x .got" export-class-data.xd]] \ + "export-class-data.so"]] diff --git a/ld/testsuite/ld-vax-elf/vax-export-class.rd b/ld/testsuite/ld-vax-elf/vax-export-class.rd new file mode 100644 index 00000000000..844a0f46961 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/vax-export-class.rd @@ -0,0 +1,11 @@ +Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains [0-9]+ entries: + * Offset * Info * Type * Sym\. *Value * Sym\. * Name * \+ * Addend +12340010 00000016 R_VAX_RELATIVE * 123400a0 +12340020 00000016 R_VAX_RELATIVE * 123400a0 +12340060 00000016 R_VAX_RELATIVE * 123400a0 +12340070 00000016 R_VAX_RELATIVE * 123400a0 +12340080 00000016 R_VAX_RELATIVE * 123400a0 +12340090 00000016 R_VAX_RELATIVE * 123400a0 +12340000 [0-9a-f]+01 R_VAX_32 * 123400a0 protected_baz \+ 0 +12340040 [0-9a-f]+01 R_VAX_32 * 123400a0 protected_foo \+ 0 +12340050 [0-9a-f]+01 R_VAX_32 * 123400a0 protected_bar \+ 0 diff --git a/ld/testsuite/ld-vax-elf/vax-export-class.xd b/ld/testsuite/ld-vax-elf/vax-export-class.xd new file mode 100644 index 00000000000..a797f206940 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/vax-export-class.xd @@ -0,0 +1,11 @@ +Hex dump of section '\.data': + 0x12340000 00000000 00000000 00000000 00000000 .* + 0x12340010 a0003412 00000000 00000000 00000000 .* + 0x12340020 a0003412 00000000 00000000 00000000 .* + 0x12340030 00000000 00000000 00000000 00000000 .* + 0x12340040 00000000 00000000 00000000 00000000 .* + 0x12340050 00000000 00000000 00000000 00000000 .* + 0x12340060 a0003412 00000000 00000000 00000000 .* + 0x12340070 a0003412 00000000 00000000 00000000 .* + 0x12340080 a0003412 00000000 00000000 00000000 .* + 0x12340090 a0003412 00000000 00000000 00000000 .* -- 2.30.2