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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-elf/] [shared.exp] - Blame information for rev 438

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
# 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
if ![is_elf_format] {
25
    return
26
}
27
 
28
# The following tests require running the executable generated by ld.
29
if ![isnative] {
30
    return
31
}
32
 
33
# Check if compiler works
34
if { [which $CC] == 0 } {
35
    return
36
}
37
 
38
set build_tests {
39
  {"Build libfoo.so"
40
   "-shared" "-fPIC"
41
   {foo.c} {} "libfoo.so"}
42
  {"Build versioned libfoo.so"
43
   "-shared -Wl,--version-script=foo.map" "-fPIC"
44
   {foo.c} {} "libfoov.so"}
45
  {"Build libbar.so"
46
   "-shared" "-fPIC"
47
   {begin.c end.c} {} "libbar.so"}
48
  {"Build warn libbar.so"
49
   "-shared" "-fPIC"
50
   {beginwarn.c end.c} {} "libbarw.so"}
51
  {"Build hidden libbar.so"
52
   "-shared" "-fPIC"
53
   {begin.c endhidden.c} {} "libbarh.so"}
54
  {"Build protected libbar.so"
55
   "-shared" "-fPIC"
56
   {begin.c endprotected.c} {} "libbarp.so"}
57
  {"Build libbar.so with libfoo.so"
58
   "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
59
   {end.c} {} "libbarfoo.so"}
60
  {"Build libar.so with versioned libfoo.so"
61
   "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
62
   {end.c} {} "libbarfoov.so"}
63
  {"Build hidden libbar.so with libfoo.so"
64
   "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
65
   {endhidden.c} {} "libbarhfoo.so"}
66
  {"Build hidden libar.so with versioned libfoo.so"
67
   "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
68
   {endhidden.c} {} "libbarhfoov.so"}
69
  {"Build protected libbar.so with libfoo.so"
70
   "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
71
   {endprotected.c} {} "libbarpfoo.so"}
72
  {"Build protected libbar.so with versioned libfoo.so"
73
   "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
74
   {endprotected.c} {} "libbarpfoov.so"}
75
  {"Build libdl1.so"
76
   "-shared" "-fPIC"
77
   {dl1.c} {} "libdl1.so"}
78
  {"Build libdl2a.so with --dynamic-list=dl2.list"
79
   "-shared -Wl,--dynamic-list=dl2.list" "-fPIC"
80
   {dl2.c dl2xxx.c} {} "libdl2a.so"}
81
  {"Build libdl2a.so with --dynamic-list=dl2a.list"
82
   "-shared -Wl,--dynamic-list=dl2a.list" "-fPIC"
83
   {dl2.c dl2xxx.c} {} "libdl2a.so"}
84
  {"Build libdl2a.so with --dynamic-list-data"
85
   "-shared -Wl,--dynamic-list-data" "-fPIC"
86
   {dl2.c dl2xxx.c} {} "libdl2a.so"}
87
  {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
88
   "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
89
   {dl2.c dl2xxx.c} {} "libdl2b.so"}
90
  {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
91
   "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
92
   {dl2.c dl2xxx.c} {} "libdl2c.so"}
93
  {"Build libdl4a.so with --dynamic-list=dl4.list"
94
   "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
95
   {dl4.c dl4xxx.c} {} "libdl4a.so"}
96
  {"Build libdl4b.so with --dynamic-list-data"
97
   "-shared -Wl,--dynamic-list-data" "-fPIC"
98
   {dl4.c dl4xxx.c} {} "libdl4b.so"}
99
  {"Build libdl4c.so with --dynamic-list=dl4.list and dl4xxx.list"
100
   "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
101
   {dl4.c dl4xxx.c} {} "libdl4c.so"}
102
  {"Build libdl4d.so with --dynamic-list-data and dl4xxx.list"
103
   "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
104
   {dl4.c dl4xxx.c} {} "libdl4d.so"}
105
  {"Build libdl4e.so with -Bsymbolic-functions --dynamic-list-cpp-new"
106
   "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
107
   {dl4.c dl4xxx.c} {} "libdl4e.so"}
108
  {"Build libdl4f.so with --dynamic-list-cpp-new -Bsymbolic-functions"
109
   "-shared -Wl,--dynamic-list-cpp-new,-Bsymbolic-functions" "-fPIC"
110
   {dl4.c dl4xxx.c} {} "libdl4f.so"}
111
  {"Build libdl6a.so"
112
   "-shared" "-fPIC"
113
   {dl6.c} {} "libdl6a.so"}
114
  {"Build libdl6b.so with -Bsymbolic --dynamic-list-data"
115
   "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
116
   {dl6.c} {} "libdl6b.so"}
117
  {"Build libdl6c.so with -Bsymbolic"
118
   "-shared -Wl,-Bsymbolic" "-fPIC"
119
   {dl6.c} {} "libdl6c.so"}
120
  {"Build libdl6d.so with --dynamic-list-data -Bsymbolic"
121
   "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC"
122
   {dl6.c} {} "libdl6d.so"}
123
  {"Build libdata1.so"
124
   "-shared" "-fPIC"
125
   {data1.c} {} "libdata1.so"}
126
  {"Build libcomm1.o"
127
   "-r -nostdlib" ""
128
   {comm1.c} {} "libcomm1.o"}
129
  {"Build libfunc1.so"
130
   "-shared" "-fPIC"
131
   {func1.c} {} "libfunc1.so"}
132
  {"Build libpr9676-1.a"
133
   "" "-fPIC"
134
   {pr9676-1.c} {} "libpr9676-1.a"}
135
  {"Build libpr9676-2.a"
136
   "" "-fPIC"
137
   {pr9676-2.c} {} "libpr9676-2.a"}
138
  {"Build libpr9676-3.so"
139
   "-shared" "-fPIC"
140
   {pr9676-3.c} {} "libpr9676-3.so"}
141
  {"Build libpr9676-4.so"
142
   "-shared" "-fPIC"
143
   {pr9676-4.c} {} "libpr9676-4.so"}
144
  {"Build libpr9676-4a.so"
145
   "-shared tmpdir/pr9676-4.o -Ltmpdir -lpr9676-3 -Wl,--start-group -lpr9676-1 -lpr9676-2 -Wl,--end-group"
146
   "-fPIC"
147
   {dummy.c} {{readelf {-s} pr9676.rd}} "libpr9676-4a.so"}
148
  {"Build libpr9679.so"
149
   "-shared" "-fPIC -O0"
150
   {pr9679-1.c pr9679-2.c} {{readelf {-s} pr9679.rd}} "libpr9679.so"}
151
}
152
 
