Fix parens in ld bootstrap.exp
[deliverable/binutils-gdb.git] / ld / testsuite / ld-ifunc / ifunc.exp
CommitLineData
d8045f23
NC
1# Expect script for linker support of IFUNC symbols and relocations.
2#
219d1afa 3# Copyright (C) 2009-2018 Free Software Foundation, Inc.
d8045f23
NC
4# Contributed by Red Hat.
5#
6# This file is part of the GNU Binutils.
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21# MA 02110-1301, USA.
22#
23# Written by Nick Clifton <nickc@redhat.com>
24
25
d0c9aeb3 26# IFUNC support has only been implemented for the ix86, x86_64, powerpc,
e44c481a 27# aarch64, sparc, and S/390 so far.
e054468f
AM
28if {!(([istarget "i?86-*-*"]
29 || [istarget "x86_64-*-*"]
d0c9aeb3 30 || [istarget "powerpc*-*-*"]
1419bbe5 31 || [istarget "aarch64*-*-*"]
e44c481a
AK
32 || [istarget "sparc*-*-*"]
33 || [istarget "s390*-*-*"])
e054468f 34 && ([istarget "*-*-elf*"]
5a68afcf 35 || [istarget "*-*-nacl*"]
c65c21e1
AM
36 || [istarget "*-*-linux*"]
37 || [istarget "*-*-gnu*"])) } {
d8045f23
NC
38 verbose "IFUNC tests not run - target does not support IFUNC"
39 return
40}
41
47523653
AM
42# Skip targets where -shared is not supported
43
44if ![check_shared_lib_support] {
45 return
46}
47
f657f8c4
NC
48# This test does not need a compiler...
49run_dump_test "ifuncmod5"
50
ac98f9e2
L
51set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
52foreach t $test_list {
53 # We need to strip the ".d", but can leave the dirname.
54 verbose [file rootname $t]
55 run_dump_test [file rootname $t]
56}
57
d8045f23
NC
58# We need a working compiler. (Strictly speaking this is
59# not true, we could use target specific assembler files).
60if { [which $CC] == 0 } {
61 verbose "IFUNC tests not run - no compiler available"
62 return
63}
64
65# A procedure to check the OS/ABI field in the ELF header of a binary file.
66proc check_osabi { binary_file expected_osabi } {
67 global READELF
68 global READELFFLAGS
69
70 catch "exec $READELF $READELFFLAGS --file-header $binary_file > readelf.out" got
71
72 if ![string match "" $got] then {
73 verbose "proc check_osabi: Readelf produced unexpected out processing $binary_file: $got"
74 return 0
75 }
76
77 if { ![regexp "\n\[ \]*OS/ABI:\[ \]*(.+)\n\[ \]*ABI" \
78 [file_contents readelf.out] nil osabi] } {
79 verbose "proc check_osabi: Readelf failed to extract an ELF header from $binary_file"
80 return 0
81 }
82
83 if { $osabi == $expected_osabi } {
84 return 1
85 }
86
87 verbose "Expected OSABI: $expected_osabi, Obtained osabi: $osabi"
5a68afcf 88
d8045f23
NC
89 return 0
90}
91
92# A procedure to confirm that a file contains the IFUNC symbol.
93# Returns -1 upon error, 0 if the symbol was not found and 1 if it was found.
94proc contains_ifunc_symbol { binary_file } {
95 global READELF
96 global READELFFLAGS
97
98 catch "exec $READELF $READELFFLAGS --symbols $binary_file > readelf.out" got
99
100 if ![string match "" $got] then {
101 verbose "proc contains_ifunc_symbol: Readelf produced unexpected out processing $binary_file: $got"
102 return -1
103 }
104
105 # Look for a line like this:
106 # 58: 0000000000400600 30 IFUNC GLOBAL DEFAULT 12 library_func2
4115bfc6 107 # with perhaps some other info between the visibility and section
d8045f23 108
4115bfc6 109 if { ![regexp ".*\[ \]*IFUNC\[ \]+GLOBAL\[ \]+DEFAULT .* \[UND0-9\]+\[ \]+library_func2\n" [file_contents readelf.out]] } {
d8045f23
NC
110 return 0
111 }
112
113 return 1
114}
115
cbe950e9
L
116# A procedure to confirm that a file contains the R_*_IRELATIVE
117# relocation.
118# Returns -1 upon error, 0 if the relocation was not found and 1 if
119# it was found.
120proc contains_irelative_reloc { binary_file } {
121 global READELF
122 global READELFFLAGS
123
124 catch "exec $READELF $READELFFLAGS --relocs --wide $binary_file > readelf.out" got
125
126 if ![string match "" $got] then {
127 verbose "proc contains_irelative_reloc: Readelf produced unexpected out processing $binary_file: $got"
128 return -1
129 }
130
131 # Look for a line like this:
132 # 0000000000600ab0 0000000000000025 R_X86_64_IRELATIVE 000000000040061c
133 # 080496f4 0000002a R_386_IRELATIVE
134
135
425621e7 136 if { ![regexp "\[0-9a-f\]+\[ \]+\[0-9a-f\]+\[ \]+R_\[_0-9A-Z\]+_IREL(|ATIVE)\[ \]*\[0-9a-f\]*\n" [file_contents readelf.out]] } {
cbe950e9
L
137 return 0
138 }
139
140 return 1
141}
142
d8045f23
NC
143# A procedure to confirm that a file contains a relocation that references an IFUNC symbol.
144# Returns -1 upon error, 0 if the reloc was not found and 1 if it was found.
145proc contains_ifunc_reloc { binary_file } {
146 global READELF
147 global READELFFLAGS
148
149 catch "exec $READELF $READELFFLAGS --relocs $binary_file > readelf.out" got
150
151 if ![string match "" $got] then {
152 verbose "proc contains_ifunc_reloc: Readelf produced unexpected out processing $binary_file: $got"
153 return -1
154 }
155
156 if [string match "" [file_contents readelf.out]] then {
157 verbose "No relocs found in $binary_file"
158 return 0
159 }
160
161 if { ![regexp "\\(\\)" [file_contents readelf.out]] } {
162 return 0
163 }
164
165 return 1
166}
167
168set fails 0
169
170# Create the object files, libraries and executables.
be19bd51
L
171if ![ld_compile "$CC -c -fPIC" "$srcdir/$subdir/prog.c" "tmpdir/shared_prog.o"] {
172 fail "Could not create a PIC object file"
d8045f23
NC
173 set fails [expr $fails + 1]
174}
640d0ed8 175if ![ld_compile "$CC -c $NOPIE_CFLAGS" "$srcdir/$subdir/prog.c" "tmpdir/static_prog.o"] {
be19bd51 176 fail "Could not create a non-PIC object file"
d8045f23
NC
177 set fails [expr $fails + 1]
178}
be19bd51
L
179if ![ld_compile "$CC -c -fPIC -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/shared_ifunc.o"] {
180 fail "Could not create a PIC object file containing an IFUNC symbol"
d8045f23
NC
181 set fails [expr $fails + 1]
182}
640d0ed8 183if ![ld_compile "$CC -c $NOPIE_CFLAGS -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_ifunc.o"] {
be19bd51 184 fail "Could not create a non-PIC object file containing an IFUNC symbol"
d8045f23
NC
185 set fails [expr $fails + 1]
186}
be19bd51
L
187if ![ld_compile "$CC -c -DWITHOUT_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_noifunc.o"] {
188 fail "Could not create an ordinary non-PIC object file"
189 set fails [expr $fails + 1]
190}
191if ![ld_assemble $as "$srcdir/ld-elf/empty.s" "tmpdir/empty.o"] {
192 fail "Could not create an empty object file"
d8045f23
NC
193 set fails [expr $fails + 1]
194}
2955ec4c
L
195if ![ld_compile "$CC -c" "$srcdir/$subdir/test-1.c" "tmpdir/test-1.o"] {
196 fail "Could not create test-1.o"
197 set fails [expr $fails + 1]
198}
199if ![ld_compile "$CC -fPIC -c" "$srcdir/$subdir/test-2.c" "tmpdir/test-2.o"] {
200 fail "Could not create test-2.o"
201 set fails [expr $fails + 1]
202}
d8045f23
NC
203
204if { $fails != 0 } {
205 return
206}
207
d9816402 208if ![ld_link $ld "tmpdir/libshared_ifunc.so" "-shared tmpdir/shared_ifunc.o"] {
d8045f23
NC
209 fail "Could not create a shared library containing an IFUNC symbol"
210 set fails [expr $fails + 1]
211}
212if ![ar_simple_create $ar "" "tmpdir/libifunc.a" "tmpdir/static_ifunc.o"] {
213 fail "Could not create a static library containing an IFUNC symbol"
214 set fails [expr $fails + 1]
215}
216
217if { $fails != 0 } {
218 return
219}
220
d9816402 221if ![ld_link $CC "tmpdir/dynamic_prog" "-Wl,--no-as-needed,-rpath=./tmpdir,-Bdynamic -Ltmpdir tmpdir/shared_prog.o -lshared_ifunc"] {
d8045f23
NC
222 fail "Could not link a dynamic executable"
223 set fails [expr $fails + 1]
224}
640d0ed8 225if ![ld_link $CC "tmpdir/local_prog" "$NOPIE_LDFLAGS -Wl,--no-as-needed,-rpath=./tmpdir -Ltmpdir tmpdir/static_prog.o -lifunc"] {
e054468f
AM
226 fail "Could not link a dynamic executable using local ifunc"
227 set fails [expr $fails + 1]
228}
98d72909
L
229if ![string match "" $STATIC_LDFLAGS] {
230 if ![ld_link $CC "tmpdir/static_prog" "-static -Ltmpdir tmpdir/static_prog.o -lifunc"] {
231 fail "Could not link a static executable"
232 set fails [expr $fails + 1]
233 }
234 if ![ld_link $ld "tmpdir/static_nonifunc_prog" "-static tmpdir/empty.o"] {
235 fail "Could not link a non-ifunc using static executable"
236 set fails [expr $fails + 1]
237 }
d8045f23 238}
d9816402 239if ![ld_link $CC "tmpdir/test-1" "-Wl,--no-as-needed,-rpath=./tmpdir tmpdir/test-1.o tmpdir/libshared_ifunc.so"] {
2955ec4c
L
240 fail "Could not link test-1"
241 set fails [expr $fails + 1]
242}
d9816402 243if ![ld_link $ld "tmpdir/libtest-2.so" "-shared tmpdir/test-2.o"] {
2955ec4c
L
244 fail "Could not link libtest-2.so"
245 set fails [expr $fails + 1]
246}
e492d2f8
L
247if ![ld_link $ld "tmpdir/libtest-2-now.so" "-shared -z now tmpdir/test-2.o"] {
248 fail "Could not link libtest-2-now.so"
249 set fails [expr $fails + 1]
250}
d8045f23
NC
251
252if { $fails == 0 } {
253 pass "Building ifunc binaries"
254 set fails 0
255} else {
256 return
257}
258
cbe950e9 259# Check the executables and shared libraries
d8045f23 260#
cbe950e9 261# The linked ifunc using executables and the shared library containing
9c55345c 262# ifunc should have an OSABI field of GNU. The linked non-ifunc using
cbe950e9 263# executable should have an OSABI field of NONE (aka System V).
d8045f23 264
d9816402
AM
265case $target_triplet in {
266 { hppa*-*-linux* } { set expected_none {UNIX - GNU} }
267 default { set expected_none {UNIX - System V} }
268}
269
9c55345c
TS
270if {! [check_osabi tmpdir/libshared_ifunc.so {UNIX - GNU}]} {
271 fail "Shared libraries containing ifunc does not have an OS/ABI field of GNU"
cbe950e9
L
272 set fails [expr $fails + 1]
273}
9c55345c
TS
274if {! [check_osabi tmpdir/local_prog {UNIX - GNU}]} {
275 fail "Local ifunc-using executable does not have an OS/ABI field of GNU"
e054468f
AM
276 set fails [expr $fails + 1]
277}
98d72909
L
278if { ![string match "" $STATIC_LDFLAGS] \
279 && ![check_osabi tmpdir/static_prog {UNIX - GNU}]} {
9c55345c 280 fail "Static ifunc-using executable does not have an OS/ABI field of GNU"
d8045f23
NC
281 set fails [expr $fails + 1]
282}
d9816402
AM
283if {! [check_osabi tmpdir/dynamic_prog $expected_none]} {
284 fail "Dynamic ifunc-using executable does not have an OS/ABI field of $expected_none"
d8045f23
NC
285 set fails [expr $fails + 1]
286}
d9816402
AM
287if {! [check_osabi tmpdir/static_nonifunc_prog $expected_none]} {
288 fail "Static non-ifunc-using executable does not have an OS/ABI field of $expected_none"
be19bd51
L
289 set fails [expr $fails + 1]
290}
d8045f23 291
cbe950e9
L
292# The linked ifunc using executables and the shared library containing
293# ifunc should contain an IFUNC symbol. The non-ifunc using executable
294# should not.
d8045f23 295
cbe950e9
L
296if {[contains_ifunc_symbol tmpdir/libshared_ifunc.so] != 1} {
297 fail "Shared libraries containing ifunc does not contain an IFUNC symbol"
298 set fails [expr $fails + 1]
299}
e054468f
AM
300if {[contains_ifunc_symbol tmpdir/local_prog] != 1} {
301 fail "Local ifunc-using executable does not contain an IFUNC symbol"
302 set fails [expr $fails + 1]
303}
98d72909
L
304if { ![string match "" $STATIC_LDFLAGS] \
305 && [contains_ifunc_symbol tmpdir/static_prog] != 1} {
d8045f23
NC
306 fail "Static ifunc-using executable does not contain an IFUNC symbol"
307 set fails [expr $fails + 1]
308}
2955ec4c
L
309if {[contains_ifunc_symbol tmpdir/dynamic_prog] != 0} {
310 fail "Dynamic ifunc-using executable contains an IFUNC symbol"
d8045f23
NC
311 set fails [expr $fails + 1]
312}
313if {[contains_ifunc_symbol tmpdir/static_nonifunc_prog] != 0} {
314 fail "Static non-ifunc-using executable contains an IFUNC symbol"
315 set fails [expr $fails + 1]
316}
2955ec4c
L
317if {[contains_ifunc_symbol tmpdir/test-1] != 0} {
318 fail "test-1 contains IFUNC symbols"
319 set fails [expr $fails + 1]
320}
321if {[contains_ifunc_symbol tmpdir/libtest-2.so] != 0} {
322 fail "libtest-2.so contains IFUNC symbols"
323 set fails [expr $fails + 1]
324}
e492d2f8
L
325if {[contains_ifunc_symbol tmpdir/libtest-2-now.so] != 0} {
326 fail "libtest-2-now.so contains IFUNC symbols"
327 set fails [expr $fails + 1]
328}
d8045f23 329
cbe950e9
L
330# The linked ifunc using executables and shared libraries should contain
331# a dynamic reloc referencing the IFUNC symbol. (Even the static
332# executable which should have a dynamic section created for it). The
333# non-ifunc using executable should not.
d8045f23 334
cbe950e9
L
335if {[contains_irelative_reloc tmpdir/libshared_ifunc.so] != 1} {
336 fail "ifunc-using shared library does not contain R_*_IRELATIVE relocation"
337 set fails [expr $fails + 1]
338}
e054468f
AM
339if {[contains_irelative_reloc tmpdir/local_prog] != 1} {
340 fail "Local ifunc-using executable does not contain R_*_IRELATIVE relocation"
341 set fails [expr $fails + 1]
342}
98d72909
L
343if { ![string match "" $STATIC_LDFLAGS] \
344 && [contains_irelative_reloc tmpdir/static_prog] != 1} {
cbe950e9 345 fail "Static ifunc-using executable does not contain R_*_IRELATIVE relocation"
d8045f23
NC
346 set fails [expr $fails + 1]
347}
2955ec4c
L
348if {[contains_ifunc_reloc tmpdir/dynamic_prog] != 0} {
349 fail "Dynamic ifunc-using executable contains a reloc against an IFUNC symbol"
d8045f23
NC
350 set fails [expr $fails + 1]
351}
352if {[contains_ifunc_reloc tmpdir/static_nonifunc_prog] == 1} {
353 fail "Static non-ifunc-using executable contains a reloc against an IFUNC symbol!"
354 set fails [expr $fails + 1]
355}
356
357if { $fails == 0 } {
358 pass "Checking ifunc binaries"
359}
360
4584ec12
L
361run_cc_link_tests [list \
362 [list \
363 "Build libpr16467a.so" \
364 "-shared -Wl,--version-script=pr16467a.map" \
365 "-fPIC" \
366 { pr16467a.c } \
367 {} \
368 "libpr16467a.so" \
369 ] \
370 [list \
371 "Build libpr16467b.a" \
372 "" \
373 "-fPIC" \
374 { pr16467b.c } \
375 {} \
376 "libpr16467b.a" \
377 ] \
378 [list \
379 "Build libpr16467b.so" \
380 "-shared tmpdir/pr16467b.o tmpdir/libpr16467a.so \
381 -Wl,--version-script=pr16467b.map" \
382 "-fPIC" \
383 { dummy.c } \
384 {} \
385 "libpr16467b.so" \
386 ] \
387 [list \
388 "Build libpr16467c.a" \
389 "" \
390 "" \
391 { pr16467c.c } \
392 {} \
393 "libpr16467c.a" \
394 ] \
d6f48aed
L
395 [list \
396 "Build libpr16467an.so" \
397 "-shared -Wl,-z,now -Wl,--version-script=pr16467a.map" \
398 "-fPIC" \
399 { pr16467a.c } \
400 {} \
401 "libpr16467an.so" \
402 ] \
403 [list \
404 "Build libpr16467bn.so" \
405 "-shared tmpdir/pr16467b.o tmpdir/libpr16467an.so \
406 -Wl,--version-script=pr16467b.map" \
407 "-fPIC" \
408 { dummy.c } \
409 {} \
410 "libpr16467bn.so" \
411 ] \
4584ec12
L
412]
413
982c6f26 414run_ld_link_exec_tests [list \
37a9e49a
L
415 [list \
416 "Common symbol override ifunc test 1a" \
417 "-static" \
418 "" \
419 { ifunc-common-1a.c ifunc-common-1b.c } \
420 "ifunc-common-1a" \
421 "ifunc-common-1.out" \
422 "-g" \
423 ] \
424 [list \
425 "Common symbol override ifunc test 1b" \
426 "-static" \
427 "" \
428 { ifunc-common-1b.c ifunc-common-1a.c } \
429 "ifunc-common-1b" \
430 "ifunc-common-1.out" \
431 "-g" \
432 ] \
c22ee0ad
L
433]
434
c22ee0ad
L
435# Run-time tests which require working IFUNC support.
436if { ![check_ifunc_available] } {
437 return
438}
439
5f7cbeec
L
440run_cc_link_tests [list \
441 [list \
442 "Build ifunc-lib.so" \
443 "-shared" \
444 "-fPIC" \
445 { ifunc-lib.c } \
446 {} \
447 "libifunc-lib.so" \
448 ] \
d6f48aed
L
449 [list \
450 "Build ifunc-libn.so" \
451 "-shared -Wl,-z,now" \
452 "-fPIC" \
453 { ifunc-lib.c } \
454 {} \
455 "libifunc-libn.so" \
456 ] \
5f7cbeec
L
457]
458
982c6f26 459run_ld_link_exec_tests [list \
4584ec12
L
460 [list \
461 "Run pr16467" \
d9816402 462 "-Wl,--no-as-needed tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \
4584ec12
L
463 "" \
464 { dummy.c } \
465 "pr16467" \
466 "pr16467.out" \
467 "" \
468 ] \
d6f48aed
L
469 [list \
470 "Run pr16467 (-z now)" \
471 "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr16467c.o tmpdir/libpr16467bn.so tmpdir/libpr16467an.so" \
472 "" \
473 { dummy.c } \
474 "pr16467n" \
475 "pr16467.out" \
476 "" \
477 ] \
5f7cbeec
L
478 [list \
479 "Run ifunc-main" \
d9816402 480 "-Wl,--no-as-needed tmpdir/libifunc-lib.so" \
5f7cbeec
L
481 "" \
482 { ifunc-main.c } \
483 "ifunc-main" \
484 "ifunc-main.out" \
485 ] \
486 [list \
487 "Run ifunc-main with -fpic" \
d9816402 488 "-Wl,--no-as-needed tmpdir/libifunc-lib.so" \
5f7cbeec
L
489 "" \
490 { ifunc-main.c } \
491 "ifunc-main" \
492 "ifunc-main.out" \
493 "-fpic" \
494 ] \
d6f48aed
L
495 [list \
496 "Run ifunc-main (-z now)" \
497 "-Wl,-z,now -Wl,--no-as-needed tmpdir/libifunc-libn.so" \
498 "" \
499 { ifunc-main.c } \
500 "ifunc-mainn" \
501 "ifunc-main.out" \
502 ] \
503 [list \
504 "Run ifunc-main with PIE (-z now)" \
505 "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/libifunc-libn.so" \
506 "" \
507 { ifunc-main.c } \
508 "ifunc-mainpn" \
509 "ifunc-main.out" \
510 "-fpie" \
511 ] \
37a9e49a 512]
97dc35c8
L
513
514# Run-time tests which require working ifunc attribute support.
515if { ![check_ifunc_attribute_available] } {
516 return
517}
518
519run_cc_link_tests [list \
205ac185
L
520 [list \
521 "Build pr18808a.o" \
522 "" \
523 "" \
524 { pr18808a.c } \
525 "" \
526 "" \
527 ] \
97dc35c8
L
528 [list \
529 "Build libpr18808.so" \
530 "-shared" \
531 "-fPIC -O2 -g" \
532 { pr18808b.c } \
533 {} \
534 "libpr18808.so" \
535 ] \
d6f48aed
L
536 [list \
537 "Build libpr18808n.so" \
538 "-shared -Wl,-z,now" \
539 "-fPIC -O2 -g" \
540 { pr18808b.c } \
541 {} \
542 "libpr18808n.so" \
543 ] \
205ac185
L
544 [list \
545 "Build pr18841a.o" \
546 "" \
547 "" \
548 { pr18841a.c } \
549 "" \
550 "" \
551 ] \
cae1fbbb 552 [list \
4e1626f5 553 "Build libpr18841b.so" \
cae1fbbb
L
554 "-shared" \
555 "-fPIC -O0 -g" \
556 { pr18841b.c } \
557 {} \
4e1626f5
L
558 "libpr18841b.so" \
559 ] \
560 [list \
561 "Build libpr18841c.so" \
562 "-shared" \
563 "-fPIC -O0 -g" \
564 { pr18841c.c } \
565 {} \
566 "libpr18841c.so" \
cae1fbbb 567 ] \
d6f48aed
L
568 [list \
569 "Build libpr18841bn.so" \
570 "-Wl,-z,now -shared" \
571 "-fPIC -O0 -g" \
572 { pr18841b.c } \
573 {} \
574 "libpr18841bn.so" \
575 ] \
576 [list \
577 "Build libpr18841cn.so" \
578 "-shared" \
579 "-Wl,-z,now -fPIC -O0 -g" \
580 { pr18841c.c } \
581 {} \
582 "libpr18841cn.so" \
583 ] \
4ec09950
L
584 [list \
585 "Build libpr23169a.so" \
586 "-shared" \
587 "-fPIC -O2 -g" \
588 { pr23169a.c } \
589 {} \
590 "libpr23169a.so" \
591 ] \
592 [list \
593 "Build libpr23169b.so" \
594 "-shared -Wl,-z,now" \
595 "-fPIC -O2 -g" \
596 { pr23169a.c } \
597 {} \
598 "libpr23169b.so" \
599 ] \
600 [list \
601 "Build pr23169a" \
602 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libpr23169a.so" \
603 "$NOPIE_CFLAGS -O2 -g" \
604 { pr23169b.c pr23169c.c } \
605 {{readelf {--dyn-syms} pr23169a.rd} \
606 {readelf {-r -W} pr23169b.rd}} \
607 "pr23169a" \
608 ] \
609 [list \
610 "Build pr23169b" \
611 "-pie -Wl,--no-as-needed tmpdir/libpr23169a.so" \
612 "-fPIE -O2 -g" \
613 { pr23169b.c pr23169c.c } \
614 {{readelf {--dyn-syms} pr23169c.rd} \
615 {readelf {-r -W} pr23169b.rd}} \
616 "pr23169b" \
617 ] \
618 [list \
619 "Build pr23169c" \
620 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libpr23169a.so" \
621 "-fPIE -O2 -g" \
622 { pr23169b.c pr23169c.c } \
623 {{readelf {--dyn-syms} pr23169c.rd} \
624 {readelf {-r -W} pr23169b.rd}} \
625 "pr23169c" \
626 ] \
627 [list \
628 "Build pr23169d" \
629 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
630 "$NOPIE_CFLAGS -O2 -g" \
631 { pr23169b.c pr23169c.c } \
632 {{readelf {--dyn-syms} pr23169a.rd} \
633 {readelf {-r -W} pr23169b.rd}} \
634 "pr23169d" \
635 ] \
636 [list \
637 "Build pr23169e" \
638 "-pie -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
639 "-fPIE -O2 -g" \
640 { pr23169b.c pr23169c.c } \
641 {{readelf {--dyn-syms} pr23169c.rd} \
642 {readelf {-r -W} pr23169b.rd}} \
643 "pr23169e" \
644 ] \
645 [list \
646 "Build pr23169f" \
647 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
648 "-fPIE -O2 -g" \
649 { pr23169b.c pr23169c.c } \
650 {{readelf {--dyn-syms} pr23169c.rd} \
651 {readelf {-r -W} pr23169b.rd}} \
652 "pr23169f" \
653 ] \
97dc35c8
L
654]
655
982c6f26 656run_ld_link_exec_tests [list \
97dc35c8
L
657 [list \
658 "Run pr18808" \
d9816402 659 "-Wl,--no-as-needed tmpdir/pr18808a.o tmpdir/libpr18808.so" \
97dc35c8 660 "" \
205ac185 661 { dummy.c } \
97dc35c8
L
662 "pr18808" \
663 "pr18808.out" \
664 ] \
d6f48aed
L
665 [list \
666 "Run pr18808 (-z now)" \
667 "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr18808a.o tmpdir/libpr18808n.so" \
668 "" \
669 { dummy.c } \
670 "pr18808n" \
671 "pr18808.out" \
672 ] \
cae1fbbb 673 [list \
4e1626f5 674 "Run pr18841 with libpr18841b.so" \
d9816402 675 "-Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841b.so" \
4e1626f5 676 "" \
205ac185 677 { dummy.c } \
4e1626f5
L
678 "pr18841b" \
679 "pr18841.out" \
680 ] \
681 [list \
682 "Run pr18841 with libpr18841c.so" \
d9816402 683 "-Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841c.so" \
cae1fbbb 684 "" \
205ac185 685 { dummy.c } \
4e1626f5 686 "pr18841c" \
cae1fbbb
L
687 "pr18841.out" \
688 ] \
d6f48aed
L
689 [list \
690 "Run pr18841 with libpr18841bn.so (-z now)" \
691 "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841bn.so" \
692 "" \
693 { dummy.c } \
694 "pr18841bn" \
695 "pr18841.out" \
696 ] \
697 [list \
698 "Run pr18841 with libpr18841cn.so (-z now)" \
699 "-Wl,-z,now -Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841cn.so" \
700 "" \
701 { dummy.c } \
702 "pr18841cn" \
703 "pr18841.out" \
704 ] \
4ec09950
L
705 [list \
706 "Run pr23169a" \
707 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libpr23169a.so" \
708 "" \
709 { pr23169b.c pr23169c.c } \
710 "pr23169a" \
711 "pass.out" \
712 "$NOPIE_CFLAGS -O2 -g" \
713 ] \
714 [list \
715 "Run pr23169b" \
716 "-pie -Wl,--no-as-needed tmpdir/libpr23169a.so" \
717 "" \
718 { pr23169b.c pr23169c.c } \
719 "pr23169b" \
720 "pass.out" \
721 "-fPIE -O2 -g" \
722 ] \
723 [list \
724 "Run pr23169c" \
725 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libpr23169a.so" \
726 "" \
727 { pr23169b.c pr23169c.c } \
728 "pr23169c" \
729 "pass.out" \
730 "-fPIE -O2 -g" \
731 ] \
732 [list \
733 "Run pr23169d" \
734 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
735 "" \
736 { pr23169b.c pr23169c.c } \
737 "pr23169d" \
738 "pass.out" \
739 "$NOPIE_CFLAGS -O2 -g" \
740 ] \
741 [list \
742 "Run pr23169e" \
743 "-pie -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
744 "" \
745 { pr23169b.c pr23169c.c } \
746 "pr23169e" \
747 "pass.out" \
748 "-fPIE -O2 -g" \
749 ] \
750 [list \
751 "Run pr23169f" \
752 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
753 "" \
754 { pr23169b.c pr23169c.c } \
755 "pr23169f" \
756 "pass.out" \
757 "-fPIE -O2 -g" \
758 ] \
97dc35c8 759]
This page took 0.491976 seconds and 4 git commands to generate.