OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [testsuite/] [ld-elf/] [shared.exp] - Blame information for rev 163

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 53 khays
# Expect script for various ELF tests.
2
#   Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
3
#
4
# This file is part of the GNU Binutils.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19
# MA 02110-1301, USA.
20
#
21
 
22
# Exclude non-ELF targets.
23
 
24
# The following tests require running the executable generated by ld,
25
# or enough of a build environment to create a fully linked executable.
26
# This is not commonly available when testing a cross-built linker.
27
if ![isnative] {
28
    return
29
}
30
 
31
if ![is_elf_format] {
32
    return
33
}
34
 
35
# Check to see if the C compiler works
36
if { [which $CC] == 0 } {
37
    return
38
}
39
 
40
set build_tests {
41
  {"Build libfoo.so"
42
   "-shared" "-fPIC"
43
   {foo.c} {} "libfoo.so"}
44
  {"Build versioned libfoo.so"
45
   "-shared -Wl,--version-script=foo.map" "-fPIC"
46
   {foo.c} {} "libfoov.so"}
47
  {"Build libbar.so"
48
   "-shared" "-fPIC"
49
   {begin.c end.c} {} "libbar.so"}
50
  {"Build warn libbar.so"
51
   "-shared" "-fPIC"
52
   {beginwarn.c end.c} {} "libbarw.so"
53
    "C" "^.*\\\): warning: function foo is deprecated$"}
54
  {"Build hidden libbar.so"
55
   "-shared" "-fPIC"
56
   {begin.c endhidden.c} {} "libbarh.so"}
57
  {"Build protected libbar.so"
58
   "-shared" "-fPIC"
59
   {begin.c endprotected.c} {} "libbarp.so"}
60
  {"Build libbar.so with libfoo.so"
61
   "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
62
   {end.c} {} "libbarfoo.so"}
63
  {"Build libar.so with versioned libfoo.so"
64
   "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
65
   {end.c} {} "libbarfoov.so"}
66
  {"Build hidden libbar.so with libfoo.so"
67
   "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
68
   {endhidden.c} {} "libbarhfoo.so"}
69
  {"Build hidden libar.so with versioned libfoo.so"
70
   "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
71
   {endhidden.c} {} "libbarhfoov.so"}
72
  {"Build protected libbar.so with libfoo.so"
73
   "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
74
   {endprotected.c} {} "libbarpfoo.so"}
75
  {"Build protected libbar.so with versioned libfoo.so"
76
   "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
77
   {endprotected.c} {} "libbarpfoov.so"}
78
  {"Build libdl1.so"
79
   "-shared" "-fPIC"
80
   {dl1.c} {} "libdl1.so"}
81
  {"Build libdl2a.so with --dynamic-list=dl2.list"
82
   "-shared -Wl,--dynamic-list=dl2.list" "-fPIC"
83
   {dl2.c dl2xxx.c} {} "libdl2a.so"}
84
  {"Build libdl2a.so with --dynamic-list=dl2a.list"
85
   "-shared -Wl,--dynamic-list=dl2a.list" "-fPIC"
86
   {dl2.c dl2xxx.c} {} "libdl2a.so"}
87
  {"Build libdl2a.so with --dynamic-list-data"
88
   "-shared -Wl,--dynamic-list-data" "-fPIC"
89
   {dl2.c dl2xxx.c} {} "libdl2a.so"}
90
  {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
91
   "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
92
   {dl2.c dl2xxx.c} {} "libdl2b.so"}
93
  {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
94
   "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
95
   {dl2.c dl2xxx.c} {} "libdl2c.so"}
96
  {"Build libdl4a.so with --dynamic-list=dl4.list"
97
   "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
98
   {dl4.c dl4xxx.c} {} "libdl4a.so"}
99
  {"Build libdl4b.so with --dynamic-list-data"
100
   "-shared -Wl,--dynamic-list-data" "-fPIC"
101
   {dl4.c dl4xxx.c} {} "libdl4b.so"}
102
  {"Build libdl4c.so with --dynamic-list=dl4.list and dl4xxx.list"
103
   "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
104
   {dl4.c dl4xxx.c} {} "libdl4c.so"}
105
  {"Build libdl4d.so with --dynamic-list-data and dl4xxx.list"
106
   "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
107
   {dl4.c dl4xxx.c} {} "libdl4d.so"}
108
  {"Build libdl4e.so with -Bsymbolic-functions --dynamic-list-cpp-new"
109
   "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
110
   {dl4.c dl4xxx.c} {} "libdl4e.so"}
111
  {"Build libdl4f.so with --dynamic-list-cpp-new -Bsymbolic-functions"
112
   "-shared -Wl,--dynamic-list-cpp-new,-Bsymbolic-functions" "-fPIC"
113
   {dl4.c dl4xxx.c} {} "libdl4f.so"}
114
  {"Build libdl6a.so"
115
   "-shared" "-fPIC"
116
   {dl6.c} {} "libdl6a.so"}
117
  {"Build libdl6b.so with -Bsymbolic --dynamic-list-data"
118
   "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
119
   {dl6.c} {} "libdl6b.so"}
120
  {"Build libdl6c.so with -Bsymbolic"
121
   "-shared -Wl,-Bsymbolic" "-fPIC"
122
   {dl6.c} {} "libdl6c.so"}
123
  {"Build libdl6d.so with --dynamic-list-data -Bsymbolic"
124
   "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC"
125
   {dl6.c} {} "libdl6d.so"}
126
  {"Build libdata1.so"
127
   "-shared" "-fPIC"
128
   {data1.c} {} "libdata1.so"}
129
  {"Build libcomm1.o"
130
   "-r -nostdlib" ""
131
   {comm1.c} {} "libcomm1.o"}
132
  {"Build libfunc1.so"
133
   "-shared" "-fPIC"
134
   {func1.c} {} "libfunc1.so"}
135
  {"Build libpr9676-1.a"
136
   "" "-fPIC"
137
   {pr9676-1.c} {} "libpr9676-1.a"}
138
  {"Build libpr9676-2.a"
139
   "" "-fPIC"
140
   {pr9676-2.c} {} "libpr9676-2.a"}
141
  {"Build libpr9676-3.so"
142
   "-shared" "-fPIC"
143
   {pr9676-3.c} {} "libpr9676-3.so"}
144
  {"Build libpr9676-4.so"
145
   "-shared" "-fPIC"
146
   {pr9676-4.c} {} "libpr9676-4.so"}
147
  {"Build libpr9676-4a.so"
148
   "-shared tmpdir/pr9676-4.o -Ltmpdir -lpr9676-3 -Wl,--start-group -lpr9676-1 -lpr9676-2 -Wl,--end-group"
149
   "-fPIC"
150
   {dummy.c} {{readelf {-s} pr9676.rd}} "libpr9676-4a.so"}
151
  {"Build libpr9679.so"
152
   "-shared" "-fPIC -O0"
153
   {pr9679-1.c pr9679-2.c} {{readelf {-s} pr9679.rd}} "libpr9679.so"}
154
  {"Build libpr11138-1.so"
155
   "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
156
   {pr11138-1.c} {} "libpr11138-1.so"}
157
  {"Build libpr11138-2.o"
158
   "-r -nostdlib" ""
159
   {pr11138-2.c} {} "libpr11138-2.o"}
160 163 khays
  {"Build pr13250-1.so"
161
   "-shared" "-fPIC"
162
   {pr13250-1.c} {} "libpr13250-1.so"}
163
  {"Build pr13250-2.so with libpr13250-1.so"
164
   "-shared tmpdir/libpr13250-1.so" "-fPIC"
165
   {pr13250-2.c} {} "libpr13250-2.so"}
166
  {"Build libpr13250-3.o"
167
   "-r -nostdlib" ""
168
   {pr13250-3.c} {} "libpr13250-3.o"}
169 53 khays
}
170
 
