ChangeLog binutils
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / dlltool.exp
1 # Copyright 2002, 2004, 2006, 2007, 2009 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
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
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17 if {![istarget "i*86-*-*"]
18 && ![istarget "x86_64-*-mingw*"]
19 && ![istarget "arm-*-pe*"]} {
20 return
21 }
22
23 if {![istarget "i*86-*-*pe*"] \
24 && ![istarget "i*86-*-cygwin*"] \
25 && ![istarget "i*86-*-mingw32*"] \
26 && ![istarget "arm-*-pe*"] \
27 && ![istarget "x86_64-*-mingw*"] } {
28 set target_xfail "yes"
29 } else {
30 set target_xfail "no"
31 }
32
33 if {![info exists DLLTOOL]} then {
34 return
35 }
36
37 if {[which $DLLTOOL] == 0} then {
38 return
39 }
40
41 verbose "$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1
42 catch "exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err
43
44 if ![string match "" $err] then {
45 send_log "$err\n"
46 verbose "$err" 1
47 fail "dlltool (fastcall export)"
48 } else {
49 pass "dlltool (fastcall export)"
50 }
51
52 if { "$target_xfail" == "yes" } {
53 setup_xfail *-*
54 }
55
56 verbose "$DLLTOOL -l libversion.a --def $srcdir/$subdir/version.def" 1
57 catch "exec $DLLTOOL -l libersion.a --def $srcdir/$subdir/version.def" err
58
59 if ![string match "" $err] then {
60 send_log "$err\n"
61 verbose "$err" 1
62 fail "dlltool (version.dll)"
63 } else {
64 pass "dlltool (version.dll)"
65 }
66
67 verbose "$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
68 catch "exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
69
70 if ![string match "" $err] then {
71 send_log "$err\n"
72 verbose "$err" 1
73 fail "dlltool -p (execution)"
74 continue
75 }
76
77 pass "dlltool -p (execution)"
78
79 set got [binutils_run $NM "tmpdir/libalias.a"]
80 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
81
82 if [regexp $want $got] then {
83 pass "dlltool -p (symbol names)"
84 } else {
85 fail "dlltool -p (symbol names)"
86 }
87
88 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias.a"]
89 set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
90
91 if [regexp $want $got] then {
92 pass "dlltool -p (import name)"
93 } else {
94 fail "dlltool -p (import name)"
95 }
96
97 verbose "$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
98 catch "exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
99
100 if ![string match "" $err] then {
101 send_log "$err\n"
102 verbose "$err" 1
103 fail "dlltool -p (execution) alias-2.def"
104 continue
105 }
106
107 pass "dlltool -p (execution) alias-2.def"
108
109 set got [binutils_run $NM "tmpdir/libalias2.a"]
110 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
111
112 if [regexp $want $got] then {
113 pass "dlltool -p (symbol names) alias-2.def"
114 } else {
115 fail "dlltool -p (symbol names) alias-2.def"
116 }
117
118 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias2.a"]
119 set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
120
121 if [regexp $want $got] then {
122 pass "dlltool -p (import name) alias-2.def"
123 } else {
124 fail "dlltool -p (import name) alias-2.def"
125 }
126
127 # Here we test explicit without leading underscore
128
129 verbose "$DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" 1
130 catch "exec $DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" err
131
132 if ![string match "" $err] then {
133 send_log "$err\n"
134 verbose "$err" 1
135 fail "dlltool (fastcall export no leading underscore)"
136 } else {
137 pass "dlltool (fastcall export no leading underscore)"
138 }
139
140 if { "$target_xfail" == "yes" } {
141 setup_xfail *-*
142 }
143
144 verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
145 catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
146
147 if ![string match "" $err] then {
148 send_log "$err\n"
149 verbose "$err" 1
150 fail "dlltool -p (execution no leading underscore)"
151 continue
152 }
153
154 pass "dlltool -p (execution no leading underscore)"
155
156 set got [binutils_run $NM "tmpdir/libalias_nu.a"]
157 set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
158
159 if [regexp $want $got] then {
160 pass "dlltool -p (symbol names no leading underscore)"
161 } else {
162 fail "dlltool -p (symbol names no leading underscore)"
163 }
164
165 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu.a"]
166 set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
167
168 if [regexp $want $got] then {
169 pass "dlltool -p (import name no leading underscore)"
170 } else {
171 fail "dlltool -p (import name no leading underscore)"
172 }
173
174 verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
175 catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
176
177 if ![string match "" $err] then {
178 send_log "$err\n"
179 verbose "$err" 1
180 fail "dlltool -p (execution no leading underscore) alias-2.def"
181 continue
182 }
183
184 pass "dlltool -p (execution no leading underscore) alias-2.def"
185
186 set got [binutils_run $NM "tmpdir/libalias_nu2.a"]
187 set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
188
189 if [regexp $want $got] then {
190 pass "dlltool -p (symbol names no leading underscore) alias-2.def"
191 } else {
192 fail "dlltool -p (symbol names no leading underscore) alias-2.def"
193 }
194
195 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu2.a"]
196 set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
197
198 if [regexp $want $got] then {
199 pass "dlltool -p (import name no leading underscore) alias-2.def"
200 } else {
201 fail "dlltool -p (import name no leading underscore) alias-2.def"
202 }
203
204 # Now we test with leading underscore
205 verbose "$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1
206 catch "exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err
207
208 if ![string match "" $err] then {
209 send_log "$err\n"
210 verbose "$err" 1
211 fail "dlltool (fastcall export leading underscore)"
212 } else {
213 pass "dlltool (fastcall export leading underscore)"
214 }
215
216 if { "$target_xfail" == "yes" } {
217 setup_xfail *-*
218 }
219
220 verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
221 catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
222
223 if ![string match "" $err] then {
224 send_log "$err\n"
225 verbose "$err" 1
226 fail "dlltool -p (execution leading underscore)"
227 continue
228 }
229
230 pass "dlltool -p (execution leading-underscore)"
231
232 set got [binutils_run $NM "tmpdir/libalias_u.a"]
233 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
234
235 if [regexp $want $got] then {
236 pass "dlltool -p (symbol names leading underscore)"
237 } else {
238 fail "dlltool -p (symbol names leading underscore)"
239 }
240
241 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u.a"]
242 set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\..*){2,2}"
243
244 if [regexp $want $got] then {
245 pass "dlltool -p (import name leading underscore)"
246 } else {
247 fail "dlltool -p (import name leading underscore)"
248 }
249
250 verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
251 catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
252
253 if ![string match "" $err] then {
254 send_log "$err\n"
255 verbose "$err" 1
256 fail "dlltool -p (execution) alias-2.def"
257 continue
258 }
259
260 pass "dlltool -p (execution leading underscore) alias-2.def"
261
262 set got [binutils_run $NM "tmpdir/libalias_u2.a"]
263 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
264
265 if [regexp $want $got] then {
266 pass "dlltool -p (symbol names leading underscore) alias-2.def"
267 } else {
268 fail "dlltool -p (symbol names leading underscore) alias-2.def"
269 }
270
271 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u2.a"]
272 set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
273
274 if [regexp $want $got] then {
275 pass "dlltool -p (import name leading underscore) alias-2.def"
276 } else {
277 fail "dlltool -p (import name leading underscore) alias-2.def"
278 }
This page took 0.035375 seconds and 4 git commands to generate.