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-*-*"] && ![istarget "x86_64-*-mingw*"] && ![istarget "arm-*-pe*]} {
21 if {![istarget "i*86-*-*pe*"] \
22 && ![istarget "i*86-*-cygwin*"] \
23 && ![istarget "i*86-*-mingw32*"] \
24 && ![istarget "arm-*-pe*"] \
25 && ![istarget "x86_64-*-mingw*"] } {
26 set target_xfail "yes"
31 if {![info exists DLLTOOL]} then {
35 if {[which $DLLTOOL] == 0} then {
39 verbose "$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1
40 catch "exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err
42 if ![string match "" $err] then {
45 fail "dlltool (fastcall export)"
47 pass "dlltool (fastcall export)"
50 if { "$target_xfail" == "yes" } {
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
57 if ![string match "" $err] then {
60 fail "dlltool -p (execution)"
64 pass "dlltool -p (execution)"
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"
69 if [regexp $want $got] then {
70 pass "dlltool -p (symbol names)"
72 fail "dlltool -p (symbol names)"
75 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias.a"]
76 set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
78 if [regexp $want $got] then {
79 pass "dlltool -p (import name)"
81 fail "dlltool -p (import name)"
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
87 if ![string match "" $err] then {
90 fail "dlltool -p (execution) alias-2.def"
94 pass "dlltool -p (execution) alias-2.def"
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"
99 if [regexp $want $got] then {
100 pass "dlltool -p (symbol names) alias-2.def"
102 fail "dlltool -p (symbol names) alias-2.def"
105 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias2.a"]
106 set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
108 if [regexp $want $got] then {
109 pass "dlltool -p (import name) alias-2.def"
111 fail "dlltool -p (import name) alias-2.def"
114 # Here we test explicit without leading underscore
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
119 if ![string match "" $err] then {
122 fail "dlltool (fastcall export no leading underscore)"
124 pass "dlltool (fastcall export no leading underscore)"
127 if { "$target_xfail" == "yes" } {
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
134 if ![string match "" $err] then {
137 fail "dlltool -p (execution no leading underscore)"
141 pass "dlltool -p (execution no leading underscore)"
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"
146 if [regexp $want $got] then {
147 pass "dlltool -p (symbol names no leading underscore)"
149 fail "dlltool -p (symbol names no leading underscore)"
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}"
155 if [regexp $want $got] then {
156 pass "dlltool -p (import name no leading underscore)"
158 fail "dlltool -p (import name no leading underscore)"
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
164 if ![string match "" $err] then {
167 fail "dlltool -p (execution no leading underscore) alias-2.def"
171 pass "dlltool -p (execution no leading underscore) alias-2.def"
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"
176 if [regexp $want $got] then {
177 pass "dlltool -p (symbol names no leading underscore) alias-2.def"
179 fail "dlltool -p (symbol names no leading underscore) alias-2.def"
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}"
185 if [regexp $want $got] then {
186 pass "dlltool -p (import name no leading underscore) alias-2.def"
188 fail "dlltool -p (import name no leading underscore) alias-2.def"
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
195 if ![string match "" $err] then {
198 fail "dlltool (fastcall export leading underscore)"
200 pass "dlltool (fastcall export leading underscore)"
203 if { "$target_xfail" == "yes" } {
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
210 if ![string match "" $err] then {
213 fail "dlltool -p (execution leading underscore)"
217 pass "dlltool -p (execution leading-underscore)"
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"
222 if [regexp $want $got] then {
223 pass "dlltool -p (symbol names leading underscore)"
225 fail "dlltool -p (symbol names leading underscore)"
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}"
231 if [regexp $want $got] then {
232 pass "dlltool -p (import name leading underscore)"
234 fail "dlltool -p (import name leading underscore)"
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
240 if ![string match "" $err] then {
243 fail "dlltool -p (execution) alias-2.def"
247 pass "dlltool -p (execution leading underscore) alias-2.def"
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"
252 if [regexp $want $got] then {
253 pass "dlltool -p (symbol names leading underscore) alias-2.def"
255 fail "dlltool -p (symbol names leading underscore) alias-2.def"
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}"
261 if [regexp $want $got] then {
262 pass "dlltool -p (import name leading underscore) alias-2.def"
264 fail "dlltool -p (import name leading underscore) alias-2.def"