Check incompatible existing default symbol definition
[deliverable/binutils-gdb.git] / ld / testsuite / ld-ifunc / ifunc.exp
index be519ce456df97508dd7af75028dbcf2ec6a8685..d7ff445c3628c0188020112ead01273a8efc205f 100644 (file)
@@ -1,6 +1,6 @@
 # Expect script for linker support of IFUNC symbols and relocations.
 #
-#   Copyright 2009  Free Software Foundation, Inc.
+#   Copyright 2009, 2010, 2012 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,
-# and sparc so far.
+# aarch64 and sparc so far.
 if {!(([istarget "i?86-*-*"]
        || [istarget "x86_64-*-*"]
        || [istarget "powerpc*-*-*"]
+       || [istarget "aarch64*-*-*"]
        || [istarget "sparc*-*-*"])
       && ([istarget "*-*-elf*"]
-         || ([istarget "*-*-linux*"]
+         || [istarget "*-*-nacl*"]
+         || (([istarget "*-*-linux*"]
+              || [istarget "*-*-gnu*"])
              && ![istarget "*-*-*aout*"]
              && ![istarget "*-*-*oldld*"]))) } {
     verbose "IFUNC tests not run - target does not support IFUNC"
@@ -76,7 +79,7 @@ proc check_osabi { binary_file expected_osabi } {
     }
 
     verbose "Expected OSABI: $expected_osabi, Obtained osabi: $osabi"
-    
+
     return 0
 }
 
@@ -95,8 +98,9 @@ proc contains_ifunc_symbol { binary_file } {
 
     # Look for a line like this:
     #    58: 0000000000400600    30 IFUNC   GLOBAL DEFAULT   12 library_func2
+    # with perhaps some other info between the visibility and section
 
-    if { ![regexp ".*\[ \]*IFUNC\[ \]+GLOBAL\[ \]+DEFAULT\[ \]+\[UND0-9\]+\[ \]+library_func2\n" [file_contents readelf.out]] } {
+    if { ![regexp ".*\[ \]*IFUNC\[ \]+GLOBAL\[ \]+DEFAULT .* \[UND0-9\]+\[ \]+library_func2\n" [file_contents readelf.out]] } {
        return 0
     }
 
@@ -243,23 +247,23 @@ if { $fails == 0 } {
 # Check the executables and shared libraries
 #
 # The linked ifunc using executables and the shared library containing
-# ifunc should have an OSABI field of LINUX.  The linked non-ifunc using
+# ifunc should have an OSABI field of GNU.  The linked non-ifunc using
 # executable should have an OSABI field of NONE (aka System V).
 
-if {! [check_osabi tmpdir/libshared_ifunc.so {UNIX - Linux}]} {
-    fail "Shared libraries containing ifunc does not have an OS/ABI field of LINUX"
+if {! [check_osabi tmpdir/libshared_ifunc.so {UNIX - GNU}]} {
+    fail "Shared libraries containing ifunc does not have an OS/ABI field of GNU"
     set fails [expr $fails + 1]
 }
-if {! [check_osabi tmpdir/local_prog {UNIX - Linux}]} {
-    fail "Local ifunc-using executable does not have an OS/ABI field of LINUX"
+if {! [check_osabi tmpdir/local_prog {UNIX - GNU}]} {
+    fail "Local ifunc-using executable does not have an OS/ABI field of GNU"
     set fails [expr $fails + 1]
 }
-if {! [check_osabi tmpdir/static_prog {UNIX - Linux}]} {
-    fail "Static ifunc-using executable does not have an OS/ABI field of LINUX"
+if {! [check_osabi tmpdir/static_prog {UNIX - GNU}]} {
+    fail "Static ifunc-using executable does not have an OS/ABI field of GNU"
     set fails [expr $fails + 1]
 }
-if {! [check_osabi tmpdir/dynamic_prog {UNIX - Linux}]} {
-    fail "Dynamic ifunc-using executable does not have an OS/ABI field of LINUX"
+if {! [check_osabi tmpdir/dynamic_prog {UNIX - System V}]} {
+    fail "Dynamic ifunc-using executable does not have an OS/ABI field of System V"
     set fails [expr $fails + 1]
 }
 if {! [check_osabi tmpdir/static_nonifunc_prog {UNIX - System V}]} {
@@ -345,6 +349,72 @@ if { $verbose < 1 } {
     remote_file host delete "tmpdir/static_nonifunc_prog"
 }
 
+run_cc_link_tests [list \
+    [list \
+       "Build libpr16467a.so" \
+       "-shared -Wl,--version-script=pr16467a.map" \
+       "-fPIC" \
+       { pr16467a.c } \
+       {} \
+       "libpr16467a.so" \
+    ] \
+    [list \
+       "Build libpr16467b.a" \
+       "" \
+       "-fPIC" \
+       { pr16467b.c } \
+       {} \
+       "libpr16467b.a" \
+    ] \
+    [list \
+       "Build libpr16467b.so" \
+       "-shared tmpdir/pr16467b.o tmpdir/libpr16467a.so \
+        -Wl,--version-script=pr16467b.map" \
+       "-fPIC" \
+       { dummy.c } \
+       {} \
+       "libpr16467b.so" \
+    ] \
+    [list \
+       "Build libpr16467c.a" \
+       "" \
+       "" \
+       { pr16467c.c } \
+       {} \
+       "libpr16467c.a" \
+    ] \
+]
+
+run_ld_link_exec_tests [] [list \
+    [list \
+       "Common symbol override ifunc test 1a" \
+       "-static" \
+       "" \
+       { ifunc-common-1a.c ifunc-common-1b.c } \
+       "ifunc-common-1a" \
+       "ifunc-common-1.out" \
+       "-g" \
+    ] \
+    [list \
+       "Common symbol override ifunc test 1b" \
+       "-static" \
+       "" \
+       { ifunc-common-1b.c ifunc-common-1a.c } \
+       "ifunc-common-1b" \
+       "ifunc-common-1.out" \
+       "-g" \
+    ] \
+    [list \
+       "Run pr16467" \
+       "tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \
+       "" \
+       { dummy.c } \
+       "pr16467" \
+       "pr16467.out" \
+       "" \
+    ] \
+]
+
 set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
 foreach t $test_list {
     # We need to strip the ".d", but can leave the dirname.
This page took 0.027007 seconds and 4 git commands to generate.