Update copyright years
[deliverable/binutils-gdb.git] / ld / testsuite / config / default.exp
index 9656bfb8252aa075d5bc589a9c0480c536af6735..9629ac3350ca0fa5d68c7cc21fa2eb67831286a2 100644 (file)
@@ -1,10 +1,11 @@
 # Basic expect script for LD Regression Tests
-#   Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2001, 2003
-#   Free Software Foundation, Inc.
+#   Copyright (C) 1993-2014 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
 #
 # This file 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,
@@ -14,7 +15,8 @@
 # 
 # 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 Jeffrey Wheat (cassidy@cygnus.com)
 #
@@ -47,9 +49,7 @@ if ![info exists strip] then {
     set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
 }
 
-if {![file isdirectory tmpdir]} then {
-    catch "exec mkdir tmpdir" status
-}
+remote_exec host "mkdir -p tmpdir"
 
 # Make a symlink from tmpdir/as to the assembler in the build tree, so
 # that we can use a -B option to gcc to force it to use the newly
@@ -66,6 +66,7 @@ set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
 if {![file isdirectory tmpdir/ld]} then {
     catch "exec mkdir tmpdir/ld" status
     catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
+    catch "exec ln -s ld tmpdir/ld/collect-ld" status
 }
 set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
 
@@ -80,9 +81,18 @@ if {[file exists tmpdir/libpath.exp]} {
 
 # The "make check" target in the Makefile passes in
 # "CC=$(CC_FOR_TARGET)".  But, if the user invokes runtest directly
-# (as when testing an installed linker), CC may not be set.  
+# (as when testing an installed linker), these flags may not be set.  
 if {![info exists CC]} {
-    set CC [transform gcc]
+    set CC [find_gcc]
+}
+if {![info exists CFLAGS]} {
+    set CFLAGS "-g -O2"
+}
+if {![info exists CXX]} {
+    set CXX [find_g++]
+}
+if {![info exists CXXFLAGS]} {
+    set CXXFLAGS ""
 }
 
 # The mips64-*-linux-gnu compiler defaults to the N32 ABI after
@@ -105,9 +115,17 @@ proc get_link_files {varname} {
     global srcdir
     global CC
     if ![info exists $varname] {
-       set status [catch "exec sh -c \"host='$target_triplet' && CC='$CC' && . $srcdir/../configure.host && eval echo \\$$varname\"" result]
+       #configure.host returns variables that can be substituted into
+       #makefile rules, with embedded shell variable expansions.
+       #make wants $$shell_var, we want $shell_var ...
+       set cmd "host='$target_triplet' && . $srcdir/../configure.host && sed -e 's,\\\$\\\$,\$,g' <<EOF\n\$$varname\nEOF"
+       set status [catch "exec sh -c [list $cmd]" result]
+       if $status { error "Error getting native link files: $result" }
+       set cmd "CC='$CC' && eval echo \"$result\""
+       set status [catch "exec sh -c [list $cmd]" result]
        if $status { error "Error getting native link files: $result" }
        set $varname $result
+       send_log "$varname = $result\n"
     }
 }
 
@@ -120,11 +138,11 @@ proc get_target_emul {} {
 }
 
 if [isnative] {
-    foreach x {HOSTING_CRT0 HOSTING_LIBS} {
+    foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS HOSTING_SLIBS} {
        get_link_files $x
     }
 } else {
-    foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
+    foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS HOSTING_SLIBS} { set $x "" }
 }
 if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
 
@@ -187,7 +205,15 @@ proc ld_compile { cc source object } {
 #      assemble a file
 #
 proc ld_assemble { as source object } {
-       default_ld_assemble $as $source $object 
+       default_ld_assemble $as "" $source $object 
+}
+
+#
+# ld_assemble_flags
+#      assemble a file with extra flags
+#
+proc ld_assemble_flags { as flags source object } {
+       default_ld_assemble $as $flags $source $object 
 }
 
 #
This page took 0.025558 seconds and 4 git commands to generate.