Sanitize access to gdbarch on the SDT probe API (and fix ARM bug)
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / shared.exp
CommitLineData
d2dee3b2 1# Expect script for various ELF tests.
5cb49709
AM
2# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
3# Free Software Foundation, Inc.
d2dee3b2 4#
f96b4a7b
NC
5# This file is part of the GNU Binutils.
6#
7# This program is free software; you can redistribute it and/or modify
d2dee3b2 8# it under the terms of the GNU General Public License as published by
f96b4a7b 9# the Free Software Foundation; either version 3 of the License, or
d2dee3b2
L
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
f96b4a7b
NC
19# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20# MA 02110-1301, USA.
d2dee3b2
L
21#
22
23# Exclude non-ELF targets.
24
45394486
NC
25# The following tests require running the executable generated by ld,
26# or enough of a build environment to create a fully linked executable.
27# This is not commonly available when testing a cross-built linker.
28if ![isnative] {
29 return
30}
31
d2dee3b2
L
32if ![is_elf_format] {
33 return
34}
35
dd98f8d2 36# Check to see if the C compiler works
d2dee3b2
L
37if { [which $CC] == 0 } {
38 return
39}
40
41set build_tests {
42 {"Build libfoo.so"
43 "-shared" "-fPIC"
44 {foo.c} {} "libfoo.so"}
45 {"Build versioned libfoo.so"
46 "-shared -Wl,--version-script=foo.map" "-fPIC"
55255dae 47 {foo.c} {} "libfoov.so"}
d2dee3b2
L
48 {"Build libbar.so"
49 "-shared" "-fPIC"
50 {begin.c end.c} {} "libbar.so"}
fab4a87f
L
51 {"Build warn libbar.so"
52 "-shared" "-fPIC"
df71cb5c 53 {beginwarn.c end.c} {{readelf {-S --wide} libbarw.rd}} "libbarw.so"
dd98f8d2 54 "C" "^.*\\\): warning: function foo is deprecated$"}
d2dee3b2
L
55 {"Build hidden libbar.so"
56 "-shared" "-fPIC"
57 {begin.c endhidden.c} {} "libbarh.so"}
58 {"Build protected libbar.so"
59 "-shared" "-fPIC"
60 {begin.c endprotected.c} {} "libbarp.so"}
61 {"Build libbar.so with libfoo.so"
62 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
63 {end.c} {} "libbarfoo.so"}
64 {"Build libar.so with versioned libfoo.so"
65 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
66 {end.c} {} "libbarfoov.so"}
67 {"Build hidden libbar.so with libfoo.so"
68 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
69 {endhidden.c} {} "libbarhfoo.so"}
70 {"Build hidden libar.so with versioned libfoo.so"
71 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
72 {endhidden.c} {} "libbarhfoov.so"}
73 {"Build protected libbar.so with libfoo.so"
74 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
75 {endprotected.c} {} "libbarpfoo.so"}
76 {"Build protected libbar.so with versioned libfoo.so"
77 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
78 {endprotected.c} {} "libbarpfoov.so"}
55255dae
L
79 {"Build libdl1.so"
80 "-shared" "-fPIC"
81 {dl1.c} {} "libdl1.so"}
82 {"Build libdl2a.so with --dynamic-list=dl2.list"
83 "-shared -Wl,--dynamic-list=dl2.list" "-fPIC"
84 {dl2.c dl2xxx.c} {} "libdl2a.so"}
b7b7fe3f
AS
85 {"Build libdl2a.so with --dynamic-list=dl2a.list"
86 "-shared -Wl,--dynamic-list=dl2a.list" "-fPIC"
87 {dl2.c dl2xxx.c} {} "libdl2a.so"}
40b36307
L
88 {"Build libdl2a.so with --dynamic-list-data"
89 "-shared -Wl,--dynamic-list-data" "-fPIC"
90 {dl2.c dl2xxx.c} {} "libdl2a.so"}
55255dae
L
91 {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
92 "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
93 {dl2.c dl2xxx.c} {} "libdl2b.so"}
d8cf8b51 94 {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
40b36307 95 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
d8cf8b51 96 {dl2.c dl2xxx.c} {} "libdl2c.so"}
c555238b
L
97 {"Build libdl4a.so with --dynamic-list=dl4.list"
98 "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
99 {dl4.c dl4xxx.c} {} "libdl4a.so"}
d8cf8b51 100 {"Build libdl4b.so with --dynamic-list-data"
40b36307 101 "-shared -Wl,--dynamic-list-data" "-fPIC"
c555238b 102 {dl4.c dl4xxx.c} {} "libdl4b.so"}
d8cf8b51
L
103 {"Build libdl4c.so with --dynamic-list=dl4.list and dl4xxx.list"
104 "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
105 {dl4.c dl4xxx.c} {} "libdl4c.so"}
106 {"Build libdl4d.so with --dynamic-list-data and dl4xxx.list"
40b36307 107 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
d8cf8b51
L
108 {dl4.c dl4xxx.c} {} "libdl4d.so"}
109 {"Build libdl4e.so with -Bsymbolic-functions --dynamic-list-cpp-new"
110 "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
111 {dl4.c dl4xxx.c} {} "libdl4e.so"}
112 {"Build libdl4f.so with --dynamic-list-cpp-new -Bsymbolic-functions"
113 "-shared -Wl,--dynamic-list-cpp-new,-Bsymbolic-functions" "-fPIC"
114 {dl4.c dl4xxx.c} {} "libdl4f.so"}
115 {"Build libdl6a.so"
116 "-shared" "-fPIC"
117 {dl6.c} {} "libdl6a.so"}
118 {"Build libdl6b.so with -Bsymbolic --dynamic-list-data"
119 "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
120 {dl6.c} {} "libdl6b.so"}
121 {"Build libdl6c.so with -Bsymbolic"
122 "-shared -Wl,-Bsymbolic" "-fPIC"
123 {dl6.c} {} "libdl6c.so"}
124 {"Build libdl6d.so with --dynamic-list-data -Bsymbolic"
125 "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC"
126 {dl6.c} {} "libdl6d.so"}
43edfb7f
L
127 {"Build libdata1.so"
128 "-shared" "-fPIC"
129 {data1.c} {} "libdata1.so"}
a47edf27
L
130 {"Build libdata2.so"
131 "-shared" "-fPIC"
132 {data2.c} {} "libdata2.so"}
0a36a439
L
133 {"Build libcomm1.o"
134 "-r -nostdlib" ""
135 {comm1.c} {} "libcomm1.o"}
136 {"Build libfunc1.so"
137 "-shared" "-fPIC"
138 {func1.c} {} "libfunc1.so"}
d8880531
L
139 {"Build libpr9676-1.a"
140 "" "-fPIC"
141 {pr9676-1.c} {} "libpr9676-1.a"}
142 {"Build libpr9676-2.a"
143 "" "-fPIC"
144 {pr9676-2.c} {} "libpr9676-2.a"}
145 {"Build libpr9676-3.so"
146 "-shared" "-fPIC"
147 {pr9676-3.c} {} "libpr9676-3.so"}
148 {"Build libpr9676-4.so"
149 "-shared" "-fPIC"
150 {pr9676-4.c} {} "libpr9676-4.so"}
151 {"Build libpr9676-4a.so"
152 "-shared tmpdir/pr9676-4.o -Ltmpdir -lpr9676-3 -Wl,--start-group -lpr9676-1 -lpr9676-2 -Wl,--end-group"
153 "-fPIC"
154 {dummy.c} {{readelf {-s} pr9676.rd}} "libpr9676-4a.so"}
54ac0771
L
155 {"Build libpr9679.so"
156 "-shared" "-fPIC -O0"
157 {pr9679-1.c pr9679-2.c} {{readelf {-s} pr9679.rd}} "libpr9679.so"}
d023c380
L
158 {"Build libpr11138-1.so"
159 "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
160 {pr11138-1.c} {} "libpr11138-1.so"}
161 {"Build libpr11138-2.o"
162 "-r -nostdlib" ""
163 {pr11138-2.c} {} "libpr11138-2.o"}
3e0882af
L
164 {"Build pr13250-1.so"
165 "-shared" "-fPIC"
166 {pr13250-1.c} {} "libpr13250-1.so"}
167 {"Build pr13250-2.so with libpr13250-1.so"
5cb49709 168 "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC"
3e0882af
L
169 {pr13250-2.c} {} "libpr13250-2.so"}
170 {"Build libpr13250-3.o"
171 "-r -nostdlib" ""
172 {pr13250-3.c} {} "libpr13250-3.o"}
bc9ad2e4
L
173 {"Build libpr14323-2.so"
174 "-shared" "-fPIC"
175 {pr14323-2.c} {} "libpr14323-2.so"}
dda8ddc5
L
176 {"Build pr14862-1.o"
177 "-r -nostdlib" ""
178 {pr14862-1.c} {} "libpr14862-1.o"}
179 {"Build libpr14862.so"
180 "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
181 {pr14862-2.c} {} "libpr14862.so"}
63406f0a
L
182 {"Build libneeded1b.so"
183 "-shared" "-fPIC"
184 {needed1b.c} {} "libneeded1b.so"}
185 {"Build libneeded1a.so"
2eb64a9f 186 "-shared -Wl,--add-needed,--no-as-needed -Ltmpdir -lneeded1b" "-fPIC"
63406f0a
L
187 {needed1a.c} {} "libneeded1a.so"}
188 {"Build libneeded1c.o"
189 "-r -nostdlib" ""
190 {needed1c.c} {} "libneeded1c.o"}
8fbb09e8
L
191 {"Build libneeded1pic.o"
192 "-r -nostdlib" "-fPIC"
193 {needed1c.c} {} "libneeded1pic.o"}
194 {"Build needed1a.so with --add-needed"
195 "-shared tmpdir/libneeded1pic.o -Wl,--add-needed,-rpath=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
196 {dummy.c} {} "needed1a.so"}
197 {"Build needed1b.so with --copy-dt-needed-entries"
198 "-shared tmpdir/libneeded1pic.o -Wl,--copy-dt-needed-entries,-rpath=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
199 {dummy.c} {} "needed1b.so"}
200 {"Build needed1a.so with --no-add-needed"
201 "-shared tmpdir/libneeded1pic.o -Wl,--no-add-needed -Ltmpdir -lneeded1a" ""
202 {dummy.c} {} "needed1c.so"}
203 {"Build needed1b.so with --no-copy-dt-needed-entries"
204 "-shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries -Ltmpdir -lneeded1a" ""
205 {dummy.c} {} "needed1d.so"}
8877b5e5
AM
206 {"Build librel.so"
207 "-shared" "-fPIC"
208 {rel.c} {} "librel.so"}
d2dee3b2
L
209}
210
dd98f8d2
NC
211run_cc_link_tests $build_tests
212
d2dee3b2
L
213set run_tests {
214 {"Run normal with libfoo.so"
215 "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" ""
216 {main.c} "normal" "normal.out"}
217 {"Run protected with libfoo.so"
218 "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" ""
219 {main.c} "protected" "normal.out"}
220 {"Run hidden with libfoo.so"
221 "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" ""
222 {main.c} "hidden" "hidden.out"}
223 {"Run normal with versioned libfoo.so"
224 "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" ""
225 {main.c} "normalv" "normal.out"}
fab4a87f
L
226 {"Run warn with versioned libfoo.so"
227 "tmpdir/beginwarn.o tmpdir/libfoov.so" ""
228 {main.c} "warn" "warn.out"
229 "" "" "^.*\\\): warning: function foo is deprecated$"}
d2dee3b2
L
230 {"Run protected with versioned libfoo.so"
231 "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" ""
232 {main.c} "protected" "normal.out"}
233 {"Run hidden with versioned libfoo.so"
234 "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" ""
235 {main.c} "hiddenv" "hidden.out"}
236 {"Run normal libbar.so with libfoo.so"
237 "tmpdir/libbarfoo.so tmpdir/libfoo.so" ""
238 {main.c} "normal" "normal.out"}
239 {"Run protected libbar.so with libfoo.so"
240 "tmpdir/libbarpfoo.so tmpdir/libfoo.so" ""
241 {main.c} "protected" "normal.out"}
242 {"Run hidden libbar.so with libfoo.so"
243 "tmpdir/libbarhfoo.so tmpdir/libfoo.so" ""
244 {main.c} "hidden" "hidden.out"}
245 {"Run normal libbar.so with versioned libfoo.so"
246 "tmpdir/libbarfoov.so tmpdir/libfoov.so" ""
247 {main.c} "normal" "normal.out"}
248 {"Run protected libbar.so with versioned libfoo.so"
249 "tmpdir/libbarpfoov.so tmpdir/libfoov.so" ""
250 {main.c} "protected" "normal.out"}
251 {"Run hidden libbar.so with versioned libfoo.so"
252 "tmpdir/libbarhfoov.so tmpdir/libfoov.so" ""
253 {main.c} "hidden" "hidden.out"}
d8cf8b51 254 {"Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so"
55255dae 255 "--dynamic-list=dl1.list -ldl" ""
d8cf8b51
L
256 {dl1main.c} "dl1a" "dl1.out"}
257 {"Run dl1b with --dynamic-list-data and dlopen on libdl1.so"
40b36307 258 "--dynamic-list-data -ldl" ""
d8cf8b51 259 {dl1main.c} "dl1b" "dl1.out"}
55255dae
L
260 {"Run with libdl2a.so"
261 "tmpdir/libdl2a.so" ""
262 {dl2main.c} "dl2a" "dl2a.out"}
263 {"Run with libdl2b.so"
264 "tmpdir/libdl2b.so" ""
265 {dl2main.c} "dl2b" "dl2b.out"}
d8cf8b51
L
266 {"Run with libdl2c.so"
267 "tmpdir/libdl2c.so" ""
268 {dl2main.c} "dl2c" "dl2b.out"}
c555238b
L
269 {"Run with libdl4a.so"
270 "tmpdir/libdl4a.so" ""
271 {dl4main.c} "dl4a" "dl4a.out"}
272 {"Run with libdl4b.so"
273 "tmpdir/libdl4b.so" ""
d8cf8b51
L
274 {dl4main.c} "dl4b" "dl4a.out"}
275 {"Run with libdl4c.so"
276 "tmpdir/libdl4c.so" ""
277 {dl4main.c} "dl4c" "dl4b.out"}
278 {"Run with libdl4d.so"
279 "tmpdir/libdl4d.so" ""
280 {dl4main.c} "dl4d" "dl4b.out"}
281 {"Run with libdl4e.so"
282 "tmpdir/libdl4e.so" ""
283 {dl4main.c} "dl4e" "dl4a.out"}
284 {"Run with libdl4f.so"
285 "tmpdir/libdl4f.so" ""
286 {dl4main.c} "dl4f" "dl4a.out"}
287 {"Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so"
288 "--dynamic-list-data -ldl" ""
289 {dl6amain.c} "dl6a1" "dl6a.out"}
290 {"Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so"
291 "-Bsymbolic-functions -ldl" ""
292 {dl6amain.c} "dl6a2" "dl6b.out"}
293 {"Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so"
294 "-Bsymbolic -ldl" ""
295 {dl6amain.c} "dl6a3" "dl6b.out"}
296 {"Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so"
297 "-Bsymbolic --dynamic-list-data -ldl" ""
298 {dl6amain.c} "dl6a4" "dl6a.out"}
299 {"Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so"
300 "-Bsymbolic-functions --dynamic-list-cpp-new -ldl" ""
301 {dl6amain.c} "dl6a5" "dl6b.out"}
302 {"Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so"
303 "--dynamic-list-cpp-new -Bsymbolic-functions -ldl" ""
304 {dl6amain.c} "dl6a6" "dl6b.out"}
305 {"Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so"
306 "--dynamic-list-data -Bsymbolic -ldl" ""
307 {dl6amain.c} "dl6a7" "dl6a.out"}
308 {"Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so"
309 "--dynamic-list-data -ldl" ""
310 {dl6bmain.c} "dl6b1" "dl6a.out"}
311 {"Run dl6b2 with dlopen on libdl6b.so"
312 "-ldl" ""
313 {dl6bmain.c} "dl6b2" "dl6b.out"}
314 {"Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so"
315 "--dynamic-list-data -ldl" ""
316 {dl6cmain.c} "dl6c1" "dl6b.out"}
317 {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so"
318 "--dynamic-list-data -ldl" ""
319 {dl6dmain.c} "dl6d1" "dl6b.out"}
43edfb7f
L
320 {"Run with libdata1.so"
321 "tmpdir/libdata1.so" ""
322 {dynbss1.c} "dynbss1" "pass.out"}
a47edf27
L
323 {"Run with libdata2.so"
324 "tmpdir/libdata2.so" ""
325 {weakdef1.c} "weakdef1" "pass.out"}
0a36a439
L
326 {"Run with libfunc1.so comm1.o"
327 "tmpdir/libfunc1.so tmpdir/comm1.o" ""
328 {dummy.c} "comm1" "pass.out"}
329 {"Run with comm1.o libfunc1.so"
330 "tmpdir/comm1.o tmpdir/libfunc1.so" ""
331 {dummy.c} "comm1" "pass.out"}
d023c380
L
332 {"Run with pr11138-2.c libpr11138-1.so"
333 "--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" ""
334 {dummy.c} "pr11138a" "pr11138.out"}
335 {"Run with libpr11138-1.so pr11138-2.c"
336 "--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" ""
337 {dummy.c} "pr11138b" "pr11138.out"}
3e0882af
L
338 {"Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so"
339 "--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" ""
340 {dummy.c} "pr13250" "pass.out"}
bc9ad2e4
L
341 {"Run with pr14323-1.c pr14323-2.so"
342 "tmpdir/libpr14323-2.so" ""
343 {pr14323-1.c} "pr14323" "pass.out"}
dda8ddc5
L
344 {"Run with pr14862-1.c libpr14862.so"
345 "--as-needed tmpdir/libpr14862-1.o tmpdir/libpr14862.so" ""
346 {dummy.c} "pr14862" "pr14862.out"}
63406f0a
L
347 {"Link with --add-needed"
348 "tmpdir/libneeded1c.o --add-needed -rpath=tmpdir -Ltmpdir -lneeded1a" ""
349 {dummy.c} "needed1a" "needed1.out"}
350 {"Link with --copy-dt-needed-entries"
351 "tmpdir/libneeded1c.o --copy-dt-needed-entries -rpath=tmpdir -Ltmpdir -lneeded1a" ""
352 {dummy.c} "needed1b" "needed1.out"}
8877b5e5
AM
353 {"Run relmain"
354 "--no-as-needed -rpath=tmpdir -Ltmpdir -lrel" ""
355 {relmain.c} "relmain" "relmain.out"}
d2dee3b2
L
356}
357
d2dee3b2
L
358# NetBSD ELF systems do not currently support the .*_array sections.
359run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests
55255dae 360
63406f0a
L
361# Check --no-add-needed and --no-copy-dt-needed-entries
362set testname "--no-add-needed"
363set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
e65cb106 364if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
63406f0a
L
365 pass $testname
366} {
367 fail $testname
368}
369set testname "--no-copy-dt-needed-entries"
370set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag tmpdir/libneeded1c.o -Wl,--no-copy-dt-needed-entries,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
e65cb106 371if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
63406f0a
L
372 pass $testname
373} {
374 fail $testname
375}
8fbb09e8
L
376set testname "--no-add-needed -shared"
377set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag -shared tmpdir/libneeded1pic.o -Wl,--no-add-needed,-z,defs -Ltmpdir -lneeded1a"]
378if { [ regexp "undefined reference to `bar'" $exec_output ] } {
379 pass $testname
380} {
381 fail $testname
382}
383set testname "--no-copy-dt-needed-entries -shared"
384set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag -shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries,-z,defs -Ltmpdir -lneeded1a"]
385if { [ regexp "undefined reference to `bar'" $exec_output ] } {
386 pass $testname
387} {
388 fail $testname
389}
63406f0a 390
dd98f8d2 391# Check to see if the C++ compiler works
55255dae
L
392if { [which $CXX] == 0 } {
393 return
394}
395
396set build_cxx_tests {
397 {"Build libdl3a.so with --dynamic-list=dl3.list"
398 "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
399 {dl3.cc} {} "libdl3a.so" "c++"}
400 {"Build libdl3b.so with -Bsymbolic"
401 "-shared -Wl,-Bsymbolic" "-fPIC"
402 {dl3.cc} {} "libdl3b.so" "c++"}
403 {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
404 "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
405 {dl3.cc} {} "libdl3c.so" "c++"}
d8cf8b51 406 {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
40b36307 407 "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
d8cf8b51
L
408 {del.cc new.cc} {} "libnew1a.so" "c++"}
409 {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
410 "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC"
411 {del.cc new.cc} {} "libnew1b.so" "c++"}
55255dae
L
412}
413
b37470e4
L
414# "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
415# {"Run with libdl3b.so"
416# "tmpdir/libdl3b.so" ""
417# {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
cb5ab6c8
L
418set run_cxx_tests {
419 {"Run with libdl3a.so"
420 "-Wl,--no-as-needed tmpdir/libdl3a.so" ""
421 {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
55255dae 422 {"Run with libdl3c.so"
5cb49709 423 "-Wl,--no-as-needed tmpdir/libdl3c.so" ""
55255dae 424 {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
d8cf8b51
L
425 {"Run with libnew1a.so"
426 "tmpdir/libnew1a.so" ""
427 {dl5.cc} "dl5a" "dl5.out" "" "c++"}
428 {"Run with libnew1b.so"
429 "tmpdir/libnew1b.so" ""
430 {dl5.cc} "dl5b" "dl5.out" "" "c++"}
55255dae
L
431}
432
433run_cc_link_tests $build_cxx_tests
434run_ld_link_exec_tests [] $run_cxx_tests
This page took 0.349523 seconds and 4 git commands to generate.