merge from gcc
[external/binutils.git] / ld / testsuite / ld-sh / arch / arch.exp
index 94120a2..acc322e 100644 (file)
@@ -1,22 +1,26 @@
-# Copyright (C) 2004
+# Copyright (C) 2004, 2005, 2006, 2007, 2008
 # Free Software Foundation, Inc.
-
+#
+# 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.
+
 
 # Please email any bugs, comments, and/or additions to this file to:
-# dejagnu@gnu.org
+# binutils@sources.redhat.com
 
 # This scripts tests of all available SH architectures with all other SH
 # architectures. It ensures that those combinations which should not work
 # It looks for files in the same directory as this file named sh*.s .
 # Each file must contain one or more instructions which uniquely identifies
 # that architecture. The architecture name is inferred from the file name.
+# It is best to use the same files used by the assembler testsuite.
 #
 # It also creates another architecture named 'sh-unknown' by modifying
 # another arch type (there is no way to assemble such an arch) in order
 # to test what the linker would do with an older object file.
 #
-# The script generates the architecture  permutations automatically,
+# The script generates the architecture permutations automatically,
 # but it reads the expected results from the file arch_expected.txt (also
 # found in the same directory as this script).
 #
@@ -75,9 +80,14 @@ proc test_arch { file1 file2 arch resultfile } {
     set name2 [file tail $file2]
     set rootname2 [file rootname $name2]
 
-    set result [default_ld_simple_link $LD "${rootname1}_${rootname2}.o" "$file1 $file2"]
+    set flags [big_or_little_endian]
+    
+    # This must use -r to prevent LD trying to relocate the (unrealistic) file
+    send_log "$LD $flags -r -o ${rootname1}_${rootname2}.o $file1 $file2\n"
+    catch "exec $LD $flags -r -o ${rootname1}_${rootname2}.o $file1 $file2" ld_output
+    send_log $ld_output
 
-    if {$result == 1} then {
+    if {[string equal $ld_output ""] == 1} then {
        pass "$rootname1 file should link with $rootname2 file"
 
        set result [get_sh_arch "${rootname1}_${rootname2}.o"]
@@ -113,9 +123,12 @@ proc test_arch_error { file1 file2 resultfile} {
     set name2 [file tail $file2]
     set rootname2 [file rootname $name2]
 
-    set result [default_ld_simple_link $LD "${rootname1}_${rootname2}.o" "$file1 $file2"]
+    # This must use -r to prevent LD trying to relocate the (unrealistic) file
+    send_log "$LD -r -o ${rootname1}_${rootname2}.o $file1 $file2\n"
+    catch "exec $LD -r -o ${rootname1}_${rootname2}.o $file1 $file2" ld_output
+    send_log $ld_output
 
-    if {$result == 1} then {
+    if {[string equal $ld_output ""] == 1} then {
        fail "$rootname1 file should NOT link with $rootname2 file"
        puts $resultfile [format "%-20s %-20s [get_sh_arch ${rootname1}_${rootname2}.o]" $file1 $file2]
     } else {