[ARM] Fix extern protected data handling
[deliverable/binutils-gdb.git] / ld / testsuite / config / default.exp
CommitLineData
252b5132 1# Basic expect script for LD Regression Tests
b90efa5b 2# Copyright (C) 1993-2015 Free Software Foundation, Inc.
252b5132 3#
f96b4a7b
NC
4# This file is part of the GNU Binutils.
5#
252b5132
RH
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
f96b4a7b 8# the Free Software Foundation; either version 3 of the License, or
252b5132
RH
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
f96b4a7b
NC
18# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19# MA 02110-1301, USA.
252b5132
RH
20#
21# Written by Jeffrey Wheat (cassidy@cygnus.com)
22#
23
24if ![info exists ld] then {
25 set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
26}
27
28if ![info exists as] then {
29 set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
30}
31
32if ![info exists nm] then {
33 set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
34}
35
36if ![info exists objdump] then {
37 set objdump [findfile $base_dir/../binutils/objdump]
38}
39
40if ![info exists objcopy] then {
41 set objcopy [findfile $base_dir/../binutils/objcopy]
42}
43
44if ![info exists ar] then {
45 set ar [findfile $base_dir/../binutils/ar]
46}
47
48if ![info exists strip] then {
49 set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
50}
51
7f6a71ff 52remote_exec host "mkdir -p tmpdir"
252b5132 53
f1d7f4a6
AM
54# Make symlinks from tmpdir/ld to the linker and assembler in the
55# build tree, so that we can use a -B option to gcc to force it to use
56# the newly built linker and assembler.
b765d4e3
L
57if {![file isdirectory tmpdir/ld]} then {
58 catch "exec mkdir tmpdir/ld" status
59 catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
3499cebd 60 catch "exec ln -s ld tmpdir/ld/collect-ld" status
f1d7f4a6 61 catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status
b765d4e3 62}
f1d7f4a6 63set gcc_B_opt "-B[pwd]/tmpdir/ld/"
b765d4e3 64
cdaeef2e 65# load the linker path
f1d7f4a6 66set ld_L_opt ""
99c05fe4
MM
67if {[file exists tmpdir/libpath.exp]} {
68 load_lib tmpdir/libpath.exp
cdaeef2e 69
99c05fe4 70 foreach dir $libpath {
f1d7f4a6 71 append ld_L_opt " -L$dir"
99c05fe4
MM
72 }
73}
74
75# The "make check" target in the Makefile passes in
76# "CC=$(CC_FOR_TARGET)". But, if the user invokes runtest directly
dae043d2 77# (as when testing an installed linker), these flags may not be set.
99c05fe4 78if {![info exists CC]} {
dae043d2
MM
79 set CC [find_gcc]
80}
81if {![info exists CFLAGS]} {
82 set CFLAGS "-g -O2"
83}
84if {![info exists CXX]} {
85 set CXX [find_g++]
86}
87if {![info exists CXXFLAGS]} {
88 set CXXFLAGS ""
cdaeef2e
L
89}
90
697380b3
AO
91# The mips64-*-linux-gnu compiler defaults to the N32 ABI after
92# installed, but to the O32 ABI in the build tree, because of some
93# specs-file hacks. Make sure we use an ABI that is compatible with
94# the one we expect.
95if {[istarget mips64*-*-linux*] &&
96 (![board_info [target_info name] exists multilib_flags] ||
97 ![string match "*-mabi" [board_info [target_info name] multilib_flags]])
98 } {
f1d7f4a6 99 append gcc_B_opt " -mabi=n32"
697380b3
AO
100}
101
e5719043
NC
102if { [istarget rx-*-*] } {
103 global ASFLAGS
104 set ASFLAGS "-muse-conventional-section-names"
105}
106
252b5132
RH
107# load the utility procedures
108load_lib ld-lib.exp
109
110proc get_link_files {varname} {
111 global $varname
112 global target_triplet
113 global srcdir
114 global CC
115 if ![info exists $varname] {
bba21f15
AM
116 #configure.host returns variables that can be substituted into
117 #makefile rules, with embedded shell variable expansions.
118 #make wants $$shell_var, we want $shell_var ...
119 set cmd "host='$target_triplet' && . $srcdir/../configure.host && sed -e 's,\\\$\\\$,\$,g' <<EOF\n\$$varname\nEOF"
120 set status [catch "exec sh -c [list $cmd]" result]
121 if $status { error "Error getting native link files: $result" }
122 set cmd "CC='$CC' && eval echo \"$result\""
123 set status [catch "exec sh -c [list $cmd]" result]
252b5132
RH
124 if $status { error "Error getting native link files: $result" }
125 set $varname $result
bba21f15 126 send_log "$varname = $result\n"
252b5132
RH
127 }
128}
129
130proc get_target_emul {} {
131 global target_triplet
132 global srcdir
133 set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
134 if $status { error "Error getting emulation name: $result" }
135 return $result
136}
137
138if [isnative] {
b27caf75 139 foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS HOSTING_SLIBS} {
252b5132
RH
140 get_link_files $x
141 }
142} else {
b27caf75 143 foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS HOSTING_SLIBS} { set $x "" }
252b5132
RH
144}
145if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
146
147#
148# ld_version -- extract and print the version number of ld compiler (GCC)
149#
150proc ld_version {} {
151 global ld
152 default_ld_version $ld
153}
154
155#
156# ld_exit -- just a stub for ld
157#
158proc ld_exit {} {
159}
160
161#
162# ld_start
163# relink the linker
164#
165proc ld_start { ld target } {
166 #
167}
168
169#
170# ld_relocate
171# link an object using relocation
172#
173proc ld_relocate { ld target objects } {
174 default_ld_relocate $ld $target $objects
175}
176
177#
178# ld_link
179# link a program using ld
180#
181proc ld_link { ld target objects } {
182 default_ld_link $ld $target $objects
183}
184
185#
186# ld_simple_link
187# link a program using ld, without including any libraries
188#
189proc ld_simple_link { ld target objects } {
190 default_ld_simple_link $ld $target $objects
191}
192
193#
194# ld_compile
195# compile an object using $cc
196#
197proc ld_compile { cc source object } {
198 default_ld_compile $cc $source $object
199}
200
201#
202# ld_assemble
203# assemble a file
204#
205proc ld_assemble { as source object } {
de1491f0
BS
206 default_ld_assemble $as "" $source $object
207}
208
209#
210# ld_assemble_flags
211# assemble a file with extra flags
212#
213proc ld_assemble_flags { as flags source object } {
214 default_ld_assemble $as $flags $source $object
252b5132
RH
215}
216
217#
218# ld_nm
219# run nm on a file
220#
992c450d
AM
221proc ld_nm { nm nmflags object } {
222 default_ld_nm $nm $nmflags $object
252b5132
RH
223}
224
225#
226# ld_exec
227# execute ithe target
228#
229proc ld_exec { target output } {
230 default_ld_exec $target $output
231}
232
261def70
HPN
233# From gas-defs.exp, to support run_dump_test.
234if ![info exists AS] then {
235 set AS $as
236}
237
261def70
HPN
238if ![info exists ASFLAGS] then {
239 set ASFLAGS ""
240}
241
242if ![info exists OBJDUMP] then {
243 set OBJDUMP $objdump
244}
245
246if ![info exists OBJDUMPFLAGS] then {
247 set OBJDUMPFLAGS {}
248}
249
250if ![info exists NM] then {
251 set NM $nm
252}
253
254if ![info exists NMFLAGS] then {
255 set NMFLAGS {}
256}
257
258if ![info exists OBJCOPY] then {
259 set OBJCOPY $objcopy
260}
261
262if ![info exists OBJCOPYFLAGS] then {
263 set OBJCOPYFLAGS {}
264}
265
266if ![info exists READELF] then {
267 set READELF [findfile $base_dir/../binutils/readelf]
268}
269
270if ![info exists READELFFLAGS] then {
271 set READELFFLAGS {}
272}
273
274if ![info exists LD] then {
275 set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
276}
277
278if ![info exists LDFLAGS] then {
279 set LDFLAGS {}
280}
This page took 0.639193 seconds and 4 git commands to generate.