# 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,
#
# 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)
#
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
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/"
# 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
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"
}
}
}
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]" }
# 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
}
#