171
run_cc_link_tests $build_tests
172
 
173
set run_tests {
174
    {"Run normal with libfoo.so"
175
     "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" ""
176
     {main.c} "normal" "normal.out"}
177
    {"Run protected with libfoo.so"
178
     "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" ""
179
     {main.c} "protected" "normal.out"}
180
    {"Run hidden with libfoo.so"
181
     "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" ""
182
     {main.c} "hidden" "hidden.out"}
183
    {"Run normal with versioned libfoo.so"
184
     "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" ""
185
     {main.c} "normalv" "normal.out"}
186
    {"Run warn with versioned libfoo.so"
187
     "tmpdir/beginwarn.o tmpdir/libfoov.so" ""
188
     {main.c} "warn" "warn.out"
189
     "" "" "^.*\\\): warning: function foo is deprecated$"}
190
    {"Run protected with versioned libfoo.so"
191
     "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" ""
192
     {main.c} "protected" "normal.out"}
193
    {"Run hidden with versioned libfoo.so"
194
     "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" ""
195
     {main.c} "hiddenv" "hidden.out"}
196
    {"Run normal libbar.so with libfoo.so"
197
     "tmpdir/libbarfoo.so tmpdir/libfoo.so" ""
198
     {main.c} "normal" "normal.out"}
199
    {"Run protected libbar.so with libfoo.so"
200
     "tmpdir/libbarpfoo.so tmpdir/libfoo.so" ""
201
     {main.c} "protected" "normal.out"}
202
    {"Run hidden libbar.so with libfoo.so"
203
     "tmpdir/libbarhfoo.so tmpdir/libfoo.so" ""
204
     {main.c} "hidden" "hidden.out"}
205
    {"Run normal libbar.so with versioned libfoo.so"
206
     "tmpdir/libbarfoov.so tmpdir/libfoov.so" ""
207
     {main.c} "normal" "normal.out"}
208
    {"Run protected libbar.so with versioned libfoo.so"
209
     "tmpdir/libbarpfoov.so tmpdir/libfoov.so" ""
210
     {main.c} "protected" "normal.out"}
211
    {"Run hidden libbar.so with versioned libfoo.so"
212
     "tmpdir/libbarhfoov.so tmpdir/libfoov.so" ""
213
     {main.c} "hidden" "hidden.out"}
214
    {"Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so"
215
     "--dynamic-list=dl1.list -ldl" ""
216
     {dl1main.c} "dl1a" "dl1.out"}
217
    {"Run dl1b with --dynamic-list-data and dlopen on libdl1.so"
218
     "--dynamic-list-data -ldl" ""
219
     {dl1main.c} "dl1b" "dl1.out"}
220
    {"Run with libdl2a.so"
221
     "tmpdir/libdl2a.so" ""
222
     {dl2main.c} "dl2a" "dl2a.out"}
223
    {"Run with libdl2b.so"
224
     "tmpdir/libdl2b.so" ""
225
     {dl2main.c} "dl2b" "dl2b.out"}
226
    {"Run with libdl2c.so"
227
     "tmpdir/libdl2c.so" ""
228
     {dl2main.c} "dl2c" "dl2b.out"}
229
    {"Run with libdl4a.so"
230
     "tmpdir/libdl4a.so" ""
231
     {dl4main.c} "dl4a" "dl4a.out"}
232
    {"Run with libdl4b.so"
233
     "tmpdir/libdl4b.so" ""
234
     {dl4main.c} "dl4b" "dl4a.out"}
235
    {"Run with libdl4c.so"
236
     "tmpdir/libdl4c.so" ""
237
     {dl4main.c} "dl4c" "dl4b.out"}
238
    {"Run with libdl4d.so"
239
     "tmpdir/libdl4d.so" ""
240
     {dl4main.c} "dl4d" "dl4b.out"}
241
    {"Run with libdl4e.so"
242
     "tmpdir/libdl4e.so" ""
243
     {dl4main.c} "dl4e" "dl4a.out"}
244
    {"Run with libdl4f.so"
245
     "tmpdir/libdl4f.so" ""
246
     {dl4main.c} "dl4f" "dl4a.out"}
247
    {"Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so"
248
     "--dynamic-list-data -ldl" ""
249
     {dl6amain.c} "dl6a1" "dl6a.out"}
250
    {"Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so"
251
     "-Bsymbolic-functions -ldl" ""
252
     {dl6amain.c} "dl6a2" "dl6b.out"}
253
    {"Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so"
254
     "-Bsymbolic -ldl" ""
255
     {dl6amain.c} "dl6a3" "dl6b.out"}
256
    {"Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so"
257
     "-Bsymbolic --dynamic-list-data -ldl" ""
258
     {dl6amain.c} "dl6a4" "dl6a.out"}
259
    {"Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so"
260
     "-Bsymbolic-functions --dynamic-list-cpp-new -ldl" ""
261
     {dl6amain.c} "dl6a5" "dl6b.out"}
262
    {"Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so"
263
     "--dynamic-list-cpp-new -Bsymbolic-functions -ldl" ""
264
     {dl6amain.c} "dl6a6" "dl6b.out"}
265
    {"Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so"
266
     "--dynamic-list-data -Bsymbolic -ldl" ""
267
     {dl6amain.c} "dl6a7" "dl6a.out"}
268
    {"Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so"
269
     "--dynamic-list-data -ldl" ""
270
     {dl6bmain.c} "dl6b1" "dl6a.out"}
271
    {"Run dl6b2 with dlopen on libdl6b.so"
272
     "-ldl" ""
273
     {dl6bmain.c} "dl6b2" "dl6b.out"}
274
    {"Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so"
275
     "--dynamic-list-data -ldl" ""
276
     {dl6cmain.c} "dl6c1" "dl6b.out"}
277
    {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so"
278
     "--dynamic-list-data -ldl" ""
279
     {dl6dmain.c} "dl6d1" "dl6b.out"}
280
    {"Run with libdata1.so"
281
     "tmpdir/libdata1.so" ""
282
     {dynbss1.c} "dynbss1" "pass.out"}
283
    {"Run with libfunc1.so comm1.o"
284
     "tmpdir/libfunc1.so tmpdir/comm1.o" ""
285
     {dummy.c} "comm1" "pass.out"}
286
    {"Run with comm1.o libfunc1.so"
287
     "tmpdir/comm1.o tmpdir/libfunc1.so" ""
288
     {dummy.c} "comm1" "pass.out"}
289
    {"Run with pr11138-2.c libpr11138-1.so"
290
     "--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" ""
291
     {dummy.c} "pr11138a" "pr11138.out"}
292
    {"Run with libpr11138-1.so pr11138-2.c"
293
     "--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" ""
294
     {dummy.c} "pr11138b" "pr11138.out"}
295 163 khays
    {"Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so"
296
     "--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" ""
297
     {dummy.c} "pr13250" "pass.out"}
298 53 khays
}
299
 
