# Basic expect script for LD Regression Tests # Copyright (C) 1993-2016 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 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. # # Written by Jeffrey Wheat (cassidy@cygnus.com) # if ![info exists ld] then { set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]] } if ![info exists as] then { set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]] } if ![info exists nm] then { set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]] } if ![info exists objdump] then { set objdump [findfile $base_dir/../binutils/objdump] } if ![info exists objcopy] then { set objcopy [findfile $base_dir/../binutils/objcopy] } if ![info exists ar] then { set ar [findfile $base_dir/../binutils/ar] } if ![info exists strip] then { set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]] } if ![info exists size] then { set size [findfile $base_dir/../binutils/size] } remote_exec host "mkdir -p tmpdir" # Make symlinks from tmpdir/ld to the linker and assembler in the # build tree, so that we can use a -B option to gcc to force it to use # the newly built linker and assembler. 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 catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status } set gcc_B_opt "-B[pwd]/tmpdir/ld/" # load the linker path set ld_L_opt "" if {[file exists tmpdir/libpath.exp]} { load_lib tmpdir/libpath.exp foreach dir $libpath { append ld_L_opt " -L$dir" } } # Many ELF testcases expect that "-z relro" is off. set ld_elf_shared_opt "-z norelro" # 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), these flags may not be set. if {![info exists CC]} { 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 # installed, but to the O32 ABI in the build tree, because of some # specs-file hacks. Make sure we use an ABI that is compatible with # the one we expect. if {[istarget mips64*-*-linux*] && (![board_info [target_info name] exists multilib_flags] || ![string match "*-mabi" [board_info [target_info name] multilib_flags]]) } { append gcc_B_opt " -mabi=n32" } if { [istarget rx-*-*] } { global ASFLAGS set ASFLAGS "-muse-conventional-section-names" } # load the utility procedures load_lib ld-lib.exp proc get_link_files {varname} { global $varname global target_triplet global srcdir global CC if ![info exists $varname] { #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' <