From c9606f65f6d78fae833d05032efbec6b2cf1e0f9 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Fri, 3 May 2013 14:57:15 +0000 Subject: [PATCH] * ld-elf/provide-hidden-s.nd: New test. * ld-elf/provide-hidden-abs.nd: New test. * ld-elf/provide-hidden-def.nd: New test. * ld-elf/provide-hidden-dyn.nd: New test. * ld-elf/provide-hidden-sec.nd: New test. * ld-elf/provide-hidden-dynabs.nd: New test. * ld-elf/provide-hidden-dynsec.nd: New test. * ld-elf/provide-hidden-s.ld: New test linker script. * ld-elf/provide-hidden-1.ld: New test linker script. * ld-elf/provide-hidden-2.ld: New test linker script. * ld-elf/provide-hidden-1.s: New test source. * ld-elf/provide-hidden-2.s: New test source. * ld-elf/provide-hidden-3.s: New test source. * ld-elf/provide-hidden-4.s: New test source. * ld-elf/provide-hidden.exp: New test script. --- ld/testsuite/ChangeLog | 18 +++ ld/testsuite/ld-elf/provide-hidden-1.ld | 15 ++ ld/testsuite/ld-elf/provide-hidden-1.s | 4 + ld/testsuite/ld-elf/provide-hidden-2.ld | 12 ++ ld/testsuite/ld-elf/provide-hidden-2.s | 5 + ld/testsuite/ld-elf/provide-hidden-3.s | 4 + ld/testsuite/ld-elf/provide-hidden-4.s | 5 + ld/testsuite/ld-elf/provide-hidden-abs.nd | 5 + ld/testsuite/ld-elf/provide-hidden-def.nd | 5 + ld/testsuite/ld-elf/provide-hidden-dyn.nd | 7 + ld/testsuite/ld-elf/provide-hidden-dynabs.nd | 8 + ld/testsuite/ld-elf/provide-hidden-dynsec.nd | 8 + ld/testsuite/ld-elf/provide-hidden-s.ld | 11 ++ ld/testsuite/ld-elf/provide-hidden-s.nd | 8 + ld/testsuite/ld-elf/provide-hidden-sec.nd | 5 + ld/testsuite/ld-elf/provide-hidden.exp | 154 +++++++++++++++++++ 16 files changed, 274 insertions(+) create mode 100644 ld/testsuite/ld-elf/provide-hidden-1.ld create mode 100644 ld/testsuite/ld-elf/provide-hidden-1.s create mode 100644 ld/testsuite/ld-elf/provide-hidden-2.ld create mode 100644 ld/testsuite/ld-elf/provide-hidden-2.s create mode 100644 ld/testsuite/ld-elf/provide-hidden-3.s create mode 100644 ld/testsuite/ld-elf/provide-hidden-4.s create mode 100644 ld/testsuite/ld-elf/provide-hidden-abs.nd create mode 100644 ld/testsuite/ld-elf/provide-hidden-def.nd create mode 100644 ld/testsuite/ld-elf/provide-hidden-dyn.nd create mode 100644 ld/testsuite/ld-elf/provide-hidden-dynabs.nd create mode 100644 ld/testsuite/ld-elf/provide-hidden-dynsec.nd create mode 100644 ld/testsuite/ld-elf/provide-hidden-s.ld create mode 100644 ld/testsuite/ld-elf/provide-hidden-s.nd create mode 100644 ld/testsuite/ld-elf/provide-hidden-sec.nd create mode 100644 ld/testsuite/ld-elf/provide-hidden.exp diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 7b2e5067a1c..4b8645b7120 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2013-05-03 Maciej W. Rozycki + + * ld-elf/provide-hidden-s.nd: New test. + * ld-elf/provide-hidden-abs.nd: New test. + * ld-elf/provide-hidden-def.nd: New test. + * ld-elf/provide-hidden-dyn.nd: New test. + * ld-elf/provide-hidden-sec.nd: New test. + * ld-elf/provide-hidden-dynabs.nd: New test. + * ld-elf/provide-hidden-dynsec.nd: New test. + * ld-elf/provide-hidden-s.ld: New test linker script. + * ld-elf/provide-hidden-1.ld: New test linker script. + * ld-elf/provide-hidden-2.ld: New test linker script. + * ld-elf/provide-hidden-1.s: New test source. + * ld-elf/provide-hidden-2.s: New test source. + * ld-elf/provide-hidden-3.s: New test source. + * ld-elf/provide-hidden-4.s: New test source. + * ld-elf/provide-hidden.exp: New test script. + 2013-05-02 Nick Clifton * ld-elf/flags1.d: Expect this test to pass on the MSP430. diff --git a/ld/testsuite/ld-elf/provide-hidden-1.ld b/ld/testsuite/ld-elf/provide-hidden-1.ld new file mode 100644 index 00000000000..47cdbb7fa28 --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-1.ld @@ -0,0 +1,15 @@ +SECTIONS +{ + . = 0x12300000; + .data : + { + PROVIDE_HIDDEN (foo = . + 0x11100000); + *(.data) + } + .got : { *(.got) } + .interp : { *(.interp) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .dynamic : { *(.dynamic) } + .hash : { *(.hash) } +} diff --git a/ld/testsuite/ld-elf/provide-hidden-1.s b/ld/testsuite/ld-elf/provide-hidden-1.s new file mode 100644 index 00000000000..c845ffb9a86 --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-1.s @@ -0,0 +1,4 @@ + .data + .globl foo +foo: + .dc.a foo diff --git a/ld/testsuite/ld-elf/provide-hidden-2.ld b/ld/testsuite/ld-elf/provide-hidden-2.ld new file mode 100644 index 00000000000..0b04c49971d --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-2.ld @@ -0,0 +1,12 @@ +SECTIONS +{ + . = 0x12300000; + PROVIDE_HIDDEN (foo = . + 0x11100000); + .data : { *(.data) } + .got : { *(.got) } + .interp : { *(.interp) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .dynamic : { *(.dynamic) } + .hash : { *(.hash) } +} diff --git a/ld/testsuite/ld-elf/provide-hidden-2.s b/ld/testsuite/ld-elf/provide-hidden-2.s new file mode 100644 index 00000000000..bbaa7de5076 --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-2.s @@ -0,0 +1,5 @@ + .data + .globl foo + .internal foo +foo: + .dc.a foo diff --git a/ld/testsuite/ld-elf/provide-hidden-3.s b/ld/testsuite/ld-elf/provide-hidden-3.s new file mode 100644 index 00000000000..9413280631e --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-3.s @@ -0,0 +1,4 @@ + .data + .globl bar +bar: + .dc.a foo diff --git a/ld/testsuite/ld-elf/provide-hidden-4.s b/ld/testsuite/ld-elf/provide-hidden-4.s new file mode 100644 index 00000000000..2d8f37e6f1b --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-4.s @@ -0,0 +1,5 @@ + .data + .globl bar + .internal foo +bar: + .dc.a foo diff --git a/ld/testsuite/ld-elf/provide-hidden-abs.nd b/ld/testsuite/ld-elf/provide-hidden-abs.nd new file mode 100644 index 00000000000..642a7a0e4c8 --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-abs.nd @@ -0,0 +1,5 @@ +#... +Symbol table '\.symtab' contains [0-9]+ entries: +#... + *[0-9]+: 0*23400000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +ABS foo +#pass diff --git a/ld/testsuite/ld-elf/provide-hidden-def.nd b/ld/testsuite/ld-elf/provide-hidden-def.nd new file mode 100644 index 00000000000..d4355c80d81 --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-def.nd @@ -0,0 +1,5 @@ +#... +Symbol table '\.symtab' contains [0-9]+ entries: +#... + *[0-9]+: 0*12300000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +[0-9]+ foo +#pass diff --git a/ld/testsuite/ld-elf/provide-hidden-dyn.nd b/ld/testsuite/ld-elf/provide-hidden-dyn.nd new file mode 100644 index 00000000000..230f7fd7b0c --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-dyn.nd @@ -0,0 +1,7 @@ +#failif +Symbol table '\.dynsym' contains [0-9]+ entries: +#... +.* foo +#... +Symbol table '\.symtab' contains [0-9]+ entries: +#pass diff --git a/ld/testsuite/ld-elf/provide-hidden-dynabs.nd b/ld/testsuite/ld-elf/provide-hidden-dynabs.nd new file mode 100644 index 00000000000..86e3adcdf9e --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-dynabs.nd @@ -0,0 +1,8 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: +#... + *[0-9]+: 0*23400000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +ABS foo +#... +Symbol table '\.symtab' contains [0-9]+ entries: +#... + *[0-9]+: 0*23400000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +ABS foo +#pass diff --git a/ld/testsuite/ld-elf/provide-hidden-dynsec.nd b/ld/testsuite/ld-elf/provide-hidden-dynsec.nd new file mode 100644 index 00000000000..716dfa1f71c --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-dynsec.nd @@ -0,0 +1,8 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: +#... + *[0-9]+: 0*23400000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +[0-9]+ foo +#... +Symbol table '\.symtab' contains [0-9]+ entries: +#... + *[0-9]+: 0*23400000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +[0-9]+ foo +#pass diff --git a/ld/testsuite/ld-elf/provide-hidden-s.ld b/ld/testsuite/ld-elf/provide-hidden-s.ld new file mode 100644 index 00000000000..cca804f775f --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-s.ld @@ -0,0 +1,11 @@ +SECTIONS +{ + . = 0x12300000; + .data : { *(.data) } + .got : { *(.got) } + .interp : { *(.interp) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .dynamic : { *(.dynamic) } + .hash : { *(.hash) } +} diff --git a/ld/testsuite/ld-elf/provide-hidden-s.nd b/ld/testsuite/ld-elf/provide-hidden-s.nd new file mode 100644 index 00000000000..4fd2cc57b1b --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-s.nd @@ -0,0 +1,8 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: +#... + *[0-9]+: 0*12300000 +0 (?:NOTYPE|OBJECT) +GLOBAL +DEFAULT +[0-9]+ foo +#... +Symbol table '\.symtab' contains [0-9]+ entries: +#... + *[0-9]+: 0*12300000 +0 (?:NOTYPE|OBJECT) +GLOBAL +DEFAULT +[0-9]+ foo +#pass diff --git a/ld/testsuite/ld-elf/provide-hidden-sec.nd b/ld/testsuite/ld-elf/provide-hidden-sec.nd new file mode 100644 index 00000000000..f155d6696d5 --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden-sec.nd @@ -0,0 +1,5 @@ +#... +Symbol table '\.symtab' contains [0-9]+ entries: +#... + *[0-9]+: 0*23400000 +0 (?:NOTYPE|OBJECT) +LOCAL +DEFAULT +[0-9]+ foo +#pass diff --git a/ld/testsuite/ld-elf/provide-hidden.exp b/ld/testsuite/ld-elf/provide-hidden.exp new file mode 100644 index 00000000000..7246d110dbb --- /dev/null +++ b/ld/testsuite/ld-elf/provide-hidden.exp @@ -0,0 +1,154 @@ +# Expect script for the PROVIDE_HIDDEN linker script command. +# +# 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 +# + +# Export classes only make sense for ELF shared-library targets. +if { ![is_elf_format] || ![check_shared_lib_support] } { + return +} + +# This target requires extra GAS options when building code for shared +# libraries. +set AFLAGS_PIC "" +if [istarget "tic6x-*-*"] { + append AFLAGS_PIC " -mpic -mpid=near" +} + +set testname "PROVIDE_HIDDEN test" + +run_ld_link_tests [list \ + [list \ + "$testname (auxiliary shared object)" \ + "-shared -T provide-hidden-s.ld" "" \ + "$AFLAGS_PIC" \ + [list provide-hidden-1.s ] \ + [list "readelf -s provide-hidden-s.nd"] \ + "provide-hidden-s.so"]] + +run_ld_link_tests [list \ + [list \ + "$testname 1" \ + "-T provide-hidden-1.ld" "" \ + "" \ + [list provide-hidden-1.s] \ + [list \ + [list readelf -s provide-hidden-def.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-1"] \ + [list \ + "$testname 2" \ + "-T provide-hidden-1.ld" "" \ + "" \ + [list provide-hidden-2.s] \ + [list \ + [list readelf -s provide-hidden-def.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-2"] \ + [list \ + "$testname 3" \ + "-T provide-hidden-1.ld" "" \ + "" \ + [list provide-hidden-3.s] \ + [list \ + [list readelf -s provide-hidden-sec.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-3"] \ + [list \ + "$testname 4" \ + "-T provide-hidden-1.ld" "tmpdir/provide-hidden-s.so" \ + "" \ + [list provide-hidden-3.s] \ + [list "readelf -s provide-hidden-dynsec.nd"] \ + "provide-hidden-4"] \ + [list \ + "$testname 5" \ + "-T provide-hidden-1.ld" "" \ + "" \ + [list provide-hidden-4.s] \ + [list \ + [list readelf -s provide-hidden-sec.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-5"] \ + [list \ + "$testname 6" \ + "-T provide-hidden-1.ld" "tmpdir/provide-hidden-s.so" \ + "" \ + [list provide-hidden-4.s] \ + [list \ + [list readelf -s provide-hidden-sec.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-6"] \ + [list \ + "$testname 7" \ + "-T provide-hidden-2.ld" "" \ + "" \ + [list provide-hidden-1.s] \ + [list \ + [list readelf -s provide-hidden-def.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-7"] \ + [list \ + "$testname 8" \ + "-T provide-hidden-2.ld" "" \ + "" \ + [list provide-hidden-2.s] \ + [list \ + [list readelf -s provide-hidden-def.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-8"] \ + [list \ + "$testname 9" \ + "-T provide-hidden-2.ld" "" \ + "" \ + [list provide-hidden-3.s] \ + [list \ + [list readelf -s provide-hidden-abs.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-9"] \ + [list \ + "$testname 10" \ + "-T provide-hidden-2.ld" "tmpdir/provide-hidden-s.so" \ + "" \ + [list provide-hidden-3.s] \ + [list "readelf -s provide-hidden-dynabs.nd"] \ + "provide-hidden-10"] \ + [list \ + "$testname 11" \ + "-T provide-hidden-2.ld" "" \ + "" \ + [list provide-hidden-4.s] \ + [list \ + [list readelf -s provide-hidden-abs.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-11"] \ + [list \ + "$testname 12" \ + "-T provide-hidden-2.ld" "tmpdir/provide-hidden-s.so" \ + "" \ + [list provide-hidden-4.s] \ + [list \ + [list readelf -s provide-hidden-abs.nd] \ + [list readelf -s provide-hidden-dyn.nd]] \ + "provide-hidden-12"]] -- 2.30.2