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