* config/default.exp (ld_nm): Add "nmflags" arg.
[deliverable/binutils-gdb.git] / ld / testsuite / config / default.exp
CommitLineData
252b5132 1# Basic expect script for LD Regression Tests
a2b64bed
NC
2# Copyright 1993, 1994, 1995, 1997, 1998, 1999
3# Free Software Foundation, Inc.
252b5132
RH
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18#
19# Written by Jeffrey Wheat (cassidy@cygnus.com)
20#
21
22if ![info exists ld] then {
23 set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
24}
25
26if ![info exists as] then {
27 set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
28}
29
30if ![info exists nm] then {
31 set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
32}
33
34if ![info exists objdump] then {
35 set objdump [findfile $base_dir/../binutils/objdump]
36}
37
38if ![info exists objcopy] then {
39 set objcopy [findfile $base_dir/../binutils/objcopy]
40}
41
42if ![info exists ar] then {
43 set ar [findfile $base_dir/../binutils/ar]
44}
45
46if ![info exists strip] then {
47 set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
48}
49
50if {![file isdirectory tmpdir]} then {
51 catch "exec mkdir tmpdir" status
52}
53
54# Make a symlink from tmpdir/as to the assembler in the build tree, so
55# that we can use a -B option to gcc to force it to use the newly
56# built assembler.
57if {![file isdirectory tmpdir/gas]} then {
58 catch "exec mkdir tmpdir/gas" status
59 catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status
60}
61set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
62
63# load the utility procedures
64load_lib ld-lib.exp
65
66proc get_link_files {varname} {
67 global $varname
68 global target_triplet
69 global srcdir
70 global CC
71 if ![info exists $varname] {
72 set status [catch "exec sh -c \"host='$target_triplet' && CC='$CC' && . $srcdir/../configure.host && eval echo \\$$varname\"" result]
73 if $status { error "Error getting native link files: $result" }
74 set $varname $result
75 }
76}
77
78proc get_target_emul {} {
79 global target_triplet
80 global srcdir
81 set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
82 if $status { error "Error getting emulation name: $result" }
83 return $result
84}
85
86if [isnative] {
87 foreach x {HOSTING_CRT0 HOSTING_LIBS} {
88 get_link_files $x
89 }
90} else {
91 foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
92}
93if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
94
95#
96# ld_version -- extract and print the version number of ld compiler (GCC)
97#
98proc ld_version {} {
99 global ld
100 default_ld_version $ld
101}
102
103#
104# ld_exit -- just a stub for ld
105#
106proc ld_exit {} {
107}
108
109#
110# ld_start
111# relink the linker
112#
113proc ld_start { ld target } {
114 #
115}
116
117#
118# ld_relocate
119# link an object using relocation
120#
121proc ld_relocate { ld target objects } {
122 default_ld_relocate $ld $target $objects
123}
124
125#
126# ld_link
127# link a program using ld
128#
129proc ld_link { ld target objects } {
130 default_ld_link $ld $target $objects
131}
132
133#
134# ld_simple_link
135# link a program using ld, without including any libraries
136#
137proc ld_simple_link { ld target objects } {
138 default_ld_simple_link $ld $target $objects
139}
140
141#
142# ld_compile
143# compile an object using $cc
144#
145proc ld_compile { cc source object } {
146 default_ld_compile $cc $source $object
147}
148
149#
150# ld_assemble
151# assemble a file
152#
153proc ld_assemble { as source object } {
154 default_ld_assemble $as $source $object
155}
156
157#
158# ld_nm
159# run nm on a file
160#
992c450d
AM
161proc ld_nm { nm nmflags object } {
162 default_ld_nm $nm $nmflags $object
252b5132
RH
163}
164
165#
166# ld_exec
167# execute ithe target
168#
169proc ld_exec { target output } {
170 default_ld_exec $target $output
171}
172
261def70
HPN
173# From gas-defs.exp, to support run_dump_test.
174if ![info exists AS] then {
175 set AS $as
176}
177
178if ![info exists GASP] then {
179 set GASP [findfile $base_dir/../gas/gasp-new $base_dir/../gas/gasp-new [transform gasp]]
180}
181
182if ![info exists ASFLAGS] then {
183 set ASFLAGS ""
184}
185
186if ![info exists OBJDUMP] then {
187 set OBJDUMP $objdump
188}
189
190if ![info exists OBJDUMPFLAGS] then {
191 set OBJDUMPFLAGS {}
192}
193
194if ![info exists NM] then {
195 set NM $nm
196}
197
198if ![info exists NMFLAGS] then {
199 set NMFLAGS {}
200}
201
202if ![info exists OBJCOPY] then {
203 set OBJCOPY $objcopy
204}
205
206if ![info exists OBJCOPYFLAGS] then {
207 set OBJCOPYFLAGS {}
208}
209
210if ![info exists READELF] then {
211 set READELF [findfile $base_dir/../binutils/readelf]
212}
213
214if ![info exists READELFFLAGS] then {
215 set READELFFLAGS {}
216}
217
218if ![info exists LD] then {
219 set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
220}
221
222if ![info exists LDFLAGS] then {
223 set LDFLAGS {}
224}
This page took 0.098266 seconds and 4 git commands to generate.