OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [testsuite/] [config/] [default.exp] - Blame information for rev 47

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 khays
# 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.
4
#
5
# This file is part of the GNU Binutils.
6
#
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.
21
#
22
# Written by Jeffrey Wheat (cassidy@cygnus.com)
23
#
24
 
25
if ![info exists ld] then {
26
    set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
27
}
28
 
29
if ![info exists as] then {
30
    set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
31
}
32
 
33
if ![info exists nm] then {
34
    set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
35
}
36
 
37
if ![info exists objdump] then {
38
    set objdump [findfile $base_dir/../binutils/objdump]
39
}
40
 
41
if ![info exists objcopy] then {
42
    set objcopy [findfile $base_dir/../binutils/objcopy]
43
}
44
 
45
if ![info exists ar] then {
46
    set ar [findfile $base_dir/../binutils/ar]
47
}
48
 
49
if ![info exists strip] then {
50
    set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
51
}
52
 
53
remote_exec host "mkdir -p tmpdir"
54
 
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
61
}
62
set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
63
 
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
}
71
set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
72
 
73
# load the linker path
74
if {[file exists tmpdir/libpath.exp]} {
75
    load_lib tmpdir/libpath.exp
76
 
77
    foreach dir $libpath {
78
        set gcc_ld_flag "$gcc_ld_flag -L$dir"
79
    }
80
}
81
 
82
# The "make check" target in the Makefile passes in
83
# "CC=$(CC_FOR_TARGET)".  But, if the user invokes runtest directly
84
# (as when testing an installed linker), these flags may not be set.
85
if {![info exists CC]} {
86
    set CC [find_gcc]
87
}
88
if {![info exists CFLAGS]} {
89
    set CFLAGS "-g -O2"
90
}
91
if {![info exists CXX]} {
92
    set CXX [find_g++]
93
}
94
if {![info exists CXXFLAGS]} {
95
    set CXXFLAGS ""
96
}
97
 
98
# The mips64-*-linux-gnu compiler defaults to the N32 ABI after
99
# installed, but to the O32 ABI in the build tree, because of some
100
# specs-file hacks.  Make sure we use an ABI that is compatible with
101
# the one we expect.
102
if {[istarget mips64*-*-linux*] &&
103
    (![board_info [target_info name] exists multilib_flags] ||
104
     ![string match "*-mabi" [board_info [target_info name] multilib_flags]])
105
   } {
106
    append gcc_gas_flag " -mabi=n32"
107
}
108
 
109
# load the utility procedures
110
load_lib ld-lib.exp
111
 
112
proc get_link_files {varname} {
113
    global $varname
114
    global target_triplet
115
    global srcdir
116
    global CC
117
    if ![info exists $varname] {
118
        #configure.host returns variables that can be substituted into
119
        #makefile rules, with embedded shell variable expansions.
120
        #make wants $$shell_var, we want $shell_var ...
121
        set cmd "host='$target_triplet' && . $srcdir/../configure.host && sed -e 's,\\\$\\\$,\$,g' <
122
        set status [catch "exec sh -c [list $cmd]" result]
123
        if $status { error "Error getting native link files: $result" }
124
        set cmd "CC='$CC' && eval echo \"$result\""
125
        set status [catch "exec sh -c [list $cmd]" result]
126
        if $status { error "Error getting native link files: $result" }
127
        set $varname $result
128
        send_log "$varname = $result\n"
129
    }
130
}
131
 
132
proc get_target_emul {} {
133
    global target_triplet
134
    global srcdir
135
    set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
136
    if $status { error "Error getting emulation name: $result" }
137
    return $result
138
}
139
 
140
if [isnative] {
141
    foreach x {HOSTING_CRT0 HOSTING_LIBS} {
142
        get_link_files $x
143
    }
144
} else {
145
    foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
146
}
147
if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
148
 
149
#
150
# ld_version -- extract and print the version number of ld compiler (GCC)
151
#
152
proc ld_version {} {
153
    global ld
154
    default_ld_version $ld
155
}
156
 
157
#
158
# ld_exit -- just a stub for ld
159
#
160
proc ld_exit {} {
161
}
162
 
163
#
164
# ld_start
165
#       relink the linker
166
#
167
proc ld_start { ld target } {
168
        #
169
}
170
 
171
#
172
# ld_relocate
173
#       link an object using relocation
174
#
175
proc ld_relocate { ld target objects } {
176
        default_ld_relocate $ld $target $objects
177
}
178
 
179
#
180
# ld_link
181
#       link a program using ld
182
#
183
proc ld_link { ld target objects } {
184
        default_ld_link $ld $target $objects
185
}
186
 
187
#
188
# ld_simple_link
189
#       link a program using ld, without including any libraries
190
#
191
proc ld_simple_link { ld target objects } {
192
        default_ld_simple_link $ld $target $objects
193
}
194
 
195
#
196
# ld_compile
197
#       compile an object using $cc
198
#
199
proc ld_compile { cc source object } {
200
        default_ld_compile $cc $source $object
201
}
202
 
203
#
204
# ld_assemble
205
#       assemble a file
206
#
207
proc ld_assemble { as source object } {
208
        default_ld_assemble $as "" $source $object
209
}
210
 
211
#
212
# ld_assemble_flags
213
#       assemble a file with extra flags
214
#
215
proc ld_assemble_flags { as flags source object } {
216
        default_ld_assemble $as $flags $source $object
217
}
218
 
219
#
220
# ld_nm
221
#       run nm on a file
222
#
223
proc ld_nm { nm nmflags object } {
224
        default_ld_nm $nm $nmflags $object
225
}
226
 
227
#
228
# ld_exec
229
#       execute ithe target
230
#
231
proc ld_exec { target output } {
232
        default_ld_exec $target $output
233
}
234
 
235
# From gas-defs.exp, to support run_dump_test.
236
if ![info exists AS] then {
237
    set AS $as
238
}
239
 
240
if ![info exists GASP] then {
241
    set GASP [findfile $base_dir/../gas/gasp-new $base_dir/../gas/gasp-new [transform gasp]]
242
}
243
 
244
if ![info exists ASFLAGS] then {
245
    set ASFLAGS ""
246
}
247
 
248
if ![info exists OBJDUMP] then {
249
    set OBJDUMP $objdump
250
}
251
 
252
if ![info exists OBJDUMPFLAGS] then {
253
    set OBJDUMPFLAGS {}
254
}
255
 
256
if ![info exists NM] then {
257
    set NM $nm
258
}
259
 
260
if ![info exists NMFLAGS] then {
261
    set NMFLAGS {}
262
}
263
 
264
if ![info exists OBJCOPY] then {
265
    set OBJCOPY $objcopy
266
}
267
 
268
if ![info exists OBJCOPYFLAGS] then {
269
    set OBJCOPYFLAGS {}
270
}
271
 
272
if ![info exists READELF] then {
273
    set READELF [findfile $base_dir/../binutils/readelf]
274
}
275
 
276
if ![info exists READELFFLAGS] then {
277
    set READELFFLAGS {}
278
}
279
 
280
if ![info exists LD] then {
281
    set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
282
}
283
 
284
if ![info exists LDFLAGS] then {
285
    set LDFLAGS {}
286
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.