300
# NetBSD ELF systems do not currently support the .*_array sections.
301
run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests
302
 
303
# Check to see if the C++ compiler works
304
if { [which $CXX] == 0 } {
305
    return
306
}
307
 
308
set build_cxx_tests {
309
  {"Build libdl3a.so with --dynamic-list=dl3.list"
310
   "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
311
   {dl3.cc} {} "libdl3a.so" "c++"}
312
  {"Build libdl3b.so with -Bsymbolic"
313
   "-shared -Wl,-Bsymbolic" "-fPIC"
314
   {dl3.cc} {} "libdl3b.so" "c++"}
315
  {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
316
   "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
317
   {dl3.cc} {} "libdl3c.so" "c++"}
318
  {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
319
   "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
320
   {del.cc new.cc} {} "libnew1a.so" "c++"}
321
  {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
322
   "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC"
323
   {del.cc new.cc} {} "libnew1b.so" "c++"}
324
}
325
 
326
set run_cxx_tests {
327
    {"Run with libdl3a.so"
328
     "tmpdir/libdl3a.so" ""
329
     {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
330
# "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
331
#    {"Run with libdl3b.so"
332
#     "tmpdir/libdl3b.so" ""
333
#     {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
334
    {"Run with libdl3c.so"
335
     "tmpdir/libdl3c.so" ""
336
     {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
337
    {"Run with libnew1a.so"
338
     "tmpdir/libnew1a.so" ""
339
     {dl5.cc} "dl5a" "dl5.out" "" "c++"}
340
    {"Run with libnew1b.so"
341
     "tmpdir/libnew1b.so" ""
342
     {dl5.cc} "dl5b" "dl5.out" "" "c++"}
343
}
344
 
345
run_cc_link_tests $build_cxx_tests
346
run_ld_link_exec_tests [] $run_cxx_tests

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.