update copyright dates
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elfweak / elfweak.exp
index ea751f3684448004b851b9e81441d7b2e689b39e..4953b916580c69d5b21c57ced145fcba17a9a05e 100644 (file)
@@ -1,19 +1,22 @@
 # Expect script for ld-weak tests
-#   Copyright 2001 Free Software Foundation, Inc.
+#   Copyright 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 #
-# This file is free software; you can redistribute it and/or modify
+# 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 2 of the License, or
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
 #
 # Written by H.J. Lu (hjl@gnu.org)
 #           Eric Youngdale (eric@andante.jic.com)
@@ -25,7 +28,11 @@ if ![isnative] then {return}
 # This test can only be run on a couple of ELF platforms.
 # Square bracket expressions seem to confuse istarget.
 # This is similar to the test that is used in ld-shared, BTW.
-if { ![istarget i?86-*-sysv4*] \
+if {    ![istarget alpha*-*-linux*] \
+     && ![istarget arm*-*-linux*] \
+     && ![istarget hppa*64*-*-hpux*] \
+     && ![istarget hppa*-*-linux*] \
+     && ![istarget i?86-*-sysv4*] \
      && ![istarget i?86-*-unixware] \
      && ![istarget i?86-*-elf*] \
      && ![istarget i?86-*-linux*] \
@@ -33,15 +40,14 @@ if { ![istarget i?86-*-sysv4*] \
      && ![istarget ia64-*-linux*] \
      && ![istarget m68k-*-linux*] \
      && ![istarget mips*-*-irix5*] \
+     && ![istarget mips*-*-linux*] \
      && ![istarget powerpc-*-elf*] \
      && ![istarget powerpc-*-linux*] \
      && ![istarget powerpc-*-sysv4*] \
+     && ![istarget sh\[34\]*-*-linux*] \
      && ![istarget sparc*-*-elf] \
      && ![istarget sparc*-*-solaris2*] \
-     && ![istarget sparc*-*-linux*] \
-     && ![istarget arm*-*-linux*] \
-     && ![istarget mips*-*-linux*] \
-     && ![istarget alpha*-*-linux*] } {
+     && ![istarget sparc*-*-linux*] } {
     return
 }
 
@@ -267,7 +273,7 @@ proc objdump_dynsymstuff { objdump object expectfile } {
 }
 
 proc build_lib {test libname objs dynsymexp} {
-    global ld
+    global CC
     global objdump
     global tmpdir
     global shared
@@ -279,12 +285,13 @@ proc build_lib {test libname objs dynsymexp} {
       set files "$files $tmpdir/$obj"
     }
 
-    if {![ld_link $ld $tmpdir/$libname.so "$shared $files"]} {
+    if {![ld_simple_link $CC $tmpdir/$libname.so "$shared $files"]} {
        fail $test
        return
     }
 
-    if {![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$dynsymexp]} {
+    if {![string match "" $dynsymexp] \
+       && ![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$dynsymexp]} {
        fail $test
        return
     }
@@ -292,7 +299,7 @@ proc build_lib {test libname objs dynsymexp} {
 }
 
 proc build_exec { test execname objs flags dat dynsymexp symexp} {
-    global ld
+    global CC
     global objdump
     global tmpdir
     global shared
@@ -305,7 +312,7 @@ proc build_exec { test execname objs flags dat dynsymexp symexp} {
       set files "$files $tmpdir/$obj"
     }
 
-    if {![ld_link $ld $tmpdir/$execname "$flags $files"]} {
+    if {![ld_simple_link $CC $tmpdir/$execname "$flags $files"]} {
        fail "$test"
        return
     }
@@ -389,7 +396,7 @@ if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main.c $tmpdir/main.o] {
     return
 }
 
-if {![ld_link $ld $tmpdir/libbar.so "$shared $tmpdir/bar.o"]} {
+if {![ld_simple_link $CC $tmpdir/libbar.so "$shared $tmpdir/bar.o"]} {
     fail "ELF weak"
     return
 }
@@ -404,17 +411,17 @@ if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/foo1b.c $tmpdir/foo1b.o]
     return
 }
 
-if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/bar1a.c $tmpdir/bar1a.o] {
+if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/bar1a.c $tmpdir/bar1a.o] {
     unresolved "ELF weak"
     return
 }
 
-if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/bar1b.c $tmpdir/bar1b.o] {
+if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/bar1b.c $tmpdir/bar1b.o] {
     unresolved "ELF weak"
     return
 }
 
-if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/bar1c.c $tmpdir/bar1c.o] {
+if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/bar1c.c $tmpdir/bar1c.o] {
     unresolved "ELF weak"
     return
 }
@@ -424,48 +431,71 @@ if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main1.c $tmpdir/main1.o] {
     return
 }
 
-if {![ld_link $ld $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]} {
+if {![ld_simple_link $CC $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]} {
     fail "ELF weak"
     return
 }
 
-if {![ld_link $ld $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]} {
+if {![ld_simple_link $CC $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]} {
+    fail "ELF weak"
+    return
+}
+
+if {![ld_simple_link $CC $tmpdir/libbar1a.so "$shared $tmpdir/bar1a.o $tmpdir/libfoo1a.so"]} {
     fail "ELF weak"
     return
 }
 
 build_lib "ELF DSO weak func first" libfoo "foo.o bar.o" dso.dsym
 build_lib "ELF DSO weak func last" libfoo "bar.o foo.o" dso.dsym
-setup_xfail "*-*-*"
 build_lib "ELF DSO weak func first DSO" libfoo "foo.o libbar.so" dsow.dsym
-setup_xfail "*-*-*"
 build_lib "ELF DSO weak func last DSO" libfoo "libbar.so foo.o" dsow.dsym
 build_exec "ELF weak func first" foo "main.o bar.o" "" strong "" strong.sym
 build_exec "ELF weak func last" foo "bar.o main.o" "" strong "" strong.sym
-setup_xfail "*-*-*"
-build_exec "ELF weak func first DSO" foo "main.o libbar.so" "-rpath ." weak weak.dsym ""
-setup_xfail "*-*-*"
-build_exec "ELF weak func last DSO" foo "libbar.so main.o" "-rpath ." weak weak.dsym ""
+build_exec "ELF weak func first DSO" foo "main.o libbar.so" "-Wl,-rpath,." weak weak.dsym ""
+build_exec "ELF weak func last DSO" foo "libbar.so main.o" "-Wl,-rpath,." weak weak.dsym ""
 
 build_lib "ELF DSO weak data first" libfoo "bar1a.o foo1a.o" dsodata.dsym
 build_lib "ELF DSO weak data last" libfoo "foo1a.o bar1a.o" dsodata.dsym
-setup_xfail "*-*-*"
-build_lib "ELF DSO weak data first DSO" libfoo "bar1a.o libfoo1a.so" dsowdata.dsym
-setup_xfail "*-*-*"
-build_lib "ELF DSO weak data last DSO" libfoo "libfoo1a.so bar1a.o" dsowdata.dsym
-setup_xfail "*-*-*"
-build_lib "ELF DSO weak data first DSO common" libfoo "bar1a.o libfoo1b.so" dsowdata.dsym
-setup_xfail "*-*-*"
-build_lib "ELF DSO weak data last DSO common" libfoo "libfoo1b.so bar1a.o" dsowdata.dsym
+build_lib "ELF DSO weak data first DSO" libfoo "main1.o libfoo1a.so" dsowdata.dsym
+build_lib "ELF DSO weak data last DSO" libfoo "libfoo1a.so main1.o" dsowdata.dsym
+build_lib "ELF DSO weak data first DSO common" libfoo "main1.o libfoo1b.so" dsowdata.dsym
+build_lib "ELF DSO weak data last DSO common" libfoo "libfoo1b.so main1.o" dsowdata.dsym
 build_exec "ELF weak data first" foo "main1.o bar1a.o foo1a.o" "" strongdata "" strongdata.sym
 build_exec "ELF weak data last" foo "foo1a.o main1.o bar1a.o" "" strongdata "" strongdata.sym
 build_exec "ELF weak data first common" foo "main1.o bar1a.o foo1b.o" "" strongdata "" strongcomm.sym
 build_exec "ELF weak data last common" foo "foo1b.o main1.o bar1a.o" "" strongdata "" strongcomm.sym
-setup_xfail "*-*-*"
-build_exec "ELF weak data first DSO" foo "main1.o bar1a.o libfoo1a.so" "-rpath ." weakdata weakdata.dsym ""
-setup_xfail "*-*-*"
-build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o bar1a.o" "-rpath ." weakdata weakdata.dsym ""
-setup_xfail "*-*-*"
-build_exec "ELF weak data first DSO common" foo "main1.o bar1a.o libfoo1b.so" "-rpath ." weakdata weakdata.dsym ""
-setup_xfail "*-*-*"
-build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o bar1a.o" "-rpath ." weakdata weakdata.dsym ""
+build_exec "ELF weak data first DSO" foo "main1.o libbar1a.so libfoo1a.so" "-Wl,-rpath,." weakdata weakdata.dsym ""
+build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o libbar1a.so" "-Wl,-rpath,." weakdata weakdata.dsym ""
+build_exec "ELF weak data first DSO common" foo "main1.o libbar1a.so libfoo1b.so" "-Wl,-rpath,." weakdata weakdata.dsym ""
+build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-Wl,-rpath,." weakdata weakdata.dsym ""
+
+if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/size_foo.c $tmpdir/size_foo.o] {
+    unresolved "ELF weak (size)"
+    return
+}
+
+if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/size_bar.c $tmpdir/size_bar.o] {
+    unresolved "ELF weak (size)"
+    return
+}
+
+build_lib "ELF DSO small bar (size)" libsize_bar "size_bar.o" ""
+build_lib "ELF DSO foo with small bar (size)" libsize_foo "size_foo.o libsize_bar.so" ""
+
+if ![ld_compile "$CC $CFLAGS $picflag -DSIZE_BIG" $srcdir/$subdir/size_bar.c $tmpdir/size_bar.o] {
+    unresolved "ELF weak (size)"
+    return
+}
+
+build_lib "ELF DSO big bar (size)" libsize_bar "size_bar.o" ""
+
+if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/size_main.c $tmpdir/size_main.o] {
+    unresolved "ELF weak (size)"
+    return
+}
+
+build_exec "ELF weak size" size_main "size_main.o libsize_foo.so libsize_bar.so" "-Wl,-rpath,." size "" ""
+
+verbose "size2"
+run_dump_test $srcdir/$subdir/size2
This page took 0.045263 seconds and 4 git commands to generate.