153
set run_tests {
154
    {"Run normal with libfoo.so"
155
     "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" ""
156
     {main.c} "normal" "normal.out"}
157
    {"Run protected with libfoo.so"
158
     "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" ""
159
     {main.c} "protected" "normal.out"}
160
    {"Run hidden with libfoo.so"
161
     "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" ""
162
     {main.c} "hidden" "hidden.out"}
163
    {"Run normal with versioned libfoo.so"
164
     "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" ""
165
     {main.c} "normalv" "normal.out"}
166
    {"Run warn with versioned libfoo.so"
167
     "tmpdir/beginwarn.o tmpdir/libfoov.so" ""
168
     {main.c} "warn" "warn.out"
169
     "" "" "^.*\\\): warning: function foo is deprecated$"}
170
    {"Run protected with versioned libfoo.so"
171
     "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" ""
172
     {main.c} "protected" "normal.out"}
173
    {"Run hidden with versioned libfoo.so"
174
     "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" ""
175
     {main.c} "hiddenv" "hidden.out"}
176
    {"Run normal libbar.so with libfoo.so"
177
     "tmpdir/libbarfoo.so tmpdir/libfoo.so" ""
178
     {main.c} "normal" "normal.out"}
179
    {"Run protected libbar.so with libfoo.so"
180
     "tmpdir/libbarpfoo.so tmpdir/libfoo.so" ""
181
     {main.c} "protected" "normal.out"}
182
    {"Run hidden libbar.so with libfoo.so"
183
     "tmpdir/libbarhfoo.so tmpdir/libfoo.so" ""
184
     {main.c} "hidden" "hidden.out"}
185
    {"Run normal libbar.so with versioned libfoo.so"
186
     "tmpdir/libbarfoov.so tmpdir/libfoov.so" ""
187
     {main.c} "normal" "normal.out"}
188
    {"Run protected libbar.so with versioned libfoo.so"
189
     "tmpdir/libbarpfoov.so tmpdir/libfoov.so" ""
190
     {main.c} "protected" "normal.out"}
191
    {"Run hidden libbar.so with versioned libfoo.so"
192
     "tmpdir/libbarhfoov.so tmpdir/libfoov.so" ""
193
     {main.c} "hidden" "hidden.out"}
194
    {"Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so"
195
     "--dynamic-list=dl1.list -ldl" ""
196
     {dl1main.c} "dl1a" "dl1.out"}
197
    {"Run dl1b with --dynamic-list-data and dlopen on libdl1.so"
198
     "--dynamic-list-data -ldl" ""
199
     {dl1main.c} "dl1b" "dl1.out"}
200
    {"Run with libdl2a.so"
201
     "tmpdir/libdl2a.so" ""
202
     {dl2main.c} "dl2a" "dl2a.out"}
203
    {"Run with libdl2b.so"
204
     "tmpdir/libdl2b.so" ""
205
     {dl2main.c} "dl2b" "dl2b.out"}
206
    {"Run with libdl2c.so"
207
     "tmpdir/libdl2c.so" ""
208
     {dl2main.c} "dl2c" "dl2b.out"}
209
    {"Run with libdl4a.so"
210
     "tmpdir/libdl4a.so" ""
211
     {dl4main.c} "dl4a" "dl4a.out"}
212
    {"Run with libdl4b.so"
213
     "tmpdir/libdl4b.so" ""
214
     {dl4main.c} "dl4b" "dl4a.out"}
215
    {"Run with libdl4c.so"
216
     "tmpdir/libdl4c.so" ""
217
     {dl4main.c} "dl4c" "dl4b.out"}
218
    {"Run with libdl4d.so"
219
     "tmpdir/libdl4d.so" ""
220
     {dl4main.c} "dl4d" "dl4b.out"}
221
    {"Run with libdl4e.so"
222
     "tmpdir/libdl4e.so" ""
223
     {dl4main.c} "dl4e" "dl4a.out"}
224
    {"Run with libdl4f.so"
225
     "tmpdir/libdl4f.so" ""
226
     {dl4main.c} "dl4f" "dl4a.out"}
227
    {"Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so"
228
     "--dynamic-list-data -ldl" ""
229
     {dl6amain.c} "dl6a1" "dl6a.out"}
230
    {"Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so"
231
     "-Bsymbolic-functions -ldl" ""
232
     {dl6amain.c} "dl6a2" "dl6b.out"}
233
    {"Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so"
234
     "-Bsymbolic -ldl" ""
235
     {dl6amain.c} "dl6a3" "dl6b.out"}
236
    {"Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so"
237
     "-Bsymbolic --dynamic-list-data -ldl" ""
238
     {dl6amain.c} "dl6a4" "dl6a.out"}
239
    {"Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so"
240
     "-Bsymbolic-functions --dynamic-list-cpp-new -ldl" ""
241
     {dl6amain.c} "dl6a5" "dl6b.out"}
242
    {"Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so"
243
     "--dynamic-list-cpp-new -Bsymbolic-functions -ldl" ""
244
     {dl6amain.c} "dl6a6" "dl6b.out"}
245
    {"Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so"
246
     "--dynamic-list-data -Bsymbolic -ldl" ""
247
     {dl6amain.c} "dl6a7" "dl6a.out"}
248
    {"Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so"
249
     "--dynamic-list-data -ldl" ""
250
     {dl6bmain.c} "dl6b1" "dl6a.out"}
251
    {"Run dl6b2 with dlopen on libdl6b.so"
252
     "-ldl" ""
253
     {dl6bmain.c} "dl6b2" "dl6b.out"}
254
    {"Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so"
255
     "--dynamic-list-data -ldl" ""
256
     {dl6cmain.c} "dl6c1" "dl6b.out"}
257
    {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so"
258
     "--dynamic-list-data -ldl" ""
259
     {dl6dmain.c} "dl6d1" "dl6b.out"}
260
    {"Run with libdata1.so"
261
     "tmpdir/libdata1.so" ""
262
     {dynbss1.c} "dynbss1" "pass.out"}
263
    {"Run with libfunc1.so comm1.o"
264
     "tmpdir/libfunc1.so tmpdir/comm1.o" ""
265
     {dummy.c} "comm1" "pass.out"}
266
    {"Run with comm1.o libfunc1.so"
267
     "tmpdir/comm1.o tmpdir/libfunc1.so" ""
268
     {dummy.c} "comm1" "pass.out"}
269
}
270
 
