update copyright dates
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elfvers / vers.exp
index 6bb77a7c26745d1ed3cfb639cb574458c10048fa..828c32f06225208fe54b4bc84caee5133ebc1ed9 100644 (file)
@@ -1,20 +1,23 @@
 # Expect script for ld-version tests
-#   Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
-#   Free Software Foundation, Inc.
+#   Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+#   2009 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
 #
 # Written by Eric Youngdale (eric@andante.jic.com)
 
@@ -118,7 +121,7 @@ proc test_ar { test lib object expect } {
 
     catch "exec $nm --print-armap $tmpdir/$lib | grep \\\ in\\\  | egrep VERS\\\|bar\\\|foo | sort > $tmpdir/nm.out" exec_output
     if [string match "" $exec_output] then {
-       catch "exec $diff $tmpdir/nm.out $srcdir/$subdir/$expect" exec_output
+       catch "exec sort $srcdir/$subdir/$expect | $diff $tmpdir/nm.out -" exec_output
        set exec_output [prune_warnings $exec_output]
        if [string match "" $exec_output] then {
            pass $test
@@ -460,44 +463,33 @@ proc objdump_versionstuff { objdump object expectfile } {
 
        # It's OK if there are extra lines in the actual output; they
        # may come from version information in libc.  We require that
-       # every line in EXPECTFILE appear in the output in order.
+       # every line in EXPECTFILE appear in the output in any order.
 
-       set f1 [open $tmpdir/objdump.out r]
        set f2 [open $expectfile r]
        while { [gets $f2 l2] != -1 } {
            if { ![regexp "^#.*$" $l2] } then {
-               break
-           }
-       } 
-       while { [gets $f1 l1] != -1 } {
-           if { [string match $l2 $l1] } then {
-               if { [gets $f2 l2] == -1 } then {
+               set f1 [open $tmpdir/objdump.out r]
+               while { [gets $f1 l1] != -1 } {
+                   if { [string match $l2 $l1] } then {
+                       break
+                   }
+               }
+               close $f1
+
+               if { ![string match $l2 $l1] } then {
+                   verbose -log "Did not find \"$l2\""
+                   set f1 [open $tmpdir/objdump.out r]
+                   while { [gets $f1 l1] != -1 } {
+                       verbose -log $l1
+                   }
                    close $f1
                    close $f2
-                   return 1
+                   return 0
                }
            }
        }
-
-       # We reached the end of the output without seeing the line we
-       # expected.  This is a test failure.
-
-       close $f1
        close $f2
-
-       # Support empty expected file.
-       if [string match "" $l2] then {
-           return 1
-       }
-
-       verbose -log "Did not find \"$l2\""
-       set f1 [open $tmpdir/objdump.out r]
-       while { [gets $f1 l1] != -1 } {
-           verbose -log $l1
-       }
-
-       verbose -log "$exec_output"
-       return 0
+       return 1
     } else {
        verbose -log "$exec_output"
        return 0
@@ -812,6 +804,10 @@ build_exec "vers4" vers4.c vers4 "" "" "" "" vers4.sym
 
 build_exec "vers4a" vers4.c vers4a "-export-dynamic" "" vers4a.ver vers4a.dsym vers4a.sym
 
+# Verify that --no-export-dynamic undoes the effect of --export-dynamic.
+setup_xfail "mips*-*-*"
+build_exec "vers4b" vers4.c vers4b "-export-dynamic -Wl,--no-export-dynamic" "" "" "" vers4.sym
+
 
 #
 # Try multiple definitions foo@BAR and foo@@BAR and make sure the linker
@@ -999,3 +995,9 @@ build_vers_lib_pic "vers30" vers30.c vers30 "" vers30.map vers30.ver vers30.dsym
 
 # Test #31 -- quoted strings in version sections.
 build_vers_lib_pic "vers31" vers31.c vers31 "" vers31.map vers31.ver vers31.dsym ""
+
+# Test #32 -- linker --defsym
+build_vers_lib_pic "vers32a" vers32a.c vers32a "" vers32.map vers32a.ver vers32a.dsym ""
+build_vers_lib_pic_flags "vers32b" vers32b.c vers32b "vers32a.so" vers32.map vers32b.ver vers32b.dsym "" "--defsym foo=0"
+build_vers_lib_pic_flags "vers32c" vers32a.c vers32c "vers32a.so" vers32.map vers32c.ver vers32c.dsym "" "--defsym foo=0"
+build_vers_lib_pic_flags "vers32d" vers32a.c vers32d "" vers32.map vers32d.ver vers32c.dsym "" "--defsym foo=0"
This page took 0.025546 seconds and 4 git commands to generate.