Handle local IFUNC symbols in shared object
[deliverable/binutils-gdb.git] / ld / testsuite / ld-ifunc / ifunc.exp
index 03789a9502860d7b14ad2b482092cd94b41ed69f..e860f36d87c831f2be2c9b9d5661cc4c340fc19f 100644 (file)
@@ -1,6 +1,6 @@
 # Expect script for linker support of IFUNC symbols and relocations.
 #
-#   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+#   Copyright (C) 2009-2016 Free Software Foundation, Inc.
 #   Contributed by Red Hat.
 #
 # This file is part of the GNU Binutils.
 
 
 # IFUNC support has only been implemented for the ix86, x86_64, powerpc,
-# aarch64 and sparc so far.
+# aarch64, sparc, and S/390 so far.
 if {!(([istarget "i?86-*-*"]
        || [istarget "x86_64-*-*"]
        || [istarget "powerpc*-*-*"]
        || [istarget "aarch64*-*-*"]
-       || [istarget "sparc*-*-*"])
+       || [istarget "sparc*-*-*"]
+       || [istarget "s390*-*-*"])
       && ([istarget "*-*-elf*"]
          || [istarget "*-*-nacl*"]
          || (([istarget "*-*-linux*"]
@@ -457,3 +458,118 @@ run_ld_link_exec_tests [] [list \
        "-fpic" \
     ] \
 ]
+
+# Run-time tests which require working ifunc attribute support.
+if { ![check_ifunc_attribute_available] } {
+    return
+}
+
+run_cc_link_tests [list \
+    [list \
+       "Build pr18808a.o" \
+       "" \
+       "" \
+       { pr18808a.c } \
+       "" \
+       "" \
+    ] \
+    [list \
+       "Build libpr18808.so" \
+       "-shared" \
+       "-fPIC -O2 -g" \
+       { pr18808b.c } \
+       {} \
+       "libpr18808.so" \
+    ] \
+    [list \
+       "Build pr18841a.o" \
+       "" \
+       "" \
+       { pr18841a.c } \
+       "" \
+       "" \
+    ] \
+    [list \
+       "Build libpr18841b.so" \
+       "-shared" \
+       "-fPIC -O0 -g" \
+       { pr18841b.c } \
+       {} \
+       "libpr18841b.so" \
+    ] \
+    [list \
+       "Build libpr18841c.so" \
+       "-shared" \
+       "-fPIC -O0 -g" \
+       { pr18841c.c } \
+       {} \
+       "libpr18841c.so" \
+    ] \
+    [list \
+       "Build libpr19784a.so" \
+       "-shared -Wl,-Bsymbolic-functions" \
+       "-fPIC -O2 -g" \
+       { pr19784b.c pr19784c.c } \
+       {} \
+       "libpr19784a.so" \
+    ] \
+    [list \
+       "Build libpr19784b.so" \
+       "-shared -Wl,-Bsymbolic-functions" \
+       "-fPIC -O2 -g" \
+       { pr19784c.c pr19784b.c } \
+       {} \
+       "libpr19784b.so" \
+    ] \
+    [list \
+       "Build pr19784a.o" \
+       "" \
+       "" \
+       { pr19784a.c } \
+       "" \
+       "" \
+    ] \
+]
+
+run_ld_link_exec_tests [] [list \
+    [list \
+       "Run pr18808" \
+       "tmpdir/pr18808a.o tmpdir/libpr18808.so" \
+       "" \
+       { dummy.c } \
+       "pr18808" \
+       "pr18808.out" \
+    ] \
+    [list \
+       "Run pr18841 with libpr18841b.so" \
+       "tmpdir/pr18841a.o tmpdir/libpr18841b.so" \
+       "" \
+       { dummy.c } \
+       "pr18841b" \
+       "pr18841.out" \
+    ] \
+    [list \
+       "Run pr18841 with libpr18841c.so" \
+       "--as-needed tmpdir/pr18841a.o tmpdir/libpr18841c.so" \
+       "" \
+       { dummy.c } \
+       "pr18841c" \
+       "pr18841.out" \
+    ] \
+    [list \
+       "Run pr19784a" \
+       "tmpdir/pr19784a.o tmpdir/libpr19784a.so" \
+       "" \
+       { dummy.c } \
+       "pr19784a" \
+       "pass.out" \
+    ] \
+    [list \
+       "Run pr19784b" \
+       "--as-needed tmpdir/pr19784a.o tmpdir/libpr19784b.so" \
+       "" \
+       { dummy.c } \
+       "pr19784b" \
+       "pass.out" \
+    ] \
+]
This page took 0.031573 seconds and 4 git commands to generate.