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