* ld-elf/provide-hidden-s.nd: New test.
authorMaciej W. Rozycki <macro@linux-mips.org>
Fri, 3 May 2013 14:57:15 +0000 (14:57 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Fri, 3 May 2013 14:57:15 +0000 (14:57 +0000)
* 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.

16 files changed:
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/provide-hidden-1.ld [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-1.s [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-2.ld [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-2.s [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-3.s [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-4.s [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-abs.nd [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-def.nd [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-dyn.nd [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-dynabs.nd [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-dynsec.nd [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-s.ld [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-s.nd [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden-sec.nd [new file with mode: 0644]
ld/testsuite/ld-elf/provide-hidden.exp [new file with mode: 0644]

index 7b2e5067a1c24d5a854b64dbd0317e7e5bff3c5a..4b8645b71208dbc0427258ca5fb81e176eb56f9e 100644 (file)
@@ -1,3 +1,21 @@
+2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * 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  <nickc@redhat.com>
 
        * 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 (file)
index 0000000..47cdbb7
--- /dev/null
@@ -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 (file)
index 0000000..c845ffb
--- /dev/null
@@ -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 (file)
index 0000000..0b04c49
--- /dev/null
@@ -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 (file)
index 0000000..bbaa7de
--- /dev/null
@@ -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 (file)
index 0000000..9413280
--- /dev/null
@@ -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 (file)
index 0000000..2d8f37e
--- /dev/null
@@ -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 (file)
index 0000000..642a7a0
--- /dev/null
@@ -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 (file)
index 0000000..d4355c8
--- /dev/null
@@ -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 (file)
index 0000000..230f7fd
--- /dev/null
@@ -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 (file)
index 0000000..86e3adc
--- /dev/null
@@ -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 (file)
index 0000000..716dfa1
--- /dev/null
@@ -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 (file)
index 0000000..cca804f
--- /dev/null
@@ -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 (file)
index 0000000..4fd2cc5
--- /dev/null
@@ -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 (file)
index 0000000..f155d66
--- /dev/null
@@ -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 (file)
index 0000000..7246d11
--- /dev/null
@@ -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 <macro@codesourcery.com>
+#
+
+# 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"]]