* cgen.c (gas_cgen_parse_operand): Do not set BSF_RELC flag on
[binutils.git] / ld / testsuite / config / default.exp
blobcd79236a6f1a5c3c46f40b871e2e88f24a799ef7
1 # Basic expect script for LD Regression Tests
2 #   Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2001, 2003, 2005, 2007, 2009
3 #   Free Software Foundation, Inc.
5 # This file is part of the GNU Binutils.
7 # This file is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 # MA 02110-1301, USA.
22 # Written by Jeffrey Wheat (cassidy@cygnus.com)
25 if ![info exists ld] then {
26     set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
29 if ![info exists as] then {
30     set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
33 if ![info exists nm] then {
34     set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
37 if ![info exists objdump] then {
38     set objdump [findfile $base_dir/../binutils/objdump]
41 if ![info exists objcopy] then {
42     set objcopy [findfile $base_dir/../binutils/objcopy]
45 if ![info exists ar] then {
46     set ar [findfile $base_dir/../binutils/ar]
49 if ![info exists strip] then {
50     set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
53 remote_exec host "mkdir -p tmpdir"
55 # Make a symlink from tmpdir/as to the assembler in the build tree, so
56 # that we can use a -B option to gcc to force it to use the newly
57 # built assembler.
58 if {![file isdirectory tmpdir/gas]} then {
59     catch "exec mkdir tmpdir/gas" status
60     catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status
62 set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
64 # Make a symlink from tmpdir/ld to the linker in the build tree, so
65 # that we can use a -B option to gcc to force it to use the newly
66 # built linker. 
67 if {![file isdirectory tmpdir/ld]} then {
68     catch "exec mkdir tmpdir/ld" status
69     catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
70     catch "exec ln -s ld tmpdir/ld/collect-ld" status
72 set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
74 # load the linker path
75 if {[file exists tmpdir/libpath.exp]} {
76     load_lib tmpdir/libpath.exp
78     foreach dir $libpath {
79         set gcc_ld_flag "$gcc_ld_flag -L$dir"
80     }
83 # The "make check" target in the Makefile passes in
84 # "CC=$(CC_FOR_TARGET)".  But, if the user invokes runtest directly
85 # (as when testing an installed linker), these flags may not be set.  
86 if {![info exists CC]} {
87     set CC [find_gcc]
89 if {![info exists CFLAGS]} {
90     set CFLAGS "-g -O2"
92 if {![info exists CXX]} {
93     set CXX [find_g++]
95 if {![info exists CXXFLAGS]} {
96     set CXXFLAGS ""
99 # The mips64-*-linux-gnu compiler defaults to the N32 ABI after
100 # installed, but to the O32 ABI in the build tree, because of some
101 # specs-file hacks.  Make sure we use an ABI that is compatible with
102 # the one we expect.
103 if {[istarget mips64*-*-linux*] &&
104     (![board_info [target_info name] exists multilib_flags] ||
105      ![string match "*-mabi" [board_info [target_info name] multilib_flags]])
106    } {
107     append gcc_gas_flag " -mabi=n32"
110 # load the utility procedures
111 load_lib ld-lib.exp
113 proc get_link_files {varname} {
114     global $varname
115     global target_triplet
116     global srcdir
117     global CC
118     if ![info exists $varname] {
119         #configure.host returns variables that can be substituted into
120         #makefile rules, with embedded shell variable expansions.
121         #make wants $$shell_var, we want $shell_var ...
122         set cmd "host='$target_triplet' && . $srcdir/../configure.host && sed -e 's,\\\$\\\$,\$,g' <<EOF\n\$$varname\nEOF"
123         set status [catch "exec sh -c [list $cmd]" result]
124         if $status { error "Error getting native link files: $result" }
125         set cmd "CC='$CC' && eval echo \"$result\""
126         set status [catch "exec sh -c [list $cmd]" result]
127         if $status { error "Error getting native link files: $result" }
128         set $varname $result
129         send_log "$varname = $result\n"
130     }
133 proc get_target_emul {} {
134     global target_triplet
135     global srcdir
136     set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
137     if $status { error "Error getting emulation name: $result" }
138     return $result
141 if [isnative] {
142     foreach x {HOSTING_CRT0 HOSTING_LIBS} {
143         get_link_files $x
144     }
145 } else {
146     foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
148 if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
151 # ld_version -- extract and print the version number of ld compiler (GCC)
153 proc ld_version {} {
154     global ld
155     default_ld_version $ld
159 # ld_exit -- just a stub for ld
161 proc ld_exit {} {
165 # ld_start 
166 #       relink the linker
168 proc ld_start { ld target } {
169         #
173 # ld_relocate 
174 #       link an object using relocation
176 proc ld_relocate { ld target objects } {
177         default_ld_relocate $ld $target $objects
181 # ld_link 
182 #       link a program using ld
184 proc ld_link { ld target objects } {
185         default_ld_link $ld $target $objects
189 # ld_simple_link 
190 #       link a program using ld, without including any libraries
192 proc ld_simple_link { ld target objects } {
193         default_ld_simple_link $ld $target $objects
197 # ld_compile 
198 #       compile an object using $cc
200 proc ld_compile { cc source object } {
201         default_ld_compile $cc $source $object 
205 # ld_assemble
206 #       assemble a file
208 proc ld_assemble { as source object } {
209         default_ld_assemble $as "" $source $object 
213 # ld_assemble_flags
214 #       assemble a file with extra flags
216 proc ld_assemble_flags { as flags source object } {
217         default_ld_assemble $as $flags $source $object 
221 # ld_nm
222 #       run nm on a file
224 proc ld_nm { nm nmflags object } {
225         default_ld_nm $nm $nmflags $object
229 # ld_exec
230 #       execute ithe target
232 proc ld_exec { target output } {
233         default_ld_exec $target $output
236 # From gas-defs.exp, to support run_dump_test.
237 if ![info exists AS] then {
238     set AS $as
241 if ![info exists GASP] then {
242     set GASP [findfile $base_dir/../gas/gasp-new $base_dir/../gas/gasp-new [transform gasp]]
245 if ![info exists ASFLAGS] then {
246     set ASFLAGS ""
249 if ![info exists OBJDUMP] then {
250     set OBJDUMP $objdump
253 if ![info exists OBJDUMPFLAGS] then {
254     set OBJDUMPFLAGS {}
257 if ![info exists NM] then {
258     set NM $nm
261 if ![info exists NMFLAGS] then {
262     set NMFLAGS {}
265 if ![info exists OBJCOPY] then {
266     set OBJCOPY $objcopy
269 if ![info exists OBJCOPYFLAGS] then {
270     set OBJCOPYFLAGS {}
273 if ![info exists READELF] then {
274     set READELF [findfile $base_dir/../binutils/readelf]
277 if ![info exists READELFFLAGS] then {
278     set READELFFLAGS {}
281 if ![info exists LD] then {
282     set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
285 if ![info exists LDFLAGS] then {
286     set LDFLAGS {}