7514eb116bb4572ee4ad598ab575871aea0f728a
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / shared.exp
1 # Expect script for various ELF tests.
2 # Copyright (C) 2006-2017 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 # Skip targets where -shared is not supported
29
30 if ![check_shared_lib_support] {
31 return
32 }
33
34 # Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
35 global NOPIE_CFLAGS NOPIE_LDFLAGS
36
37 # This target requires extra GAS options when building code for shared
38 # libraries.
39 set AFLAGS_PIC ""
40 if [istarget "tic6x-*-*"] {
41 append AFLAGS_PIC " -mpic -mpid=near"
42 }
43 # This target requires a non-default emulation for successful shared
44 # library/executable builds.
45 set LFLAGS ""
46 if [istarget "tic6x-*-*"] {
47 append LFLAGS " -melf32_tic6x_le"
48 }
49
50 if [is_underscore_target] {
51 set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1"
52 }
53
54 run_ld_link_tests [list \
55 [list \
56 "Build pr22471a.so" \
57 "$LFLAGS -shared" \
58 "" \
59 "$AFLAGS_PIC" \
60 {pr22471a.s} \
61 {} \
62 "pr22471a.so" \
63 ] \
64 [list \
65 "Build pr22471b.so" \
66 "$LFLAGS -shared --version-script pr22471.t" \
67 "tmpdir/pr22471a.so" \
68 "$AFLAGS_PIC" \
69 {pr22471a.s} \
70 {} \
71 "pr22471b.so" \
72 ] \
73 [list \
74 "Build pr22471" \
75 "$LFLAGS -rpath-link ." \
76 "tmpdir/pr22471b.so" \
77 "" \
78 {pr22471b.s} \
79 {} \
80 "pr22471" \
81 ] \
82 ]
83
84 # PR ld/20828 check for correct dynamic symbol table entries where:
85 # - symbols have been defined with a linker script,
86 # - the same symbols have been seen in shared library used in the link,
87 # - the shared library symbols have been swept in section garbage collection.
88 # Verify that the symbols are global rather than local and that a version
89 # script adjusts them accordingly.
90 # Also verify that a version definition supplied by an object rather than
91 # a version script and forcibly exported is unaffected by section GC.
92 if { [check_gc_sections_available] } {
93 run_ld_link_tests [list \
94 [list \
95 "PR ld/20828 dynamic symbols with section GC\
96 (auxiliary shared library)" \
97 "$LFLAGS -shared --gc-sections -T pr20828.ld" "" "$AFLAGS_PIC" \
98 {pr20828.s} \
99 {{readelf --dyn-syms pr20828-a.sd} \
100 {readelf --dyn-syms pr20828-b.sd}} \
101 "libpr20828.so"] \
102 [list \
103 "PR ld/20828 dynamic symbols with section GC (plain)" \
104 "$LFLAGS -shared --gc-sections -T pr20828.ld" \
105 "tmpdir/libpr20828.so" "$AFLAGS_PIC" \
106 {pr20828.s} \
107 {{readelf --dyn-syms pr20828-a.sd} \
108 {readelf --dyn-syms pr20828-b.sd}} \
109 "pr20828-1.so"] \
110 [list \
111 "PR ld/20828 dynamic symbols with section GC (version script)" \
112 "$LFLAGS -shared --gc-sections -T pr20828.ld\
113 --version-script=pr20828.ver" \
114 "tmpdir/libpr20828.so" \
115 "$AFLAGS_PIC" \
116 {pr20828.s} \
117 {{readelf --dyn-syms pr20828-b.sd} \
118 {readelf --dyn-syms pr20828-c.sd}} \
119 "pr20828-2.so"] \
120 [list \
121 "PR ld/20828 dynamic symbols with section GC\
122 (versioned shared library)" \
123 "$LFLAGS -shared --gc-sections -T pr20828.ld\
124 --version-script=pr20828-v.ver" \
125 "" "$AFLAGS_PIC" \
126 {pr20828.s} \
127 {{readelf --dyn-syms pr20828-c.sd} \
128 {readelf --dyn-syms pr20828-d.sd} \
129 {readelf --dyn-syms pr20828-e.sd}} \
130 "libpr20828-v.so"] \
131 [list \
132 "PR ld/20828 dynamic symbols with section GC (versioned)" \
133 "$LFLAGS -shared --gc-sections -T pr20828.ld\
134 --version-script=pr20828-v.ver" \
135 "tmpdir/libpr20828-v.so" \
136 "$AFLAGS_PIC" \
137 {pr20828.s} \
138 {{readelf --dyn-syms pr20828-c.sd} \
139 {readelf --dyn-syms pr20828-d.sd} \
140 {readelf --dyn-syms pr20828-e.sd}} \
141 "pr20828-v.so"] \
142 [list \
143 "PR ld/20828 forcibly exported symbol version without section GC" \
144 "$LFLAGS --no-dynamic-linker -e foo -E -T pr20828-v.ld" "" "" \
145 {pr20828-v.s} \
146 {{objdump -p pr20828-v.od}} \
147 "pr20828-v-1"] \
148 [list \
149 "PR ld/20828 forcibly exported symbol version with section GC" \
150 "$LFLAGS --no-dynamic-linker -e foo --gc-sections -E -T pr20828-v.ld" "" "" \
151 {pr20828-v.s} \
152 {{objdump -p pr20828-v.od}} \
153 "pr20828-v-2"]]
154 }
155 # PR ld/21233 check for correct dynamic symbol table entries where:
156 # - a symbol has been defined in a shared library used in the link,
157 # - the symbol has been referenced from a section swept in garbage collection,
158 # - the symbol has also been forced to be entered in the output file as an
159 # undefined symbol, either with a command-line option or a linker script
160 # command.
161 # Verify that the undefined symbol is global rather than local.
162 if { [check_gc_sections_available] } {
163 run_ld_link_tests [list \
164 [list \
165 "PR ld/21233 dynamic symbols with section GC\
166 (auxiliary shared library)" \
167 "$LFLAGS -shared -T pr21233.ld" "" "$AFLAGS_PIC" \
168 {pr21233-l.s} \
169 {{readelf --dyn-syms pr21233-l.sd}} \
170 "libpr21233.so"]]
171
172 run_ld_link_tests [list \
173 [list \
174 "PR ld/21233 dynamic symbols with section GC (--undefined)" \
175 "$LFLAGS --gc-sections -e foo --undefined=bar -T pr21233.ld" \
176 "tmpdir/libpr21233.so" "" \
177 {pr21233.s} \
178 {{readelf --dyn-syms pr21233.sd}} \
179 "pr21233-1"]]
180
181 run_ld_link_tests [list \
182 [list \
183 "PR ld/21233 dynamic symbols with section GC (--require-defined)" \
184 "$LFLAGS --gc-sections -e foo --require-defined=bar\
185 -T pr21233.ld" \
186 "tmpdir/libpr21233.so" "" \
187 {pr21233.s} \
188 {{readelf --dyn-syms pr21233.sd}} \
189 "pr21233-2"]]
190
191 run_ld_link_tests [list \
192 [list \
193 "PR ld/21233 dynamic symbols with section GC (EXTERN)" \
194 "$LFLAGS --gc-sections -e foo -T pr21233-e.ld" \
195 "tmpdir/libpr21233.so" "" \
196 {pr21233.s} \
197 {{readelf --dyn-syms pr21233.sd}} \
198 "pr21233-3"]]
199 }
200
201 if { [check_gc_sections_available] } {
202 run_ld_link_tests [list \
203 [list \
204 "Build pr22150.so" \
205 "$LFLAGS -shared --version-script pr22150.ver" \
206 "" \
207 "$AFLAGS_PIC" \
208 {pr22150a.s} \
209 {} \
210 "pr22150.so" \
211 ] \
212 [list \
213 "Build pr22150" \
214 "$LFLAGS -e _start --gc-sections" \
215 "tmpdir/pr22150.so" \
216 "" \
217 {pr22150b.s} \
218 {{readelf -V pr22150.vd}} \
219 "pr22150" \
220 ] \
221 ]
222 }
223
224 # Check to see if the C compiler works
225 if { [which $CC] == 0 } {
226 return
227 }
228
229 # Add -ldl to extralibs if needed
230 set extralibs ""
231 if { ![istarget *-*-freebsd*]} {
232 set extralibs "-ldl"
233 }
234
235 set build_tests {
236 {"Build libfoo.so"
237 "-shared" "-fPIC"
238 {foo.c} {} "libfoo.so"}
239 {"Build versioned libfoo.so"
240 "-shared -Wl,--version-script=foo.map" "-fPIC"
241 {foo.c} {} "libfoov.so"}
242 {"Build libbar.so"
243 "-shared" "-fPIC"
244 {begin.c end.c} {} "libbar.so"}
245 {"Build warn libbar.so"
246 "-shared" "-fPIC"
247 {beginwarn.c end.c}
248 {{readelf {-S --wide} libbarw.rd}
249 {warning "^.*beginwarn.c:7: warning: function foo is deprecated$"}}
250 "libbarw.so" "c"}
251 {"Build hidden libbar.so"
252 "-shared" "-fPIC"
253 {begin.c endhidden.c} {} "libbarh.so"}
254 {"Build protected libbar.so"
255 "-shared" "-fPIC"
256 {begin.c endprotected.c} {} "libbarp.so"}
257 {"Build libbar.so with libfoo.so"
258 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
259 {end.c} {} "libbarfoo.so"}
260 {"Build libar.so with versioned libfoo.so"
261 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
262 {end.c} {} "libbarfoov.so"}
263 {"Build hidden libbar.so with libfoo.so"
264 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
265 {endhidden.c} {} "libbarhfoo.so"}
266 {"Build hidden libar.so with versioned libfoo.so"
267 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
268 {endhidden.c} {} "libbarhfoov.so"}
269 {"Build protected libbar.so with libfoo.so"
270 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
271 {endprotected.c} {} "libbarpfoo.so"}
272 {"Build protected libbar.so with versioned libfoo.so"
273 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
274 {endprotected.c} {} "libbarpfoov.so"}
275 {"Build libdl1.so"
276 "-shared" "-fPIC"
277 {dl1.c} {} "libdl1.so"}
278 {"Build libdl2a.so with --dynamic-list=dl2.list"
279 "-shared -Wl,--dynamic-list=dl2.list" "-fPIC"
280 {dl2.c dl2xxx.c} {} "libdl2a.so"}
281 {"Build libdl2a.so with --dynamic-list=dl2a.list"
282 "-shared -Wl,--dynamic-list=dl2a.list" "-fPIC"
283 {dl2.c dl2xxx.c} {} "libdl2a.so"}
284 {"Build libdl2a.so with --dynamic-list-data"
285 "-shared -Wl,--dynamic-list-data" "-fPIC"
286 {dl2.c dl2xxx.c} {} "libdl2a.so"}
287 {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
288 "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
289 {dl2.c dl2xxx.c} {} "libdl2b.so"}
290 {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
291 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
292 {dl2.c dl2xxx.c} {} "libdl2c.so"}
293 {"Build libdl4a.so with --dynamic-list=dl4.list"
294 "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
295 {dl4.c dl4xxx.c} {} "libdl4a.so"}
296 {"Build libdl4b.so with --dynamic-list-data"
297 "-shared -Wl,--dynamic-list-data" "-fPIC"
298 {dl4.c dl4xxx.c} {} "libdl4b.so"}
299 {"Build libdl4c.so with --dynamic-list=dl4.list and dl4xxx.list"
300 "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
301 {dl4.c dl4xxx.c} {} "libdl4c.so"}
302 {"Build libdl4d.so with --dynamic-list-data and dl4xxx.list"
303 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
304 {dl4.c dl4xxx.c} {} "libdl4d.so"}
305 {"Build libdl4e.so with -Bsymbolic-functions --dynamic-list-cpp-new"
306 "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
307 {dl4.c dl4xxx.c} {} "libdl4e.so"}
308 {"Build libdl4f.so with --dynamic-list-cpp-new -Bsymbolic-functions"
309 "-shared -Wl,--dynamic-list-cpp-new,-Bsymbolic-functions" "-fPIC"
310 {dl4.c dl4xxx.c} {} "libdl4f.so"}
311 {"Build libdl6a.so"
312 "-shared" "-fPIC"
313 {dl6.c} {} "libdl6a.so"}
314 {"Build libdl6b.so with -Bsymbolic --dynamic-list-data"
315 "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
316 {dl6.c} {} "libdl6b.so"}
317 {"Build libdl6c.so with -Bsymbolic"
318 "-shared -Wl,-Bsymbolic" "-fPIC"
319 {dl6.c} {} "libdl6c.so"}
320 {"Build libdl6d.so with --dynamic-list-data -Bsymbolic"
321 "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC"
322 {dl6.c} {} "libdl6d.so"}
323 {"Build libdata1.so"
324 "-shared" "-fPIC"
325 {data1.c} {} "libdata1.so"}
326 {"Build libdata2.so"
327 "-shared" "-fPIC"
328 {data2.c} {} "libdata2.so"}
329 {"Build libcomm1.o"
330 "-r -nostdlib" ""
331 {comm1.c} {} "libcomm1.o"}
332 {"Build libfunc1.so"
333 "-shared" "-fPIC"
334 {func1.c} {} "libfunc1.so"}
335 {"Build libpr9676-1.a"
336 "" "-fPIC"
337 {pr9676-1.c} {} "libpr9676-1.a"}
338 {"Build libpr9676-2.a"
339 "" "-fPIC"
340 {pr9676-2.c} {} "libpr9676-2.a"}
341 {"Build libpr9676-3.so"
342 "-shared" "-fPIC"
343 {pr9676-3.c} {} "libpr9676-3.so"}
344 {"Build libpr9676-4.so"
345 "-shared" "-fPIC"
346 {pr9676-4.c} {} "libpr9676-4.so"}
347 {"Build libpr9676-4a.so"
348 "-shared tmpdir/pr9676-4.o -Ltmpdir -lpr9676-3 -Wl,--start-group -lpr9676-1 -lpr9676-2 -Wl,--end-group"
349 "-fPIC"
350 {dummy.c} {{readelf {-s} pr9676.rd}} "libpr9676-4a.so"}
351 {"Build libpr9679.so"
352 "-shared" "-fPIC -O0"
353 {pr9679-1.c pr9679-2.c} {{readelf {-s} pr9679.rd}} "libpr9679.so"}
354 {"Build libpr11138-1.so"
355 "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
356 {pr11138-1.c} {} "libpr11138-1.so"}
357 {"Build libpr11138-2.o"
358 "-r -nostdlib" ""
359 {pr11138-2.c} {} "libpr11138-2.o"}
360 {"Build pr13250-1.so"
361 "-shared" "-fPIC"
362 {pr13250-1.c} {} "libpr13250-1.so"}
363 {"Build pr13250-2.so with libpr13250-1.so"
364 "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC"
365 {pr13250-2.c} {} "libpr13250-2.so"}
366 {"Build libpr13250-3.o"
367 "-r -nostdlib" ""
368 {pr13250-3.c} {} "libpr13250-3.o"}
369 {"Build libpr14323-2.so"
370 "-shared" "-fPIC"
371 {pr14323-2.c} {} "libpr14323-2.so"}
372 {"Build pr14862-1.o"
373 "-r -nostdlib" ""
374 {pr14862-1.c} {} "libpr14862-1.o"}
375 {"Build libpr14862.so"
376 "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
377 {pr14862-2.c} {} "libpr14862.so"}
378 {"Build libneeded1b.so"
379 "-shared" "-fPIC"
380 {needed1b.c} {} "libneeded1b.so"}
381 {"Build libneeded1a.so"
382 "-shared -Wl,--add-needed,--no-as-needed -Ltmpdir -lneeded1b" "-fPIC"
383 {needed1a.c} {} "libneeded1a.so"}
384 {"Build libneeded1c.o"
385 "-r -nostdlib" ""
386 {needed1c.c} {} "libneeded1c.o"}
387 {"Build libneeded1pic.o"
388 "-r -nostdlib" "-fPIC"
389 {needed1c.c} {} "libneeded1pic.o"}
390 {"Build needed1a.so with --add-needed"
391 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir,-rpath-link=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
392 {dummy.c} {} "needed1a.so"}
393 {"Build needed1b.so with --copy-dt-needed-entries"
394 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir,-rpath-link=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
395 {dummy.c} {} "needed1b.so"}
396 {"Build needed1a.so with --no-add-needed"
397 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--no-add-needed -Ltmpdir -lneeded1a" ""
398 {dummy.c} {} "needed1c.so"}
399 {"Build needed1b.so with --no-copy-dt-needed-entries"
400 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--no-copy-dt-needed-entries -Ltmpdir -lneeded1a" ""
401 {dummy.c} {} "needed1d.so"}
402 {"Build librel.so"
403 "-shared" "-fPIC"
404 {rel.c} {} "librel.so"}
405 {"Build libneeded2a.so"
406 "-shared" "-fPIC"
407 {needed2a.c} {} "libneeded2a.so"}
408 {"Build libneeded2b.so"
409 "-shared -Wl,--version-script,needed2.ver" "-fPIC"
410 {needed2b.c} {} "libneeded2b.so"}
411 {"Build libneeded2c.o"
412 "-r -nostdlib" ""
413 {needed2c.c} {} "libneeded2c.o"}
414 {"Build needed2"
415 "tmpdir/libneeded2c.o -Wl,--as-needed tmpdir/libneeded2a.so tmpdir/libneeded2b.so" ""
416 {dummy.c} {} "needed2"}
417 {"Build libneeded3a.so"
418 "-shared -Wl,--no-add-needed" "-fPIC"
419 {needed1a.c} {} "libneeded3a.so"}
420 {"Build libneeded3b.so"
421 "-shared -Wl,--no-as-needed,--add-needed -Ltmpdir -lneeded1b" "-fPIC"
422 {dummy.c} {} "libneeded3b.so"}
423 {"Build needed3.o"
424 "-r -nostdlib" ""
425 {needed3.c} {} "libneeded3.so"}
426 {"Build needed3"
427 "tmpdir/needed3.o -Wl,--as-needed -Ltmpdir -lneeded3a -lneeded3b -lneeded1b" ""
428 {dummy.c} {} "needed3"}
429 {"Build libpr2404a.so"
430 "-shared" "-fPIC"
431 {pr2404a.c} {} "libpr2404a.so"}
432 {"Build libpr2404n.so"
433 "-shared -Wl,-z,now" "-fPIC"
434 {pr2404a.c} {} "libpr2404n.so"}
435 {"Build libpr2404b.a"
436 "" ""
437 {pr2404b.c} {} "libpr2404b.a"}
438 {"Build rdynamic-1"
439 "-Wl,--no-dynamic-linker,-export-dynamic,--gc-sections" "-ffunction-sections"
440 {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
441 {"Build dynamic-1"
442 "-Wl,--no-dynamic-linker,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
443 {dynamic-1.c} {{readelf {-s} dynamic-1.rd}} "dynamic-1"}
444 {"Build libpr16496a.so"
445 "-shared -Wl,--version-script=pr16496a.map" "-fPIC"
446 {pr16496a.c} {} "libpr16496a.so"}
447 {"Build libpr16496b.a"
448 "" "-fPIC"
449 {pr16496b.c} {} "libpr16496b.a"}
450 {"Build libpr16496b.so"
451 "-shared -Wl,--no-as-needed tmpdir/pr16496b.o tmpdir/libpr16496a.so" ""
452 {dummy.c} {{objdump {-R} pr16496b.od}} "libpr16496b.so"}
453 {"Build libpr16452a.so"
454 "-shared -Wl,-soname,libpr16452a.so,--version-script=pr16452.map" "-fPIC"
455 {pr16452a.c} {} "libpr16452a.so"}
456 {"Build libpr16452b.so"
457 "-shared -Wl,-soname,libpr16452b.so,--no-as-needed tmpdir/libpr16452a.so" "-fPIC"
458 {dummy.c} {} "libpr16452b.so"}
459 {"Build pr16452"
460 "-Wl,--no-as-needed,-rpath=tmpdir,-rpath-link=tmpdir tmpdir/libpr16452b.so" ""
461 {pr16452b.c} {{objdump {-p} pr16452.od}} "pr16452"}
462 {"Build pr16457"
463 "-Wl,--no-as-needed,-rpath=tmpdir,-rpath-link=tmpdir tmpdir/libpr16452b.so" ""
464 {pr16452b.c} {{objdump {-p} pr16457.od}} "pr16457"}
465 {"Build libpr18458a.so"
466 "-shared -Wl,-z,now" "-fPIC"
467 {pr18458a.c} {} "libpr18458a.so"}
468 {"Build libpr18458b.so"
469 "-shared -Wl,-z,now tmpdir/libpr18458a.so" "-fPIC"
470 {pr18458b.c} {} "libpr18458b.so"}
471 {"Build pr19073a.o"
472 "-r -nostdlib" ""
473 {pr19073.s} {} "pr19073a.o"}
474 {"Build libpr19073.so"
475 "-shared -Wl,--version-script=pr19073.map tmpdir/pr19073a.o" "-fPIC"
476 {dummy.c} {{readelf {--dyn-syms --wide} pr19073.rd}} "libpr19073.so"}
477 {"Build pr21964-1a.so"
478 "-shared" "-fPIC"
479 {pr21964-1a.c} {} "pr21964-1a.so"}
480 {"Build pr21964-1b.so"
481 "-shared" "-fPIC"
482 {pr21964-1b.c} {} "pr21964-1b.so"}
483 {"Build pr21964-2a.so"
484 "-shared" "-fPIC"
485 {pr21964-2a.c} {} "pr21964-2a.so"}
486 {"Build pr21964-2b.so"
487 "-shared" "-fPIC"
488 {pr21964-2b.c} {} "pr21964-2b.so"}
489 {"Dump pr21978.so"
490 "-shared" "-fPIC -g -O2"
491 {pr21978a.c pr21978b.c} {{objdump {-Sl} pr21978.od}} "pr21978.so"}
492 }
493
494 run_cc_link_tests $build_tests
495
496 run_ld_link_tests [list \
497 [list \
498 "Build pr22269-1" \
499 "-pie -e _start --no-dynamic-linker -z text" \
500 "" \
501 "" \
502 { pr22269-1.c } \
503 {{readelf -rW pr22269-1.rd}} \
504 "pr22269-1" \
505 "-fPIE -O2" \
506 ] \
507 ]
508
509 set run_tests [list \
510 [list "Run normal with libfoo.so" \
511 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" \
512 {main.c} "normal" "normal.out" ] \
513 [list "Run protected with libfoo.so" \
514 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" "" \
515 {main.c} "protected" "normal.out" ] \
516 [list "Run hidden with libfoo.so" \
517 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" "" \
518 {main.c} "hidden" "hidden.out" ] \
519 [list "Run normal with versioned libfoo.so" \
520 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" "" \
521 {main.c} "normalv" "normal.out" ] \
522 [list "Run warn with versioned libfoo.so" \
523 "-Wl,--no-as-needed tmpdir/beginwarn.o tmpdir/libfoov.so" "" \
524 {main.c} "warn" "warn.out" \
525 "" "c" {^.*beginwarn.c:7: warning: function foo is deprecated$} ] \
526 [list "Run protected with versioned libfoo.so" \
527 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" \
528 {main.c} "protected" "normal.out" ] \
529 [list "Run hidden with versioned libfoo.so" \
530 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" "" \
531 {main.c} "hiddenv" "hidden.out" ] \
532 [list "Run normal libbar.so with libfoo.so" \
533 "-Wl,--no-as-needed tmpdir/libbarfoo.so tmpdir/libfoo.so" "" \
534 {main.c} "normal" "normal.out" ] \
535 [list "Run protected libbar.so with libfoo.so" \
536 "-Wl,--no-as-needed tmpdir/libbarpfoo.so tmpdir/libfoo.so" "" \
537 {main.c} "protected" "normal.out" ] \
538 [list "Run hidden libbar.so with libfoo.so" \
539 "-Wl,--no-as-needed tmpdir/libbarhfoo.so tmpdir/libfoo.so" "" \
540 {main.c} "hidden" "hidden.out" ] \
541 [list "Run normal libbar.so with versioned libfoo.so" \
542 "-Wl,--no-as-needed tmpdir/libbarfoov.so tmpdir/libfoov.so" "" \
543 {main.c} "normal" "normal.out" ] \
544 [list "Run protected libbar.so with versioned libfoo.so" \
545 "-Wl,--no-as-needed tmpdir/libbarpfoov.so tmpdir/libfoov.so" "" \
546 {main.c} "protected" "normal.out" ] \
547 [list "Run hidden libbar.so with versioned libfoo.so" \
548 "-Wl,--no-as-needed tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" \
549 {main.c} "hidden" "hidden.out" ] \
550 [list "Run with libdl2a.so" \
551 "-Wl,--no-as-needed tmpdir/libdl2a.so" "" \
552 {dl2main.c} "dl2a" "dl2a.out" ] \
553 [list "Run with libdl2b.so" \
554 "-Wl,--no-as-needed tmpdir/libdl2b.so" "" \
555 {dl2main.c} "dl2b" "dl2b.out" ] \
556 [list "Run with libdl2c.so" \
557 "-Wl,--no-as-needed tmpdir/libdl2c.so" "" \
558 {dl2main.c} "dl2c" "dl2b.out" ] \
559 [list "Run with libdl4a.so" \
560 "-Wl,--no-as-needed tmpdir/libdl4a.so" "" \
561 {dl4main.c} "dl4a" "dl4a.out" ] \
562 [list "Run with libdl4b.so" \
563 "-Wl,--no-as-needed tmpdir/libdl4b.so" "" \
564 {dl4main.c} "dl4b" "dl4a.out" ] \
565 [list "Run with libdl4c.so" \
566 "-Wl,--no-as-needed tmpdir/libdl4c.so" "" \
567 {dl4main.c} "dl4c" "dl4b.out" ] \
568 [list "Run with libdl4d.so" \
569 "-Wl,--no-as-needed tmpdir/libdl4d.so" "" \
570 {dl4main.c} "dl4d" "dl4b.out" ] \
571 [list "Run with libdl4e.so" \
572 "-Wl,--no-as-needed tmpdir/libdl4e.so" "" \
573 {dl4main.c} "dl4e" "dl4a.out" ] \
574 [list "Run with libdl4f.so" \
575 "-Wl,--no-as-needed tmpdir/libdl4f.so" "" \
576 {dl4main.c} "dl4f" "dl4a.out" ] \
577 [list "Run with libdata1.so" \
578 "-Wl,--no-as-needed tmpdir/libdata1.so" "" \
579 {dynbss1.c} "dynbss1" "pass.out" ] \
580 [list "Run with libdata2.so" \
581 "-Wl,--no-as-needed tmpdir/libdata2.so" "" \
582 {weakdef1.c} "weakdef1" "pass.out" ] \
583 [list "Run with libfunc1.so comm1.o" \
584 "-Wl,--no-as-needed tmpdir/libfunc1.so tmpdir/comm1.o" "" \
585 {dummy.c} "comm1" "pass.out" ] \
586 [list "Run with comm1.o libfunc1.so" \
587 "-Wl,--no-as-needed tmpdir/comm1.o tmpdir/libfunc1.so" "" \
588 {dummy.c} "comm1" "pass.out" ] \
589 [list "Run with pr11138-2.c libpr11138-1.so" \
590 "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" "" \
591 {dummy.c} "pr11138a" "pr11138.out" ] \
592 [list "Run with libpr11138-1.so pr11138-2.c" \
593 "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" "" \
594 {dummy.c} "pr11138b" "pr11138.out" ] \
595 [list "Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" \
596 "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "" \
597 {dummy.c} "pr13250" "pass.out" ] \
598 [list "Run with pr14323-1.c pr14323-2.so" \
599 "-Wl,--no-as-needed tmpdir/libpr14323-2.so" "" \
600 {pr14323-1.c} "pr14323" "pass.out" ] \
601 [list "Run with pr14862-1.c libpr14862.so" \
602 "-Wl,--as-needed tmpdir/libpr14862-1.o tmpdir/libpr14862.so" "" \
603 {dummy.c} "pr14862" "pr14862.out" ] \
604 [list "Link with --add-needed" \
605 "tmpdir/libneeded1c.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir,-rpath-link=tmpdir -Ltmpdir -lneeded1a" "" \
606 {dummy.c} "needed1a" "needed1.out" ] \
607 [list "Link with --copy-dt-needed-entries" \
608 "tmpdir/libneeded1c.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir,-rpath-link=tmpdir -Ltmpdir -lneeded1a" "" \
609 {dummy.c} "needed1b" "needed1.out" ] \
610 [list "Run relmain" \
611 "-Wl,--no-as-needed,-rpath=tmpdir -Ltmpdir -lrel" "" \
612 {relmain.c} "relmain" "relmain.out" ] \
613 [list "Run pr2404" \
614 "-Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" "" \
615 {dummy.c} "pr2404" "pr2404.out" ] \
616 [list "Run pr2404n" \
617 "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" "" \
618 {dummy.c} "pr2404n" "pr2404.out" ] \
619 [list "Run pr18458" \
620 "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \
621 {pr18458c.c} "pr18458" "pass.out" ] \
622 [list "Run pr21964-1" \
623 "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1a.so tmpdir/pr21964-1b.so" "" \
624 {pr21964-1c.c} "pr21964-1" "pass.out" ] \
625 ]
626
627 # NetBSD ELF systems do not currently support the .*_array sections.
628 run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
629
630 # These tests require dlopen support.
631 set dlopen_run_tests [list \
632 [list "Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" \
633 "-Wl,--no-as-needed,--dynamic-list=dl1.list $extralibs" "" \
634 {dl1main.c} "dl1a" "dl1.out" ] \
635 [list "Run dl1b with --dynamic-list-data and dlopen on libdl1.so" \
636 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
637 {dl1main.c} "dl1b" "dl1.out" ] \
638 [list "Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" \
639 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
640 {dl6amain.c} "dl6a1" "dl6a.out" ] \
641 [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
642 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
643 {dl6amain.c} "dl6a2" "dl6b.out" "$NOPIE_CFLAGS" ] \
644 [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
645 "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
646 {dl6amain.c} "dl6a3" "dl6b.out" ] \
647 [list "Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" \
648 "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
649 {dl6amain.c} "dl6a4" "dl6a.out" ] \
650 [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
651 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
652 {dl6amain.c} "dl6a5" "dl6b.out" "$NOPIE_CFLAGS" ] \
653 [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
654 "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
655 {dl6amain.c} "dl6a6" "dl6b.out" "$NOPIE_CFLAGS" ] \
656 [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
657 "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
658 {dl6amain.c} "dl6a7" "dl6a.out" "$NOPIE_CFLAGS" ] \
659 [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
660 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
661 {dl6bmain.c} "dl6b1" "dl6a.out" ] \
662 [list "Run dl6b2 with dlopen on libdl6b.so" \
663 "-Wl,--no-as-needed $extralibs" "" \
664 {dl6bmain.c} "dl6b2" "dl6b.out" ] \
665 [list "Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" \
666 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
667 {dl6cmain.c} "dl6c1" "dl6b.out" ] \
668 [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \
669 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
670 {dl6dmain.c} "dl6d1" "dl6b.out" ] \
671 [list "Run pr21964-2" \
672 "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-2a.so $extralibs" "" \
673 {pr21964-2c.c} "pr21964-2" "pass.out" ] \
674 ]
675
676 # Only run them when libdl is available.
677 if [check_libdl_available] {
678 # XFAIL on NetBSD ELF systems as they do not currently support the .*_array
679 # sections.
680 run_ld_link_exec_tests $dlopen_run_tests "*-*-netbsdelf*"
681 }
682
683 # Check --no-add-needed and --no-copy-dt-needed-entries
684 set testname "--no-add-needed"
685 set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
686 if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
687 pass $testname
688 } {
689 fail $testname
690 }
691 set testname "--no-copy-dt-needed-entries"
692 set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-copy-dt-needed-entries,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
693 if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
694 pass $testname
695 } {
696 fail $testname
697 }
698 set testname "--no-add-needed -shared"
699 set exec_output [run_host_cmd "$CC" "-shared tmpdir/libneeded1pic.o -Wl,--no-add-needed,-z,defs -Ltmpdir -lneeded1a"]
700 if { [ regexp "undefined reference to `\.?bar'" $exec_output ] } {
701 pass $testname
702 } {
703 fail $testname
704 }
705 set testname "--no-copy-dt-needed-entries -shared"
706 set exec_output [run_host_cmd "$CC" "-shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries,-z,defs -Ltmpdir -lneeded1a"]
707 if { [ regexp "undefined reference to `\.?bar'" $exec_output ] } {
708 pass $testname
709 } {
710 fail $testname
711 }
712
713 # Check to see if the C++ compiler works
714 if { [which $CXX] == 0 } {
715 return
716 }
717
718 set build_cxx_tests {
719 {"Build libdl3a.so with --dynamic-list=dl3.list"
720 "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
721 {dl3.cc} {} "libdl3a.so" "c++"}
722 {"Build libdl3b.so with -Bsymbolic"
723 "-shared -Wl,-Bsymbolic" "-fPIC"
724 {dl3.cc} {} "libdl3b.so" "c++"}
725 {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
726 "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
727 {dl3.cc} {} "libdl3c.so" "c++"}
728 {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
729 "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC -ansi"
730 {del.cc new.cc} {} "libnew1a.so" "c++"}
731 {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
732 "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC -ansi"
733 {del.cc new.cc} {} "libnew1b.so" "c++"}
734 }
735
736 # "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
737 # {"Run with libdl3b.so"
738 # "tmpdir/libdl3b.so" ""
739 # {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
740 set run_cxx_tests {
741 {"Run with libdl3a.so"
742 "-Wl,--no-as-needed tmpdir/libdl3a.so" ""
743 {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
744 {"Run with libdl3c.so"
745 "-Wl,--no-as-needed tmpdir/libdl3c.so" ""
746 {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
747 {"Run with libnew1a.so"
748 "-Wl,--no-as-needed tmpdir/libnew1a.so" ""
749 {dl5.cc} "dl5a" "dl5.out" "-ansi" "c++"}
750 {"Run with libnew1b.so"
751 "-Wl,--no-as-needed tmpdir/libnew1b.so" ""
752 {dl5.cc} "dl5b" "dl5.out" "-ansi" "c++"}
753 }
754
755 run_cc_link_tests $build_cxx_tests
756 run_ld_link_exec_tests $run_cxx_tests
757
758 if { [istarget *-*-linux*]
759 || [istarget *-*-nacl*]
760 || [istarget *-*-gnu*] } {
761 run_cc_link_tests [list \
762 [list \
763 "Build libpr2404b.a with PIE" \
764 "" \
765 "-fPIE" \
766 { pr2404b.c } \
767 {} \
768 "libpr2404b.a" \
769 ] \
770 [list \
771 "Build pr19579a.o" \
772 "" "-fPIE" \
773 {pr19579a.c} \
774 {} \
775 "libpr19579a.a" \
776 ] \
777 [list \
778 "Build libpr19579.so" \
779 "-shared" \
780 "-fPIC" \
781 {pr19579b.c} \
782 {} \
783 "libpr19579.so" \
784 ] \
785 [list \
786 "Build libpr19579now.so" \
787 "-shared -Wl,-z,now" \
788 "-fPIC" \
789 {pr19579b.c} \
790 {} \
791 "libpr19579.so" \
792 ] \
793 ]
794 run_ld_link_exec_tests [list \
795 [list \
796 "Run pr18458 with PIE" \
797 "-pie -Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" \
798 "" \
799 {pr18458c.c} \
800 "pr18458p" \
801 "pass.out" \
802 "-fPIE" \
803 ] \
804 [list \
805 "Run pr2404 with PIE" \
806 "-pie -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
807 "" \
808 { dummy.c } \
809 "pr2404pie" \
810 "pr2404.out" \
811 "-fPIE" \
812 ] \
813 [list \
814 "Run pr2404 with PIE (-z now)" \
815 "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" \
816 "" \
817 { dummy.c } \
818 "pr2404pien" \
819 "pr2404.out" \
820 "-fPIE" \
821 ] \
822 [list \
823 "Run pr18718" \
824 "" \
825 "" \
826 { pr18718.c check-ptr-eq.c } \
827 "pr18718" \
828 "pass.out" \
829 "-O2 -I../bfd" \
830 ] \
831 [list \
832 "Run pr18718 (-z now)" \
833 "-Wl,-z,now" \
834 "" \
835 { pr18718.c check-ptr-eq.c } \
836 "pr18718" \
837 "pass.out" \
838 "-O2 -I../bfd" \
839 ] \
840 [list \
841 "Run pr18718 with PIE (1)" \
842 "-pie" \
843 "" \
844 { pr18718.c check-ptr-eq.c } \
845 "pr18718pie1" \
846 "pass.out" \
847 "-O2 -fPIE -I../bfd" \
848 ] \
849 [list \
850 "Run pr18718 with PIE (2)" \
851 "" \
852 "" \
853 { pr18718.c check-ptr-eq.c } \
854 "pr18718pie2" \
855 "pass.out" \
856 "-O2 -fPIE -I../bfd" \
857 ] \
858 [list \
859 "Run pr18718 with PIE (3)" \
860 "-pie -Wl,-z,now" \
861 "" \
862 { pr18718.c check-ptr-eq.c } \
863 "pr18718pie3" \
864 "pass.out" \
865 "-O2 -fPIE -I../bfd" \
866 ] \
867 [list \
868 "Run pr18718 with PIE (4)" \
869 "-Wl,-z,now" \
870 "" \
871 { pr18718.c check-ptr-eq.c } \
872 "pr18718pie4" \
873 "pass.out" \
874 "-O2 -fPIE -I../bfd" \
875 ] \
876 [list \
877 "Run pr18718 with PIC (1)" \
878 "" \
879 "" \
880 { pr18718.c check-ptr-eq.c } \
881 "pr18718pic1" \
882 "pass.out" \
883 "-O2 -fPIC -I../bfd" \
884 ] \
885 [list \
886 "Run pr18718 with PIC (2)" \
887 "-pie" \
888 "" \
889 { pr18718.c check-ptr-eq.c } \
890 "pr18718pic2" \
891 "pass.out" \
892 "-O2 -fPIC -I../bfd" \
893 ] \
894 [list \
895 "Run pr18718 with PIC (3)" \
896 "-Wl,-z,now" \
897 "" \
898 { pr18718.c check-ptr-eq.c } \
899 "pr18718pic3" \
900 "pass.out" \
901 "-O2 -fPIC -I../bfd" \
902 ] \
903 [list \
904 "Run pr18718 with PIC (4)" \
905 "-pie -Wl,-z,now" \
906 "" \
907 { pr18718.c check-ptr-eq.c } \
908 "pr18718pic4" \
909 "pass.out" \
910 "-O2 -fPIC -I../bfd" \
911 ] \
912 [list \
913 "Run pr19579" \
914 "-pie -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o tmpdir/libpr19579.so" \
915 "" \
916 {dummy.c} \
917 "pr19579" \
918 "pass.out" \
919 "-fPIE" \
920 ] \
921 [list \
922 "Run pr19579 (-z now)" \
923 "-pie -Wl,-z,now -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o tmpdir/libpr19579.so" \
924 "" \
925 {dummy.c} \
926 "pr19579n" \
927 "pass.out" \
928 "-fPIE" \
929 ] \
930 ]
931 }
932
933 proc mix_pic_and_non_pic {xfails cflags ldflags exe} {
934 run_cc_link_tests [list \
935 [list \
936 "Build libpr19719a.so" \
937 "-shared -Wl,-soname,libpr19719.so" \
938 "-fPIC" \
939 { pr19719d.c } \
940 {} \
941 "libpr19719a.so" \
942 ] \
943 [list \
944 "Build libpr19719b.so" \
945 "-shared -Wl,-soname,libpr19719.so" \
946 "-fPIC" \
947 { dummy.c } \
948 {} \
949 "libpr19719b.so" \
950 ] \
951 [list \
952 "Build libpr19719b.o" \
953 "-r -nostdlib" \
954 "-fPIC" \
955 { pr19719b.c } \
956 {} \
957 "libpr19719b.o" \
958 ] \
959 ]
960
961 send_log "cp tmpdir/libpr19719b.so tmpdir/libpr19719.so\n"
962 exec cp tmpdir/libpr19719b.so tmpdir/libpr19719.so
963
964 run_ld_link_exec_tests [list \
965 [list \
966 "Run $exe fun defined" \
967 "-Wl,--no-as-needed,-rpath,tmpdir $ldflags tmpdir/libpr19719b.o tmpdir/libpr19719.so" \
968 "" \
969 { pr19719a.c pr19719c.c } \
970 $exe \
971 "pass.out" \
972 "$cflags" \
973 ] \
974 ]
975
976 send_log "cp tmpdir/libpr19719a.so tmpdir/libpr19719.so\n"
977 exec cp tmpdir/libpr19719a.so tmpdir/libpr19719.so
978
979 foreach targ $xfails {
980 setup_xfail $targ
981 }
982
983 if ![isnative] {
984 unsupported "Run $exe fun undefined"
985 return
986 }
987
988 set exec_output [run_host_cmd "tmpdir/$exe" ""]
989 if {![string match "PASS" $exec_output]} {
990 fail "Run $exe fun undefined"
991 } else {
992 pass "Run $exe fun undefined"
993 }
994 }
995
996 mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" "" "pr19719"
997 mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie"
This page took 0.051257 seconds and 4 git commands to generate.