aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2013-05-03 14:57:15 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2013-05-03 14:57:15 +0000
commitc9606f65f6d78fae833d05032efbec6b2cf1e0f9 (patch)
tree1fff48fb5fc6587cac865fa5c7e3ea74208862a0 /ld
parent3fd5675a52b5b76475df3aeddc405974ca59957f (diff)
downloadgdb-c9606f65f6d78fae833d05032efbec6b2cf1e0f9.zip
gdb-c9606f65f6d78fae833d05032efbec6b2cf1e0f9.tar.gz
gdb-c9606f65f6d78fae833d05032efbec6b2cf1e0f9.tar.bz2
* 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.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog18
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-1.ld15
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-1.s4
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-2.ld12
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-2.s5
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-3.s4
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-4.s5
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-abs.nd5
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-def.nd5
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-dyn.nd7
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-dynabs.nd8
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-dynsec.nd8
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-s.ld11
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-s.nd8
-rw-r--r--ld/testsuite/ld-elf/provide-hidden-sec.nd5
-rw-r--r--ld/testsuite/ld-elf/provide-hidden.exp154
16 files changed, 274 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7b2e506..4b8645b 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -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
index 0000000..47cdbb7
--- /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 0000000..c845ffb
--- /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 0000000..0b04c49
--- /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 0000000..bbaa7de
--- /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 0000000..9413280
--- /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 0000000..2d8f37e
--- /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 0000000..642a7a0
--- /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 0000000..d4355c8
--- /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 0000000..230f7fd
--- /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 0000000..86e3adc
--- /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 0000000..716dfa1
--- /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 0000000..cca804f
--- /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 0000000..4fd2cc5
--- /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 0000000..f155d66
--- /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 0000000..7246d11
--- /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 <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"]]