From 125b5bac9860b55e2065cebf8f36dada6da0c8a5 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Sat, 27 Jul 2013 22:21:11 +0000 Subject: bfd/ * elf32-vax.c (elf_vax_check_relocs) : Don't check symbol visibility here. Remove a check already asserted for. (elf_vax_instantiate_got_entries): Use SYMBOL_REFERENCES_LOCAL instead of individual checks. (elf_vax_relocate_section) : Only check the offset to decide if produce a GOT or PLT entry. Remove redundant assertions. Remove code to produce GOT entries for local symbols. Remove a duplicate comment and add a comment on GOT relocations. (elf_vax_finish_dynamic_symbol): Remove code to produce RELATIVE dynamic relocs. ld/testsuite/ * ld-vax-elf/got-local-exe.xd: New test. * ld-vax-elf/got-local-lib.xd: New test. * ld-vax-elf/got-local-aux.s: New test source. * ld-vax-elf/got-local-def.s: New test source. * ld-vax-elf/got-local-ref.s: New test source. * ld-vax-elf/vax-elf.exp: Run the new tests. --- ld/testsuite/ChangeLog | 9 +++++++++ ld/testsuite/ld-vax-elf/got-local-aux.s | 5 +++++ ld/testsuite/ld-vax-elf/got-local-def.s | 12 +++++++++++ ld/testsuite/ld-vax-elf/got-local-exe.xd | 4 ++++ ld/testsuite/ld-vax-elf/got-local-lib.xd | 4 ++++ ld/testsuite/ld-vax-elf/got-local-ref.s | 10 ++++++++++ ld/testsuite/ld-vax-elf/vax-elf.exp | 34 ++++++++++++++++++++++++++++++++ 7 files changed, 78 insertions(+) create mode 100644 ld/testsuite/ld-vax-elf/got-local-aux.s create mode 100644 ld/testsuite/ld-vax-elf/got-local-def.s create mode 100644 ld/testsuite/ld-vax-elf/got-local-exe.xd create mode 100644 ld/testsuite/ld-vax-elf/got-local-lib.xd create mode 100644 ld/testsuite/ld-vax-elf/got-local-ref.s (limited to 'ld') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index ae6a722..947ea0e 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2013-07-27 Maciej W. Rozycki + + * ld-vax-elf/got-local-exe.xd: New test. + * ld-vax-elf/got-local-lib.xd: New test. + * ld-vax-elf/got-local-aux.s: New test source. + * ld-vax-elf/got-local-def.s: New test source. + * ld-vax-elf/got-local-ref.s: New test source. + * ld-vax-elf/vax-elf.exp: Run the new tests. + 2013-07-24 H.J. Lu PR ld/15762 diff --git a/ld/testsuite/ld-vax-elf/got-local-aux.s b/ld/testsuite/ld-vax-elf/got-local-aux.s new file mode 100644 index 0000000..275e6fa --- /dev/null +++ b/ld/testsuite/ld-vax-elf/got-local-aux.s @@ -0,0 +1,5 @@ + .globl baz + .type baz, @object +baz: + .byte 0 + .size baz, . - baz diff --git a/ld/testsuite/ld-vax-elf/got-local-def.s b/ld/testsuite/ld-vax-elf/got-local-def.s new file mode 100644 index 0000000..c30c7c5 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/got-local-def.s @@ -0,0 +1,12 @@ + .data + .globl bar_hidden + .type bar_hidden, @object + .hidden bar_hidden +bar_hidden: + .byte 0 + .size bar_hidden, . - bar_hidden + .globl bar_visible + .type bar_visible, @object +bar_visible: + .byte 0 + .size bar_visible, . - bar_visible diff --git a/ld/testsuite/ld-vax-elf/got-local-exe.xd b/ld/testsuite/ld-vax-elf/got-local-exe.xd new file mode 100644 index 0000000..ace48f4 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/got-local-exe.xd @@ -0,0 +1,4 @@ +# Make sure there's only one GOT entry, for the symbol defined externally. +Hex dump of section '\.got': + 0x[0-9a-f]+ ........ 00000000 00000000 00000000 .* + 0x[0-9a-f]+ 00000000 .* diff --git a/ld/testsuite/ld-vax-elf/got-local-lib.xd b/ld/testsuite/ld-vax-elf/got-local-lib.xd new file mode 100644 index 0000000..24edda9 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/got-local-lib.xd @@ -0,0 +1,4 @@ +# Make sure there are only two GOT entries, for the preemptible symbols. +Hex dump of section '\.got': + 0x[0-9a-f]+ ........ 00000000 00000000 00000000 .* + 0x[0-9a-f]+ 00000000 00000000 .* diff --git a/ld/testsuite/ld-vax-elf/got-local-ref.s b/ld/testsuite/ld-vax-elf/got-local-ref.s new file mode 100644 index 0000000..f950531 --- /dev/null +++ b/ld/testsuite/ld-vax-elf/got-local-ref.s @@ -0,0 +1,10 @@ + .text + .globl foo + .type foo, @function +foo: + .word 0 + movab bar_hidden, %r0 + movab bar_visible, %r1 + movab baz, %r2 + ret + .size foo, . - foo diff --git a/ld/testsuite/ld-vax-elf/vax-elf.exp b/ld/testsuite/ld-vax-elf/vax-elf.exp index 6941953..ae5d9ef 100644 --- a/ld/testsuite/ld-vax-elf/vax-elf.exp +++ b/ld/testsuite/ld-vax-elf/vax-elf.exp @@ -48,3 +48,37 @@ run_ld_link_tests [list \ { plt-local.s } \ { { objdump -d plt-local.dd } } \ "plt-local"]] + +# Global offset table tests. Make sure hidden symbols do not get GOT +# assignments. +run_ld_link_tests [list \ + [list "GOT test (auxiliary shared library)" \ + "-shared" "" \ + "-k" \ + { got-local-aux.s } \ + {} \ + "got-local-aux.so"] \ + [list "GOT test (object 1)" \ + "-r" "" \ + "-k" \ + { got-local-ref.s } \ + {} \ + "got-local-ref-r.o"] \ + [list "GOT test (object 2)" \ + "-r" "" \ + "-k" \ + { got-local-def.s } \ + {} \ + "got-local-def-r.o"] \ + [list "GOT test (executable)" \ + "-e 0 tmpdir/got-local-aux.so tmpdir/got-local-ref-r.o tmpdir/got-local-def-r.o" "" \ + "" \ + {} \ + { { readelf "-x .got" got-local-exe.xd } } \ + "got-local-exe"] \ + [list "GOT test (shared library)" \ + "-shared tmpdir/got-local-aux.so tmpdir/got-local-ref-r.o tmpdir/got-local-def-r.o" "" \ + "" \ + {} \ + { { readelf "-x .got" got-local-lib.xd } } \ + "got-local-lib.so"]] -- cgit v1.1