Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # Basic expect script for LD Regression Tests |
2 | # Copyright (C) 1993, 94, 95, 97, 98, 1999 Free Software Foundation | |
3 | # | |
4 | # This file is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | # | |
18 | # Written by Jeffrey Wheat (cassidy@cygnus.com) | |
19 | # | |
20 | ||
21 | if ![info exists ld] then { | |
22 | set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]] | |
23 | } | |
24 | ||
25 | if ![info exists as] then { | |
26 | set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]] | |
27 | } | |
28 | ||
29 | if ![info exists nm] then { | |
30 | set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]] | |
31 | } | |
32 | ||
33 | if ![info exists objdump] then { | |
34 | set objdump [findfile $base_dir/../binutils/objdump] | |
35 | } | |
36 | ||
37 | if ![info exists objcopy] then { | |
38 | set objcopy [findfile $base_dir/../binutils/objcopy] | |
39 | } | |
40 | ||
41 | if ![info exists ar] then { | |
42 | set ar [findfile $base_dir/../binutils/ar] | |
43 | } | |
44 | ||
45 | if ![info exists strip] then { | |
46 | set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]] | |
47 | } | |
48 | ||
49 | if {![file isdirectory tmpdir]} then { | |
50 | catch "exec mkdir tmpdir" status | |
51 | } | |
52 | ||
53 | # Make a symlink from tmpdir/as to the assembler in the build tree, so | |
54 | # that we can use a -B option to gcc to force it to use the newly | |
55 | # built assembler. | |
56 | if {![file isdirectory tmpdir/gas]} then { | |
57 | catch "exec mkdir tmpdir/gas" status | |
58 | catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status | |
59 | } | |
60 | set gcc_gas_flag "-B[pwd]/tmpdir/gas/" | |
61 | ||
62 | # load the utility procedures | |
63 | load_lib ld-lib.exp | |
64 | ||
65 | proc get_link_files {varname} { | |
66 | global $varname | |
67 | global target_triplet | |
68 | global srcdir | |
69 | global CC | |
70 | if ![info exists $varname] { | |
71 | set status [catch "exec sh -c \"host='$target_triplet' && CC='$CC' && . $srcdir/../configure.host && eval echo \\$$varname\"" result] | |
72 | if $status { error "Error getting native link files: $result" } | |
73 | set $varname $result | |
74 | } | |
75 | } | |
76 | ||
77 | proc get_target_emul {} { | |
78 | global target_triplet | |
79 | global srcdir | |
80 | set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result] | |
81 | if $status { error "Error getting emulation name: $result" } | |
82 | return $result | |
83 | } | |
84 | ||
85 | if [isnative] { | |
86 | foreach x {HOSTING_CRT0 HOSTING_LIBS} { | |
87 | get_link_files $x | |
88 | } | |
89 | } else { | |
90 | foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" } | |
91 | } | |
92 | if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" } | |
93 | ||
94 | # | |
95 | # ld_version -- extract and print the version number of ld compiler (GCC) | |
96 | # | |
97 | proc ld_version {} { | |
98 | global ld | |
99 | default_ld_version $ld | |
100 | } | |
101 | ||
102 | # | |
103 | # ld_exit -- just a stub for ld | |
104 | # | |
105 | proc ld_exit {} { | |
106 | } | |
107 | ||
108 | # | |
109 | # ld_start | |
110 | # relink the linker | |
111 | # | |
112 | proc ld_start { ld target } { | |
113 | # | |
114 | } | |
115 | ||
116 | # | |
117 | # ld_relocate | |
118 | # link an object using relocation | |
119 | # | |
120 | proc ld_relocate { ld target objects } { | |
121 | default_ld_relocate $ld $target $objects | |
122 | } | |
123 | ||
124 | # | |
125 | # ld_link | |
126 | # link a program using ld | |
127 | # | |
128 | proc ld_link { ld target objects } { | |
129 | default_ld_link $ld $target $objects | |
130 | } | |
131 | ||
132 | # | |
133 | # ld_simple_link | |
134 | # link a program using ld, without including any libraries | |
135 | # | |
136 | proc ld_simple_link { ld target objects } { | |
137 | default_ld_simple_link $ld $target $objects | |
138 | } | |
139 | ||
140 | # | |
141 | # ld_compile | |
142 | # compile an object using $cc | |
143 | # | |
144 | proc ld_compile { cc source object } { | |
145 | default_ld_compile $cc $source $object | |
146 | } | |
147 | ||
148 | # | |
149 | # ld_assemble | |
150 | # assemble a file | |
151 | # | |
152 | proc ld_assemble { as source object } { | |
153 | default_ld_assemble $as $source $object | |
154 | } | |
155 | ||
156 | # | |
157 | # ld_nm | |
158 | # run nm on a file | |
159 | # | |
160 | proc ld_nm { nm object } { | |
161 | default_ld_nm $nm $object | |
162 | } | |
163 | ||
164 | # | |
165 | # ld_exec | |
166 | # execute ithe target | |
167 | # | |
168 | proc ld_exec { target output } { | |
169 | default_ld_exec $target $output | |
170 | } | |
171 |