1 # Copyright
2002, 2004, 2006, 2007, 2009 Free Software Foundation
, Inc.
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.
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.
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.
17 if {![istarget
"i*86-*-*"]
18 && ![istarget
"x86_64-*-mingw*"]
19 && ![istarget
"arm-*-pe*"]} {
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"
33 if {![info exists DLLTOOL
]} then {
37 if {[which $DLLTOOL
] == 0} then {
41 verbose
"$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1
42 catch
"exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err
44 if ![string match
"" $err] then {
47 fail
"dlltool (fastcall export)"
49 pass
"dlltool (fastcall export)"
52 if { "$target_xfail" == "yes" } {
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
59 if ![string match
"" $err] then {
62 fail
"dlltool (version.dll)"
64 pass
"dlltool (version.dll)"
67 if { "$target_xfail" == "yes" } {
71 verbose
"$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
72 catch
"exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
74 if ![string match
"" $err] then {
77 fail
"dlltool -p (execution)"
81 pass
"dlltool -p (execution)"
83 set got
[binutils_run $NM
"tmpdir/libalias.a"]
84 set want
"00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
86 if [regexp $want $got
] then {
87 pass
"dlltool -p (symbol names)"
89 fail
"dlltool -p (symbol names)"
92 set got
[binutils_run $OBJDUMP
"-s -j .idata\$6 tmpdir/libalias.a"]
93 set want
"(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
95 if [regexp $want $got
] then {
96 pass
"dlltool -p (import name)"
98 fail
"dlltool -p (import name)"
101 verbose
"$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
102 catch
"exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
104 if ![string match
"" $err] then {
107 fail
"dlltool -p (execution) alias-2.def"
111 pass
"dlltool -p (execution) alias-2.def"
113 set got
[binutils_run $NM
"tmpdir/libalias2.a"]
114 set want
"00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
116 if [regexp $want $got
] then {
117 pass
"dlltool -p (symbol names) alias-2.def"
119 fail
"dlltool -p (symbol names) alias-2.def"
122 set got
[binutils_run $OBJDUMP
"-s -j .idata\$6 tmpdir/libalias2.a"]
123 set want
"(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
125 if [regexp $want $got
] then {
126 pass
"dlltool -p (import name) alias-2.def"
128 fail
"dlltool -p (import name) alias-2.def"
131 # Here we test explicit without leading underscore
133 verbose
"$DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" 1
134 catch
"exec $DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" err
136 if ![string match
"" $err] then {
139 fail
"dlltool (fastcall export no leading underscore)"
141 pass
"dlltool (fastcall export no leading underscore)"
144 if { "$target_xfail" == "yes" } {
148 verbose
"$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
149 catch
"exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
151 if ![string match
"" $err] then {
154 fail
"dlltool -p (execution no leading underscore)"
158 pass
"dlltool -p (execution no leading underscore)"
160 set got
[binutils_run $NM
"tmpdir/libalias_nu.a"]
161 set want
"00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
163 if [regexp $want $got
] then {
164 pass
"dlltool -p (symbol names no leading underscore)"
166 fail
"dlltool -p (symbol names no leading underscore)"
169 set got
[binutils_run $OBJDUMP
"-s -j .idata\$6 tmpdir/libalias_nu.a"]
170 set want
"(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
172 if [regexp $want $got
] then {
173 pass
"dlltool -p (import name no leading underscore)"
175 fail
"dlltool -p (import name no leading underscore)"
178 verbose
"$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
179 catch
"exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
181 if ![string match
"" $err] then {
184 fail
"dlltool -p (execution no leading underscore) alias-2.def"
188 pass
"dlltool -p (execution no leading underscore) alias-2.def"
190 set got
[binutils_run $NM
"tmpdir/libalias_nu2.a"]
191 set want
"00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
193 if [regexp $want $got
] then {
194 pass
"dlltool -p (symbol names no leading underscore) alias-2.def"
196 fail
"dlltool -p (symbol names no leading underscore) alias-2.def"
199 set got
[binutils_run $OBJDUMP
"-s -j .idata\$6 tmpdir/libalias_nu2.a"]
200 set want
"(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
202 if [regexp $want $got
] then {
203 pass
"dlltool -p (import name no leading underscore) alias-2.def"
205 fail
"dlltool -p (import name no leading underscore) alias-2.def"
208 # Now we test with leading underscore
209 verbose
"$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1
210 catch
"exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err
212 if ![string match
"" $err] then {
215 fail
"dlltool (fastcall export leading underscore)"
217 pass
"dlltool (fastcall export leading underscore)"
220 if { "$target_xfail" == "yes" } {
224 verbose
"$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
225 catch
"exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
227 if ![string match
"" $err] then {
230 fail
"dlltool -p (execution leading underscore)"
234 pass
"dlltool -p (execution leading-underscore)"
236 set got
[binutils_run $NM
"tmpdir/libalias_u.a"]
237 set want
"00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
239 if [regexp $want $got
] then {
240 pass
"dlltool -p (symbol names leading underscore)"
242 fail
"dlltool -p (symbol names leading underscore)"
245 set got
[binutils_run $OBJDUMP
"-s -j .idata\$6 tmpdir/libalias_u.a"]
246 set want
"(Contents of section .idata\\\$6:.*\\.\\.symbol\\..*){2,2}"
248 if [regexp $want $got
] then {
249 pass
"dlltool -p (import name leading underscore)"
251 fail
"dlltool -p (import name leading underscore)"
254 verbose
"$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
255 catch
"exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
257 if ![string match
"" $err] then {
260 fail
"dlltool -p (execution) alias-2.def"
264 pass
"dlltool -p (execution leading underscore) alias-2.def"
266 set got
[binutils_run $NM
"tmpdir/libalias_u2.a"]
267 set want
"00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
269 if [regexp $want $got
] then {
270 pass
"dlltool -p (symbol names leading underscore) alias-2.def"
272 fail
"dlltool -p (symbol names leading underscore) alias-2.def"
275 set got
[binutils_run $OBJDUMP
"-s -j .idata\$6 tmpdir/libalias_u2.a"]
276 set want
"(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
278 if [regexp $want $got
] then {
279 pass
"dlltool -p (import name leading underscore) alias-2.def"
281 fail
"dlltool -p (import name leading underscore) alias-2.def"