aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/config/default.exp
blob: 0a0fdea16d5e501f79c5f5fa93954a22164737b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Basic expect script for LD Regression Tests
#   Copyright (C) 1993, 94, 95, 97, 98, 1999 Free Software Foundation
#
# 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
# (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 {![file isdirectory tmpdir]} then {
    catch "exec mkdir tmpdir" status
}

# 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
# built assembler.
if {![file isdirectory tmpdir/gas]} then {
    catch "exec mkdir tmpdir/gas" status
    catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status
}
set gcc_gas_flag "-B[pwd]/tmpdir/gas/"

# 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] {
	set status [catch "exec sh -c \"host='$target_triplet' && CC='$CC' && . $srcdir/../configure.host && eval echo \\$$varname\"" result]
	if $status { error "Error getting native link files: $result" }
	set $varname $result
    }
}

proc get_target_emul {} {
    global target_triplet
    global srcdir
    set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
    if $status { error "Error getting emulation name: $result" }
    return $result
}

if [isnative] {
    foreach x {HOSTING_CRT0 HOSTING_LIBS} {
	get_link_files $x
    }
} else {
    foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
}
if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }

#
# ld_version -- extract and print the version number of ld compiler (GCC)
#
proc ld_version {} {
    global ld
    default_ld_version $ld
}

#
# ld_exit -- just a stub for ld
#
proc ld_exit {} {
}

#
# ld_start 
#	relink the linker
#
proc ld_start { ld target } {
	#
}

#
# ld_relocate 
#	link an object using relocation
#
proc ld_relocate { ld target objects } {
	default_ld_relocate $ld $target $objects
}

#
# ld_link 
#	link a program using ld
#
proc ld_link { ld target objects } {
	default_ld_link $ld $target $objects
}

#
# ld_simple_link 
#	link a program using ld, without including any libraries
#
proc ld_simple_link { ld target objects } {
	default_ld_simple_link $ld $target $objects
}

#
# ld_compile 
#	compile an object using $cc
#
proc ld_compile { cc source object } {
	default_ld_compile $cc $source $object 
}

#
# ld_assemble
#	assemble a file
#
proc ld_assemble { as source object } {
	default_ld_assemble $as $source $object 
}

#
# ld_nm
#	run nm on a file
#
proc ld_nm { nm object } {
	default_ld_nm $nm $object
}

#
# ld_exec
#	execute ithe target
#
proc ld_exec { target output } {
	default_ld_exec $target $output
}