aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elfvsb
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-elfvsb')
-rw-r--r--ld/testsuite/ld-elfvsb/common.c14
-rw-r--r--ld/testsuite/ld-elfvsb/elfvsb.exp33
-rw-r--r--ld/testsuite/ld-elfvsb/sh3.c7
-rw-r--r--ld/testsuite/ld-elfvsb/test.c26
4 files changed, 80 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elfvsb/common.c b/ld/testsuite/ld-elfvsb/common.c
new file mode 100644
index 0000000..7d05eb7
--- /dev/null
+++ b/ld/testsuite/ld-elfvsb/common.c
@@ -0,0 +1,14 @@
+int foo;
+asm (".hidden foo");
+
+int
+_start (void)
+{
+ return foo;
+}
+
+int
+__start (void)
+{
+ return _start ();
+}
diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp
index 66546dc..d30858a 100644
--- a/ld/testsuite/ld-elfvsb/elfvsb.exp
+++ b/ld/testsuite/ld-elfvsb/elfvsb.exp
@@ -412,6 +412,39 @@ visibility_run protected_undef_def
visibility_run protected_weak
visibility_run normal
+if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
+ unresolved "common hidden symbol"
+} else {
+ if ![ld_simple_link $ld tmpdir/common "tmpdir/common.o"] {
+ fail "common hidden symbol"
+ } else {
+ pass "common hidden symbol"
+ }
+}
+
+if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
+ unresolved "weak hidden symbol"
+} else {
+ if { ![ld_compile "$CC -g $CFLAGS $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
+ unresolved "weak hidden symbol"
+ } else {
+ if ![ld_simple_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] {
+ fail "weak hidden symbol"
+ } else {
+ if ![ld_simple_link $ld tmpdir/weak "tmpdir/test.o tmpdir/sh3.o"] {
+ fail "weak hidden symbol DSO last"
+ } else {
+ pass "weak hidden symbol DSO last"
+ }
+ if ![ld_simple_link $ld tmpdir/weak "tmpdir/sh3.so tmpdir/test.o"] {
+ fail "weak hidden symbol DSO first"
+ } else {
+ pass "weak hidden symbol DSO first"
+ }
+ }
+ }
+}
+
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
# Remove the temporary directory.
catch "exec rm -rf $tmpdir" exec_status
diff --git a/ld/testsuite/ld-elfvsb/sh3.c b/ld/testsuite/ld-elfvsb/sh3.c
new file mode 100644
index 0000000..a6d5dc8
--- /dev/null
+++ b/ld/testsuite/ld-elfvsb/sh3.c
@@ -0,0 +1,7 @@
+int main_hidden_data = 1;
+
+int
+main_hidden_func ()
+{
+ return 1;
+}
diff --git a/ld/testsuite/ld-elfvsb/test.c b/ld/testsuite/ld-elfvsb/test.c
new file mode 100644
index 0000000..ca23d38
--- /dev/null
+++ b/ld/testsuite/ld-elfvsb/test.c
@@ -0,0 +1,26 @@
+#pragma weak main_hidden_data
+extern int main_hidden_data;
+asm (".hidden main_hidden_data");
+
+#pragma weak main_hidden_func
+extern int main_hidden_func ();
+asm (".hidden main_hidden_func");
+
+int
+_start (void)
+{
+ int ret = 0;
+
+ if (&main_hidden_data != 0)
+ ret = 1;
+ if (main_hidden_func != 0)
+ ret = 1;
+
+ return ret;
+}
+
+int
+__start (void)
+{
+ return _start ();
+}