Commit | Line | Data |
---|---|---|
aa820537 | 1 | # Copyright 2002, 2004, 2006, 2007, 2009 Free Software Foundation, Inc. |
c9e38879 NC |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
32866df7 | 5 | # the Free Software Foundation; either version 3 of the License, or |
c9e38879 NC |
6 | # (at your option) any later version. |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program; if not, write to the Free Software | |
b43b5d5f | 15 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
c9e38879 | 16 | |
1d2ca237 | 17 | if {![istarget "i*86-*-*"] && ![istarget "x86_64-*-mingw*"] && ![istarget "arm-*-pe*]} { |
c9e38879 NC |
18 | return |
19 | } | |
20 | ||
21 | if {![istarget "i*86-*-*pe*"] \ | |
22 | && ![istarget "i*86-*-cygwin*"] \ | |
99ad8390 | 23 | && ![istarget "i*86-*-mingw32*"] \ |
1d2ca237 | 24 | && ![istarget "arm-*-pe*"] \ |
42037fe5 | 25 | && ![istarget "x86_64-*-mingw*"] } { |
c9e38879 NC |
26 | set target_xfail "yes" |
27 | } else { | |
28 | set target_xfail "no" | |
29 | } | |
30 | ||
31 | if {![info exists DLLTOOL]} then { | |
32 | return | |
33 | } | |
34 | ||
35 | if {[which $DLLTOOL] == 0} then { | |
36 | return | |
37 | } | |
38 | ||
1d2ca237 KT |
39 | verbose "$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1 |
40 | catch "exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err | |
c9e38879 NC |
41 | |
42 | if ![string match "" $err] then { | |
43 | send_log "$err\n" | |
44 | verbose "$err" 1 | |
45 | fail "dlltool (fastcall export)" | |
0fd555c4 NC |
46 | } else { |
47 | pass "dlltool (fastcall export)" | |
c9e38879 NC |
48 | } |
49 | ||
e4c8d1e4 L |
50 | if { "$target_xfail" == "yes" } { |
51 | setup_xfail *-* | |
52 | } | |
53 | ||
1d2ca237 KT |
54 | verbose "$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1 |
55 | catch "exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err | |
607dea97 NC |
56 | |
57 | if ![string match "" $err] then { | |
58 | send_log "$err\n" | |
59 | verbose "$err" 1 | |
0fd555c4 | 60 | fail "dlltool -p (execution)" |
607dea97 NC |
61 | continue |
62 | } | |
63 | ||
0fd555c4 NC |
64 | pass "dlltool -p (execution)" |
65 | ||
66 | set got [binutils_run $NM "tmpdir/libalias.a"] | |
67 | set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol" | |
68 | ||
69 | if [regexp $want $got] then { | |
70 | pass "dlltool -p (symbol names)" | |
71 | } else { | |
72 | fail "dlltool -p (symbol names)" | |
73 | } | |
74 | ||
75 | set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias.a"] | |
76 | set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}" | |
77 | ||
78 | if [regexp $want $got] then { | |
79 | pass "dlltool -p (import name)" | |
80 | } else { | |
81 | fail "dlltool -p (import name)" | |
82 | } | |
bf201fdd | 83 | |
1d2ca237 KT |
84 | verbose "$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1 |
85 | catch "exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err | |
bf201fdd KT |
86 | |
87 | if ![string match "" $err] then { | |
88 | send_log "$err\n" | |
89 | verbose "$err" 1 | |
90 | fail "dlltool -p (execution) alias-2.def" | |
91 | continue | |
92 | } | |
93 | ||
94 | pass "dlltool -p (execution) alias-2.def" | |
95 | ||
96 | set got [binutils_run $NM "tmpdir/libalias2.a"] | |
97 | set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol" | |
98 | ||
99 | if [regexp $want $got] then { | |
100 | pass "dlltool -p (symbol names) alias-2.def" | |
101 | } else { | |
102 | fail "dlltool -p (symbol names) alias-2.def" | |
103 | } | |
104 | ||
105 | set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias2.a"] | |
106 | set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}" | |
107 | ||
108 | if [regexp $want $got] then { | |
109 | pass "dlltool -p (import name) alias-2.def" | |
110 | } else { | |
111 | fail "dlltool -p (import name) alias-2.def" | |
112 | } | |
0bd7136a KT |
113 | |
114 | # Here we test explicit without leading underscore | |
115 | ||
116 | verbose "$DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" 1 | |
117 | catch "exec $DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" err | |
118 | ||
119 | if ![string match "" $err] then { | |
120 | send_log "$err\n" | |
121 | verbose "$err" 1 | |
122 | fail "dlltool (fastcall export no leading underscore)" | |
123 | } else { | |
124 | pass "dlltool (fastcall export no leading underscore)" | |
125 | } | |
126 | ||
127 | if { "$target_xfail" == "yes" } { | |
128 | setup_xfail *-* | |
129 | } | |
130 | ||
131 | verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1 | |
132 | catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err | |
133 | ||
134 | if ![string match "" $err] then { | |
135 | send_log "$err\n" | |
136 | verbose "$err" 1 | |
137 | fail "dlltool -p (execution no leading underscore)" | |
138 | continue | |
139 | } | |
140 | ||
141 | pass "dlltool -p (execution no leading underscore)" | |
142 | ||
143 | set got [binutils_run $NM "tmpdir/libalias_nu.a"] | |
144 | set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol" | |
145 | ||
146 | if [regexp $want $got] then { | |
147 | pass "dlltool -p (symbol names no leading underscore)" | |
148 | } else { | |
149 | fail "dlltool -p (symbol names no leading underscore)" | |
150 | } | |
151 | ||
152 | set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu.a"] | |
153 | set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}" | |
154 | ||
155 | if [regexp $want $got] then { | |
156 | pass "dlltool -p (import name no leading underscore)" | |
157 | } else { | |
158 | fail "dlltool -p (import name no leading underscore)" | |
159 | } | |
160 | ||
161 | verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1 | |
162 | catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err | |
163 | ||
164 | if ![string match "" $err] then { | |
165 | send_log "$err\n" | |
166 | verbose "$err" 1 | |
167 | fail "dlltool -p (execution no leading underscore) alias-2.def" | |
168 | continue | |
169 | } | |
170 | ||
171 | pass "dlltool -p (execution no leading underscore) alias-2.def" | |
172 | ||
173 | set got [binutils_run $NM "tmpdir/libalias_nu2.a"] | |
174 | set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol" | |
175 | ||
176 | if [regexp $want $got] then { | |
177 | pass "dlltool -p (symbol names no leading underscore) alias-2.def" | |
178 | } else { | |
179 | fail "dlltool -p (symbol names no leading underscore) alias-2.def" | |
180 | } | |
181 | ||
182 | set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu2.a"] | |
183 | set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}" | |
184 | ||
185 | if [regexp $want $got] then { | |
186 | pass "dlltool -p (import name no leading underscore) alias-2.def" | |
187 | } else { | |
188 | fail "dlltool -p (import name no leading underscore) alias-2.def" | |
189 | } | |
190 | ||
191 | # Now we test with leading underscore | |
192 | verbose "$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1 | |
193 | catch "exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err | |
194 | ||
195 | if ![string match "" $err] then { | |
196 | send_log "$err\n" | |
197 | verbose "$err" 1 | |
198 | fail "dlltool (fastcall export leading underscore)" | |
199 | } else { | |
200 | pass "dlltool (fastcall export leading underscore)" | |
201 | } | |
202 | ||
203 | if { "$target_xfail" == "yes" } { | |
204 | setup_xfail *-* | |
205 | } | |
206 | ||
207 | verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1 | |
208 | catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err | |
209 | ||
210 | if ![string match "" $err] then { | |
211 | send_log "$err\n" | |
212 | verbose "$err" 1 | |
213 | fail "dlltool -p (execution leading underscore)" | |
214 | continue | |
215 | } | |
216 | ||
217 | pass "dlltool -p (execution leading-underscore)" | |
218 | ||
219 | set got [binutils_run $NM "tmpdir/libalias_u.a"] | |
220 | set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol" | |
221 | ||
222 | if [regexp $want $got] then { | |
223 | pass "dlltool -p (symbol names leading underscore)" | |
224 | } else { | |
225 | fail "dlltool -p (symbol names leading underscore)" | |
226 | } | |
227 | ||
228 | set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u.a"] | |
229 | set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\..*){2,2}" | |
230 | ||
231 | if [regexp $want $got] then { | |
232 | pass "dlltool -p (import name leading underscore)" | |
233 | } else { | |
234 | fail "dlltool -p (import name leading underscore)" | |
235 | } | |
236 | ||
237 | verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1 | |
238 | catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err | |
239 | ||
240 | if ![string match "" $err] then { | |
241 | send_log "$err\n" | |
242 | verbose "$err" 1 | |
243 | fail "dlltool -p (execution) alias-2.def" | |
244 | continue | |
245 | } | |
246 | ||
247 | pass "dlltool -p (execution leading underscore) alias-2.def" | |
248 | ||
249 | set got [binutils_run $NM "tmpdir/libalias_u2.a"] | |
250 | set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol" | |
251 | ||
252 | if [regexp $want $got] then { | |
253 | pass "dlltool -p (symbol names leading underscore) alias-2.def" | |
254 | } else { | |
255 | fail "dlltool -p (symbol names leading underscore) alias-2.def" | |
256 | } | |
257 | ||
258 | set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u2.a"] | |
259 | set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}" | |
260 | ||
261 | if [regexp $want $got] then { | |
262 | pass "dlltool -p (import name leading underscore) alias-2.def" | |
263 | } else { | |
264 | fail "dlltool -p (import name leading underscore) alias-2.def" | |
265 | } |