Mark symbol in executables if it matches dynamic_list
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / shared.exp
1 # Expect script for various ELF tests.
2 # Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 # Free Software Foundation, Inc.
4 #
5 # This file is part of the GNU Binutils.
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
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
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 # MA 02110-1301, USA.
21 #
22
23 # Exclude non-ELF targets.
24
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.
28 if ![isnative] {
29 return
30 }
31
32 if ![is_elf_format] {
33 return
34 }
35
36 # Check to see if the C compiler works
37 if { [which $CC] == 0 } {
38 return
39 }
40
41 set 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"
47 {foo.c} {} "libfoov.so"}
48 {"Build libbar.so"
49 "-shared" "-fPIC"
50 {begin.c end.c} {} "libbar.so"}
51 {"Build warn libbar.so"
52 "-shared" "-fPIC"
53 {beginwarn.c end.c} {{readelf {-S --wide} libbarw.rd}} "libbarw.so"
54 "C" "^.*\\\): warning: function foo is deprecated$"}
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"}
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"}
85 {"Build libdl2a.so with --dynamic-list=dl2a.list"
86 "-shared -Wl,--dynamic-list=dl2a.list" "-fPIC"
87 {dl2.c dl2xxx.c} {} "libdl2a.so"}
88 {"Build libdl2a.so with --dynamic-list-data"
89 "-shared -Wl,--dynamic-list-data" "-fPIC"
90 {dl2.c dl2xxx.c} {} "libdl2a.so"}
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"}
94 {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
95 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
96 {dl2.c dl2xxx.c} {} "libdl2c.so"}
97 {"Build libdl4a.so with --dynamic-list=dl4.list"
98 "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
99 {dl4.c dl4xxx.c} {} "libdl4a.so"}
100 {"Build libdl4b.so with --dynamic-list-data"
101 "-shared -Wl,--dynamic-list-data" "-fPIC"
102 {dl4.c dl4xxx.c} {} "libdl4b.so"}
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"
107 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
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"}
127 {"Build libdata1.so"
128 "-shared" "-fPIC"
129 {data1.c} {} "libdata1.so"}
130 {"Build libdata2.so"
131 "-shared" "-fPIC"
132 {data2.c} {} "libdata2.so"}
133 {"Build libcomm1.o"
134 "-r -nostdlib" ""
135 {comm1.c} {} "libcomm1.o"}
136 {"Build libfunc1.so"
137 "-shared" "-fPIC"
138 {func1.c} {} "libfunc1.so"}
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"}
155 {"Build libpr9679.so"
156 "-shared" "-fPIC -O0"
157 {pr9679-1.c pr9679-2.c} {{readelf {-s} pr9679.rd}} "libpr9679.so"}
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"}
164 {"Build pr13250-1.so"
165 "-shared" "-fPIC"
166 {pr13250-1.c} {} "libpr13250-1.so"}
167 {"Build pr13250-2.so with libpr13250-1.so"
168 "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC"
169 {pr13250-2.c} {} "libpr13250-2.so"}
170 {"Build libpr13250-3.o"
171 "-r -nostdlib" ""
172 {pr13250-3.c} {} "libpr13250-3.o"}
173 {"Build libpr14323-2.so"
174 "-shared" "-fPIC"
175 {pr14323-2.c} {} "libpr14323-2.so"}
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"}
182 {"Build libneeded1b.so"
183 "-shared" "-fPIC"
184 {needed1b.c} {} "libneeded1b.so"}
185 {"Build libneeded1a.so"
186 "-shared -Wl,--add-needed,--no-as-needed -Ltmpdir -lneeded1b" "-fPIC"
187 {needed1a.c} {} "libneeded1a.so"}
188 {"Build libneeded1c.o"
189 "-r -nostdlib" ""
190 {needed1c.c} {} "libneeded1c.o"}
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"}
206 {"Build librel.so"
207 "-shared" "-fPIC"
208 {rel.c} {} "librel.so"}
209 {"Build libneeded2a.so"
210 "-shared" "-fPIC"
211 {needed2a.c} {} "libneeded2a.so"}
212 {"Build libneeded2b.so"
213 "-shared -Wl,--version-script,needed2.ver" "-fPIC"
214 {needed2b.c} {} "libneeded2b.so"}
215 {"Build libneeded2c.o"
216 "-r -nostdlib" ""
217 {needed2c.c} {} "libneeded2c.o"}
218 {"Build needed2"
219 "tmpdir/libneeded2c.o -Wl,--as-needed tmpdir/libneeded2a.so tmpdir/libneeded2b.so" ""
220 {dummy.c} {} "needed2"}
221 {"Build libpr2404a.so"
222 "-shared" "-fPIC"
223 {pr2404a.c} {} "libpr2404a.so"}
224 {"Build libpr2404b.a"
225 "" ""
226 {pr2404b.c} {} "libpr2404b.a"}
227 {"Build rdynamic-1"
228 "-rdynamic -Wl,--gc-sections" "-ffunction-sections"
229 {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
230 {"Build dynamic-1"
231 "-Wl,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
232 {dynamic-1.c} {{readelf {-s} dynamic-1.rd}} "dynamic-1"}
233 }
234
235 run_cc_link_tests $build_tests
236
237 set run_tests {
238 {"Run normal with libfoo.so"
239 "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" ""
240 {main.c} "normal" "normal.out"}
241 {"Run protected with libfoo.so"
242 "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" ""
243 {main.c} "protected" "normal.out"}
244 {"Run hidden with libfoo.so"
245 "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" ""
246 {main.c} "hidden" "hidden.out"}
247 {"Run normal with versioned libfoo.so"
248 "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" ""
249 {main.c} "normalv" "normal.out"}
250 {"Run warn with versioned libfoo.so"
251 "tmpdir/beginwarn.o tmpdir/libfoov.so" ""
252 {main.c} "warn" "warn.out"
253 "" "" "^.*\\\): warning: function foo is deprecated$"}
254 {"Run protected with versioned libfoo.so"
255 "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" ""
256 {main.c} "protected" "normal.out"}
257 {"Run hidden with versioned libfoo.so"
258 "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" ""
259 {main.c} "hiddenv" "hidden.out"}
260 {"Run normal libbar.so with libfoo.so"
261 "tmpdir/libbarfoo.so tmpdir/libfoo.so" ""
262 {main.c} "normal" "normal.out"}
263 {"Run protected libbar.so with libfoo.so"
264 "tmpdir/libbarpfoo.so tmpdir/libfoo.so" ""
265 {main.c} "protected" "normal.out"}
266 {"Run hidden libbar.so with libfoo.so"
267 "tmpdir/libbarhfoo.so tmpdir/libfoo.so" ""
268 {main.c} "hidden" "hidden.out"}
269 {"Run normal libbar.so with versioned libfoo.so"
270 "tmpdir/libbarfoov.so tmpdir/libfoov.so" ""
271 {main.c} "normal" "normal.out"}
272 {"Run protected libbar.so with versioned libfoo.so"
273 "tmpdir/libbarpfoov.so tmpdir/libfoov.so" ""
274 {main.c} "protected" "normal.out"}
275 {"Run hidden libbar.so with versioned libfoo.so"
276 "tmpdir/libbarhfoov.so tmpdir/libfoov.so" ""
277 {main.c} "hidden" "hidden.out"}
278 {"Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so"
279 "--dynamic-list=dl1.list -ldl" ""
280 {dl1main.c} "dl1a" "dl1.out"}
281 {"Run dl1b with --dynamic-list-data and dlopen on libdl1.so"
282 "--dynamic-list-data -ldl" ""
283 {dl1main.c} "dl1b" "dl1.out"}
284 {"Run with libdl2a.so"
285 "tmpdir/libdl2a.so" ""
286 {dl2main.c} "dl2a" "dl2a.out"}
287 {"Run with libdl2b.so"
288 "tmpdir/libdl2b.so" ""
289 {dl2main.c} "dl2b" "dl2b.out"}
290 {"Run with libdl2c.so"
291 "tmpdir/libdl2c.so" ""
292 {dl2main.c} "dl2c" "dl2b.out"}
293 {"Run with libdl4a.so"
294 "tmpdir/libdl4a.so" ""
295 {dl4main.c} "dl4a" "dl4a.out"}
296 {"Run with libdl4b.so"
297 "tmpdir/libdl4b.so" ""
298 {dl4main.c} "dl4b" "dl4a.out"}
299 {"Run with libdl4c.so"
300 "tmpdir/libdl4c.so" ""
301 {dl4main.c} "dl4c" "dl4b.out"}
302 {"Run with libdl4d.so"
303 "tmpdir/libdl4d.so" ""
304 {dl4main.c} "dl4d" "dl4b.out"}
305 {"Run with libdl4e.so"
306 "tmpdir/libdl4e.so" ""
307 {dl4main.c} "dl4e" "dl4a.out"}
308 {"Run with libdl4f.so"
309 "tmpdir/libdl4f.so" ""
310 {dl4main.c} "dl4f" "dl4a.out"}
311 {"Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so"
312 "--dynamic-list-data -ldl" ""
313 {dl6amain.c} "dl6a1" "dl6a.out"}
314 {"Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so"
315 "-Bsymbolic-functions -ldl" ""
316 {dl6amain.c} "dl6a2" "dl6b.out"}
317 {"Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so"
318 "-Bsymbolic -ldl" ""
319 {dl6amain.c} "dl6a3" "dl6b.out"}
320 {"Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so"
321 "-Bsymbolic --dynamic-list-data -ldl" ""
322 {dl6amain.c} "dl6a4" "dl6a.out"}
323 {"Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so"
324 "-Bsymbolic-functions --dynamic-list-cpp-new -ldl" ""
325 {dl6amain.c} "dl6a5" "dl6b.out"}
326 {"Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so"
327 "--dynamic-list-cpp-new -Bsymbolic-functions -ldl" ""
328 {dl6amain.c} "dl6a6" "dl6b.out"}
329 {"Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so"
330 "--dynamic-list-data -Bsymbolic -ldl" ""
331 {dl6amain.c} "dl6a7" "dl6a.out"}
332 {"Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so"
333 "--dynamic-list-data -ldl" ""
334 {dl6bmain.c} "dl6b1" "dl6a.out"}
335 {"Run dl6b2 with dlopen on libdl6b.so"
336 "-ldl" ""
337 {dl6bmain.c} "dl6b2" "dl6b.out"}
338 {"Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so"
339 "--dynamic-list-data -ldl" ""
340 {dl6cmain.c} "dl6c1" "dl6b.out"}
341 {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so"
342 "--dynamic-list-data -ldl" ""
343 {dl6dmain.c} "dl6d1" "dl6b.out"}
344 {"Run with libdata1.so"
345 "tmpdir/libdata1.so" ""
346 {dynbss1.c} "dynbss1" "pass.out"}
347 {"Run with libdata2.so"
348 "tmpdir/libdata2.so" ""
349 {weakdef1.c} "weakdef1" "pass.out"}
350 {"Run with libfunc1.so comm1.o"
351 "tmpdir/libfunc1.so tmpdir/comm1.o" ""
352 {dummy.c} "comm1" "pass.out"}
353 {"Run with comm1.o libfunc1.so"
354 "tmpdir/comm1.o tmpdir/libfunc1.so" ""
355 {dummy.c} "comm1" "pass.out"}
356 {"Run with pr11138-2.c libpr11138-1.so"
357 "--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" ""
358 {dummy.c} "pr11138a" "pr11138.out"}
359 {"Run with libpr11138-1.so pr11138-2.c"
360 "--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" ""
361 {dummy.c} "pr11138b" "pr11138.out"}
362 {"Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so"
363 "--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" ""
364 {dummy.c} "pr13250" "pass.out"}
365 {"Run with pr14323-1.c pr14323-2.so"
366 "tmpdir/libpr14323-2.so" ""
367 {pr14323-1.c} "pr14323" "pass.out"}
368 {"Run with pr14862-1.c libpr14862.so"
369 "--as-needed tmpdir/libpr14862-1.o tmpdir/libpr14862.so" ""
370 {dummy.c} "pr14862" "pr14862.out"}
371 {"Link with --add-needed"
372 "tmpdir/libneeded1c.o --add-needed -rpath=tmpdir -Ltmpdir -lneeded1a" ""
373 {dummy.c} "needed1a" "needed1.out"}
374 {"Link with --copy-dt-needed-entries"
375 "tmpdir/libneeded1c.o --copy-dt-needed-entries -rpath=tmpdir -Ltmpdir -lneeded1a" ""
376 {dummy.c} "needed1b" "needed1.out"}
377 {"Run relmain"
378 "--no-as-needed -rpath=tmpdir -Ltmpdir -lrel" ""
379 {relmain.c} "relmain" "relmain.out"}
380 {"Run pr2404"
381 "tmpdir/pr2404b.o tmpdir/libpr2404a.so" ""
382 {dummy.c} "pr2404" "pr2404.out"}
383 }
384
385 # NetBSD ELF systems do not currently support the .*_array sections.
386 run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests
387
388 # Check --no-add-needed and --no-copy-dt-needed-entries
389 set testname "--no-add-needed"
390 set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
391 if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
392 pass $testname
393 } {
394 fail $testname
395 }
396 set testname "--no-copy-dt-needed-entries"
397 set 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"]
398 if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
399 pass $testname
400 } {
401 fail $testname
402 }
403 set testname "--no-add-needed -shared"
404 set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag -shared tmpdir/libneeded1pic.o -Wl,--no-add-needed,-z,defs -Ltmpdir -lneeded1a"]
405 if { [ regexp "undefined reference to `bar'" $exec_output ] } {
406 pass $testname
407 } {
408 fail $testname
409 }
410 set testname "--no-copy-dt-needed-entries -shared"
411 set 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"]
412 if { [ regexp "undefined reference to `bar'" $exec_output ] } {
413 pass $testname
414 } {
415 fail $testname
416 }
417
418 # Check to see if the C++ compiler works
419 if { [which $CXX] == 0 } {
420 return
421 }
422
423 set build_cxx_tests {
424 {"Build libdl3a.so with --dynamic-list=dl3.list"
425 "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
426 {dl3.cc} {} "libdl3a.so" "c++"}
427 {"Build libdl3b.so with -Bsymbolic"
428 "-shared -Wl,-Bsymbolic" "-fPIC"
429 {dl3.cc} {} "libdl3b.so" "c++"}
430 {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
431 "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
432 {dl3.cc} {} "libdl3c.so" "c++"}
433 {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
434 "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
435 {del.cc new.cc} {} "libnew1a.so" "c++"}
436 {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
437 "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC"
438 {del.cc new.cc} {} "libnew1b.so" "c++"}
439 }
440
441 # "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
442 # {"Run with libdl3b.so"
443 # "tmpdir/libdl3b.so" ""
444 # {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
445 set run_cxx_tests {
446 {"Run with libdl3a.so"
447 "-Wl,--no-as-needed tmpdir/libdl3a.so" ""
448 {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
449 {"Run with libdl3c.so"
450 "-Wl,--no-as-needed tmpdir/libdl3c.so" ""
451 {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
452 {"Run with libnew1a.so"
453 "tmpdir/libnew1a.so" ""
454 {dl5.cc} "dl5a" "dl5.out" "" "c++"}
455 {"Run with libnew1b.so"
456 "tmpdir/libnew1b.so" ""
457 {dl5.cc} "dl5b" "dl5.out" "" "c++"}
458 }
459
460 run_cc_link_tests $build_cxx_tests
461 run_ld_link_exec_tests [] $run_cxx_tests
462
463 if { [istarget *-*-linux*]
464 || [istarget *-*-nacl*]
465 || [istarget *-*-gnu*] } {
466 run_cc_link_tests [list \
467 [list \
468 "Build libpr2404b.a with PIE" \
469 "" \
470 "-fPIE" \
471 { pr2404b.c } \
472 {} \
473 "libpr2404b.a" \
474 ] \
475 ]
476 run_ld_link_exec_tests [] [list \
477 [list \
478 "Run pr2404 with PIE" \
479 "-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
480 "" \
481 { dummy.c } \
482 "pr2404pie" \
483 "pr2404.out" \
484 "-fPIE" \
485 ] \
486 ]
487 }
This page took 0.042475 seconds and 5 git commands to generate.