271
run_cc_link_tests $build_tests
272
# NetBSD ELF systems do not currently support the .*_array sections.
273
run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests
274
 
275
# Check if compiler works
276
if { [which $CXX] == 0 } {
277
    return
278
}
279
 
280
set build_cxx_tests {
281
  {"Build libdl3a.so with --dynamic-list=dl3.list"
282
   "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
283
   {dl3.cc} {} "libdl3a.so" "c++"}
284
  {"Build libdl3b.so with -Bsymbolic"
285
   "-shared -Wl,-Bsymbolic" "-fPIC"
286
   {dl3.cc} {} "libdl3b.so" "c++"}
287
  {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
288
   "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
289
   {dl3.cc} {} "libdl3c.so" "c++"}
290
  {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
291
   "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
292
   {del.cc new.cc} {} "libnew1a.so" "c++"}
293
  {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
294
   "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC"
295
   {del.cc new.cc} {} "libnew1b.so" "c++"}
296
}
297
 
298
set run_cxx_tests {
299
    {"Run with libdl3a.so"
300
     "tmpdir/libdl3a.so" ""
301
     {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
302
# "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
303
#    {"Run with libdl3b.so"
304
#     "tmpdir/libdl3b.so" ""
305
#     {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
306
    {"Run with libdl3c.so"
307
     "tmpdir/libdl3c.so" ""
308
     {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
309
    {"Run with libnew1a.so"
310
     "tmpdir/libnew1a.so" ""
311
     {dl5.cc} "dl5a" "dl5.out" "" "c++"}
312
    {"Run with libnew1b.so"
313
     "tmpdir/libnew1b.so" ""
314
     {dl5.cc} "dl5b" "dl5.out" "" "c++"}
315
}
316
 
317
run_cc_link_tests $build_cxx_tests
318
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.