| 1 |
15 |
khays |
# 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 -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
|
| 57 |
|
|
catch "exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
|
| 58 |
|
|
|
| 59 |
|
|
if ![string match "" $err] then {
|
| 60 |
|
|
send_log "$err\n"
|
| 61 |
|
|
verbose "$err" 1
|
| 62 |
|
|
fail "dlltool -p (execution)"
|
| 63 |
|
|
continue
|
| 64 |
|
|
}
|
| 65 |
|
|
|
| 66 |
|
|
pass "dlltool -p (execution)"
|
| 67 |
|
|
|
| 68 |
|
|
set got [binutils_run $NM "tmpdir/libalias.a"]
|
| 69 |
|
|
set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
|
| 70 |
|
|
|
| 71 |
|
|
if [regexp $want $got] then {
|
| 72 |
|
|
pass "dlltool -p (symbol names)"
|
| 73 |
|
|
} else {
|
| 74 |
|
|
fail "dlltool -p (symbol names)"
|
| 75 |
|
|
}
|
| 76 |
|
|
|
| 77 |
|
|
set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias.a"]
|
| 78 |
|
|
set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
|
| 79 |
|
|
|
| 80 |
|
|
if [regexp $want $got] then {
|
| 81 |
|
|
pass "dlltool -p (import name)"
|
| 82 |
|
|
} else {
|
| 83 |
|
|
fail "dlltool -p (import name)"
|
| 84 |
|
|
}
|
| 85 |
|
|
|
| 86 |
|
|
verbose "$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
|
| 87 |
|
|
catch "exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
|
| 88 |
|
|
|
| 89 |
|
|
if ![string match "" $err] then {
|
| 90 |
|
|
send_log "$err\n"
|
| 91 |
|
|
verbose "$err" 1
|
| 92 |
|
|
fail "dlltool -p (execution) alias-2.def"
|
| 93 |
|
|
continue
|
| 94 |
|
|
}
|
| 95 |
|
|
|
| 96 |
|
|
pass "dlltool -p (execution) alias-2.def"
|
| 97 |
|
|
|
| 98 |
|
|
set got [binutils_run $NM "tmpdir/libalias2.a"]
|
| 99 |
|
|
set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
|
| 100 |
|
|
|
| 101 |
|
|
if [regexp $want $got] then {
|
| 102 |
|
|
pass "dlltool -p (symbol names) alias-2.def"
|
| 103 |
|
|
} else {
|
| 104 |
|
|
fail "dlltool -p (symbol names) alias-2.def"
|
| 105 |
|
|
}
|
| 106 |
|
|
|
| 107 |
|
|
set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias2.a"]
|
| 108 |
|
|
set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
|
| 109 |
|
|
|
| 110 |
|
|
if [regexp $want $got] then {
|
| 111 |
|
|
pass "dlltool -p (import name) alias-2.def"
|
| 112 |
|
|
} else {
|
| 113 |
|
|
fail "dlltool -p (import name) alias-2.def"
|
| 114 |
|
|
}
|
| 115 |
|
|
|
| 116 |
|
|
# Here we test explicit without leading underscore
|
| 117 |
|
|
|
| 118 |
|
|
verbose "$DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" 1
|
| 119 |
|
|
catch "exec $DLLTOOL --no-leading-underscore -d $srcdir/$subdir/fastcall.def" err
|
| 120 |
|
|
|
| 121 |
|
|
if ![string match "" $err] then {
|
| 122 |
|
|
send_log "$err\n"
|
| 123 |
|
|
verbose "$err" 1
|
| 124 |
|
|
fail "dlltool (fastcall export no leading underscore)"
|
| 125 |
|
|
} else {
|
| 126 |
|
|
pass "dlltool (fastcall export no leading underscore)"
|
| 127 |
|
|
}
|
| 128 |
|
|
|
| 129 |
|
|
if { "$target_xfail" == "yes" } {
|
| 130 |
|
|
setup_xfail *-*
|
| 131 |
|
|
}
|
| 132 |
|
|
|
| 133 |
|
|
verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
|
| 134 |
|
|
catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
|
| 135 |
|
|
|
| 136 |
|
|
if ![string match "" $err] then {
|
| 137 |
|
|
send_log "$err\n"
|
| 138 |
|
|
verbose "$err" 1
|
| 139 |
|
|
fail "dlltool -p (execution no leading underscore)"
|
| 140 |
|
|
continue
|
| 141 |
|
|
}
|
| 142 |
|
|
|
| 143 |
|
|
pass "dlltool -p (execution no leading underscore)"
|
| 144 |
|
|
|
| 145 |
|
|
set got [binutils_run $NM "tmpdir/libalias_nu.a"]
|
| 146 |
|
|
set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
|
| 147 |
|
|
|
| 148 |
|
|
if [regexp $want $got] then {
|
| 149 |
|
|
pass "dlltool -p (symbol names no leading underscore)"
|
| 150 |
|
|
} else {
|
| 151 |
|
|
fail "dlltool -p (symbol names no leading underscore)"
|
| 152 |
|
|
}
|
| 153 |
|
|
|
| 154 |
|
|
set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu.a"]
|
| 155 |
|
|
set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\.\\..*){2,2}"
|
| 156 |
|
|
|
| 157 |
|
|
if [regexp $want $got] then {
|
| 158 |
|
|
pass "dlltool -p (import name no leading underscore)"
|
| 159 |
|
|
} else {
|
| 160 |
|
|
fail "dlltool -p (import name no leading underscore)"
|
| 161 |
|
|
}
|
| 162 |
|
|
|
| 163 |
|
|
verbose "$DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
|
| 164 |
|
|
catch "exec $DLLTOOL --no-leading-underscore -p prefix -l tmpdir/libalias_nu2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
|
| 165 |
|
|
|
| 166 |
|
|
if ![string match "" $err] then {
|
| 167 |
|
|
send_log "$err\n"
|
| 168 |
|
|
verbose "$err" 1
|
| 169 |
|
|
fail "dlltool -p (execution no leading underscore) alias-2.def"
|
| 170 |
|
|
continue
|
| 171 |
|
|
}
|
| 172 |
|
|
|
| 173 |
|
|
pass "dlltool -p (execution no leading underscore) alias-2.def"
|
| 174 |
|
|
|
| 175 |
|
|
set got [binutils_run $NM "tmpdir/libalias_nu2.a"]
|
| 176 |
|
|
set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
|
| 177 |
|
|
|
| 178 |
|
|
if [regexp $want $got] then {
|
| 179 |
|
|
pass "dlltool -p (symbol names no leading underscore) alias-2.def"
|
| 180 |
|
|
} else {
|
| 181 |
|
|
fail "dlltool -p (symbol names no leading underscore) alias-2.def"
|
| 182 |
|
|
}
|
| 183 |
|
|
|
| 184 |
|
|
set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_nu2.a"]
|
| 185 |
|
|
set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
|
| 186 |
|
|
|
| 187 |
|
|
if [regexp $want $got] then {
|
| 188 |
|
|
pass "dlltool -p (import name no leading underscore) alias-2.def"
|
| 189 |
|
|
} else {
|
| 190 |
|
|
fail "dlltool -p (import name no leading underscore) alias-2.def"
|
| 191 |
|
|
}
|
| 192 |
|
|
|
| 193 |
|
|
# Now we test with leading underscore
|
| 194 |
|
|
verbose "$DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" 1
|
| 195 |
|
|
catch "exec $DLLTOOL --leading-underscore -d $srcdir/$subdir/fastcall.def" err
|
| 196 |
|
|
|
| 197 |
|
|
if ![string match "" $err] then {
|
| 198 |
|
|
send_log "$err\n"
|
| 199 |
|
|
verbose "$err" 1
|
| 200 |
|
|
fail "dlltool (fastcall export leading underscore)"
|
| 201 |
|
|
} else {
|
| 202 |
|
|
pass "dlltool (fastcall export leading underscore)"
|
| 203 |
|
|
}
|
| 204 |
|
|
|
| 205 |
|
|
if { "$target_xfail" == "yes" } {
|
| 206 |
|
|
setup_xfail *-*
|
| 207 |
|
|
}
|
| 208 |
|
|
|
| 209 |
|
|
verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
|
| 210 |
|
|
catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
|
| 211 |
|
|
|
| 212 |
|
|
if ![string match "" $err] then {
|
| 213 |
|
|
send_log "$err\n"
|
| 214 |
|
|
verbose "$err" 1
|
| 215 |
|
|
fail "dlltool -p (execution leading underscore)"
|
| 216 |
|
|
continue
|
| 217 |
|
|
}
|
| 218 |
|
|
|
| 219 |
|
|
pass "dlltool -p (execution leading-underscore)"
|
| 220 |
|
|
|
| 221 |
|
|
set got [binutils_run $NM "tmpdir/libalias_u.a"]
|
| 222 |
|
|
set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
|
| 223 |
|
|
|
| 224 |
|
|
if [regexp $want $got] then {
|
| 225 |
|
|
pass "dlltool -p (symbol names leading underscore)"
|
| 226 |
|
|
} else {
|
| 227 |
|
|
fail "dlltool -p (symbol names leading underscore)"
|
| 228 |
|
|
}
|
| 229 |
|
|
|
| 230 |
|
|
set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u.a"]
|
| 231 |
|
|
set want "(Contents of section .idata\\\$6:.*\\.\\.symbol\\..*){2,2}"
|
| 232 |
|
|
|
| 233 |
|
|
if [regexp $want $got] then {
|
| 234 |
|
|
pass "dlltool -p (import name leading underscore)"
|
| 235 |
|
|
} else {
|
| 236 |
|
|
fail "dlltool -p (import name leading underscore)"
|
| 237 |
|
|
}
|
| 238 |
|
|
|
| 239 |
|
|
verbose "$DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" 1
|
| 240 |
|
|
catch "exec $DLLTOOL --leading-underscore -p prefix -l tmpdir/libalias_u2.a -d $srcdir/$subdir/alias-2.def $dlltool_gas_flag" err
|
| 241 |
|
|
|
| 242 |
|
|
if ![string match "" $err] then {
|
| 243 |
|
|
send_log "$err\n"
|
| 244 |
|
|
verbose "$err" 1
|
| 245 |
|
|
fail "dlltool -p (execution) alias-2.def"
|
| 246 |
|
|
continue
|
| 247 |
|
|
}
|
| 248 |
|
|
|
| 249 |
|
|
pass "dlltool -p (execution leading underscore) alias-2.def"
|
| 250 |
|
|
|
| 251 |
|
|
set got [binutils_run $NM "tmpdir/libalias_u2.a"]
|
| 252 |
|
|
set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
|
| 253 |
|
|
|
| 254 |
|
|
if [regexp $want $got] then {
|
| 255 |
|
|
pass "dlltool -p (symbol names leading underscore) alias-2.def"
|
| 256 |
|
|
} else {
|
| 257 |
|
|
fail "dlltool -p (symbol names leading underscore) alias-2.def"
|
| 258 |
|
|
}
|
| 259 |
|
|
|
| 260 |
|
|
set got [binutils_run $OBJDUMP "-s -j .idata\$6 tmpdir/libalias_u2.a"]
|
| 261 |
|
|
set want "(Contents of section .idata\\\$6:.*\\.\\.something\\..*){2,2}"
|
| 262 |
|
|
|
| 263 |
|
|
if [regexp $want $got] then {
|
| 264 |
|
|
pass "dlltool -p (import name leading underscore) alias-2.def"
|
| 265 |
|
|
} else {
|
| 266 |
|
|
fail "dlltool -p (import name leading underscore) alias-2.def"
|
| 267 |
|
|
}
|