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