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*"] } {
21 if {![istarget "i*86-*-*pe*"] \
22 && ![istarget "i*86-*-cygwin*"] \
23 && ![istarget "i*86-*-mingw32*"] \
24 && ![istarget "x86_64-*-mingw*"] } {
25 set target_xfail "yes"
30 if {![info exists DLLTOOL]} then {
34 if {[which $DLLTOOL] == 0} then {
38 verbose "$DLLTOOL -d $srcdir/$subdir/fastcall.def" 1
39 catch "exec $DLLTOOL -d $srcdir/$subdir/fastcall.def" err
41 if ![string match "" $err] then {
44 fail "dlltool (fastcall export)"
46 pass "dlltool (fastcall export)"
49 if { "$target_xfail" == "yes" } {
53 verbose "$DLLTOOL -p prefix -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
54 catch "exec $DLLTOOL -p prefix -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
56 if ![string match "" $err] then {
59 fail "dlltool -p (execution)"
63 pass "dlltool -p (execution)"
65 set got [binutils_run $NM "tmpdir/libalias.a"]
66 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
68 if [regexp $want $got] then {
69 pass "dlltool -p (symbol names)"
71 fail "dlltool -p (symbol names)"
74 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias.a"]
75 set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
77 if [regexp $want $got] then {
78 pass "dlltool -p (import name)"
80 fail "dlltool -p (import name)"
83 verbose "$DLLTOOL -p prefix -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
84 catch "exec $DLLTOOL -p prefix -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
86 if ![string match "" $err] then {
89 fail "dlltool -p (execution) alias-2.def"
93 pass "dlltool -p (execution) alias-2.def"
95 set got [binutils_run $NM "tmpdir/libalias2.a"]
96 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
98 if [regexp $want $got] then {
99 pass "dlltool -p (symbol names) alias-2.def"
101 fail "dlltool -p (symbol names) alias-2.def"
104 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias2.a"]
105 set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
107 if [regexp $want $got] then {
108 pass "dlltool -p (import name) alias-2.def"
110 fail "dlltool -p (import name) alias-2.def"
113 # Here we test explicit without leading underscore
115 verbose "$DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" 1
116 catch "exec $DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" err
118 if ![string match "" $err] then {
121 fail "dlltool (fastcall export no leading underscore)"
123 pass "dlltool (fastcall export no leading underscore)"
126 if { "$target_xfail" == "yes" } {
130 verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
131 catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
133 if ![string match "" $err] then {
136 fail "dlltool -p (execution no leading underscore)"
140 pass "dlltool -p (execution no leading underscore)"
142 set got [binutils_run $NM "tmpdir/libalias_nu.a"]
143 set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
145 if [regexp $want $got] then {
146 pass "dlltool -p (symbol names no leading underscore)"
148 fail "dlltool -p (symbol names no leading underscore)"
151 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu.a"]
152 set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
154 if [regexp $want $got] then {
155 pass "dlltool -p (import name no leading underscore)"
157 fail "dlltool -p (import name no leading underscore)"
160 verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
161 catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
163 if ![string match "" $err] then {
166 fail "dlltool -p (execution no leading underscore) alias-2.def"
170 pass "dlltool -p (execution no leading underscore) alias-2.def"
172 set got [binutils_run $NM "tmpdir/libalias_nu2.a"]
173 set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
175 if [regexp $want $got] then {
176 pass "dlltool -p (symbol names no leading underscore) alias-2.def"
178 fail "dlltool -p (symbol names no leading underscore) alias-2.def"
181 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu2.a"]
182 set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
184 if [regexp $want $got] then {
185 pass "dlltool -p (import name no leading underscore) alias-2.def"
187 fail "dlltool -p (import name no leading underscore) alias-2.def"
190 # Now we test with leading underscore
191 verbose "$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1
192 catch "exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err
194 if ![string match "" $err] then {
197 fail "dlltool (fastcall export leading underscore)"
199 pass "dlltool (fastcall export leading underscore)"
202 if { "$target_xfail" == "yes" } {
206 verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
207 catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
209 if ![string match "" $err] then {
212 fail "dlltool -p (execution leading underscore)"
216 pass "dlltool -p (execution leading-underscore)"
218 set got [binutils_run $NM "tmpdir/libalias_u.a"]
219 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
221 if [regexp $want $got] then {
222 pass "dlltool -p (symbol names leading underscore)"
224 fail "dlltool -p (symbol names leading underscore)"
227 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u.a"]
228 set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\..*){2,2}"
230 if [regexp $want $got] then {
231 pass "dlltool -p (import name leading underscore)"
233 fail "dlltool -p (import name leading underscore)"
236 verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
237 catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
239 if ![string match "" $err] then {
242 fail "dlltool -p (execution) alias-2.def"
246 pass "dlltool -p (execution leading underscore) alias-2.def"
248 set got [binutils_run $NM "tmpdir/libalias_u2.a"]
249 set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
251 if [regexp $want $got] then {
252 pass "dlltool -p (symbol names leading underscore) alias-2.def"
254 fail "dlltool -p (symbol names leading underscore) alias-2.def"
257 set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u2.a"]
258 set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
260 if [regexp $want $got] then {
261 pass "dlltool -p (import name leading underscore) alias-2.def"
263 fail "dlltool -p (import name leading underscore) alias-2.def"