]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-elfvers/vers.exp
*** empty log message ***
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-elfvers / vers.exp
CommitLineData
252b5132 1# Expect script for ld-version tests
a2b64bed 2# Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
252b5132
RH
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17#
18# Written by Eric Youngdale (eric@andante.jic.com)
19
20#
21
22# This test can only be run if ld generates native executables.
23if ![isnative] then {return}
24
25# This test can only be run on a couple of ELF platforms.
26# Square bracket expressions seem to confuse istarget.
27# This is similar to the test that is used in ld-shared, BTW.
28if { ![istarget i?86-*-sysv4*] \
29 && ![istarget i?86-*-unixware] \
30 && ![istarget i?86-*-elf*] \
31 && ![istarget i?86-*-linux*] \
ad995491
L
32 && ![istarget ia64-*-elf*] \
33 && ![istarget ia64-*-linux*] \
252b5132
RH
34 && ![istarget m68k-*-linux*] \
35 && ![istarget mips*-*-irix5*] \
36 && ![istarget powerpc-*-elf*] \
37 && ![istarget powerpc-*-linux*] \
38 && ![istarget powerpc-*-sysv4*] \
39 && ![istarget sparc*-*-elf] \
b33b6e45
ILT
40 && ![istarget sparc*-*-solaris2*] \
41 && ![istarget sparc*-*-linux*] \
4f38fc1c 42 && ![istarget arm*-*-linux*] \
66517a2f 43 && ![istarget mips*-*-linux*] \
252b5132
RH
44 && ![istarget alpha*-*-linux*] } {
45 return
46}
47
c709b096
AM
48if { [istarget i?86-*-linux*aout*] \
49 || [istarget i?86-*-linux*oldld*] \
50 || [istarget m68k-*-linux*aout*] } {
252b5132
RH
51 return
52}
53
54if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
55 return
56}
57
58set diff diff
59set tmpdir tmpdir
60set VOBJDUMP_FLAGS --private-headers
61set DOBJDUMP_FLAGS --dynamic-syms
62set SOBJDUMP_FLAGS --syms
63set shared --shared
64set script --version-script
65
66proc test_ar { test lib object expect } {
67 global ar
68 global nm
69 global tmpdir
70 global srcdir
71 global subdir
72 global diff
73
74 verbose -log "$ar -cr $tmpdir/$lib $tmpdir/$object"
75 catch "exec $ar -cr $tmpdir/$lib $tmpdir/$object" exec_output
76 set exec_output [prune_warnings $exec_output]
77 if ![string match "" $exec_output] {
78 verbose -log "$exec_output"
79 unresolved "$test"
80 return
81 }
82
83 verbose -log "$nm --print-armap $tmpdir/$lib | grep \" in \" | egrep \"VERS\\|bar\\|foo\" | sort > $tmpdir/nm.out"
84
85 catch "exec $nm --print-armap $tmpdir/$lib | grep \\\ in\\\ | egrep VERS\\\|bar\\\|foo | sort > $tmpdir/nm.out" exec_output
86 if [string match "" $exec_output] then {
3b0f0b37 87 catch "exec $diff $tmpdir/nm.out $srcdir/$subdir/$expect" exec_output
252b5132
RH
88 set exec_output [prune_warnings $exec_output]
89 if [string match "" $exec_output] then {
90 pass $test
91 return
92 } else {
93 verbose -log "$exec_output"
94 fail "$test"
95 return
96 }
97 } else {
98 verbose -log "$exec_output"
99 fail "$test"
100 }
101}
102
103#
104# objdump_emptysymstuff
105# Check non-dynamic symbols and make sure there are none with '@'.
106#
107proc objdump_emptysymstuff { objdump object } {
108 global SOBJDUMP_FLAGS
109 global version_output
110 global diff
111
112 if ![info exists SOBJDUMP_FLAGS] { set SOBJDUMP_FLAGS "" }
113
114 verbose -log "$objdump $SOBJDUMP_FLAGS $object | sed -n /\@/p"
115
116 catch "exec $objdump $SOBJDUMP_FLAGS $object | sed -n /\@/p" exec_output
117 set exec_output [prune_warnings $exec_output]
118 if [string match "" $exec_output] then {
119# We shouldn't get anything here.
120 return 1
121 } else {
122# it is not normal to come here - we have no output to compare.
123 verbose -log "$exec_output"
124 verbose -log "objdump_emptysymstuff: did not expect any output from objdump"
125 return 0
126 }
127
128}
129
130#
131# objdump_emptydynsymstuff
132# Check dynamic symbols and make sure there are none with '@'.
133#
134proc objdump_emptydynsymstuff { objdump object } {
135 global DOBJDUMP_FLAGS
136 global version_output
137 global diff
138
139 if ![info exists VOBJDUMP_FLAGS] { set VOBJDUMP_FLAGS "" }
140
141 verbose -log "$objdump $DOBJDUMP_FLAGS $object | sed -n /VERS/p\\\;/show/p"
142
143 catch "exec $objdump $DOBJDUMP_FLAGS $object | sed -n /VERS/p\\\;/show/p" exec_output
144 set exec_output [prune_warnings $exec_output]
145 if [string match "" $exec_output] then {
146# We shouldn't get anything here.
147 return 1
148 } else { if [string match "*objdump: *: not a dynamic object" $exec_output] then {
149 return 1
150 } else {
151# it is not normal to come here - we have no output to compare.
152 verbose -log "$exec_output"
153 verbose -log "objdump_emptydynsymstuff: did not expect any output from objdump"
154 return 0
155 } }
156}
157
158#
159# objdump_emptyverstuff
160# Make sure there is no version information
161#
162proc objdump_emptyverstuff { objdump object } {
163 global VOBJDUMP_FLAGS
164 global version_output
165 global diff
166 global tmpdir
167
168 if {[which $objdump] == 0} then {
169 perror "$objdump does not exist"
170 return 0
171 }
172
173 if ![info exists VOBJDUMP_FLAGS] { set VOBJDUMP_FLAGS "" }
174
175 verbose -log "$objdump $VOBJDUMP_FLAGS $object | sed -n /Version/,\\\$p > $tmpdir/objdump.out"
176
177 catch "exec $objdump $VOBJDUMP_FLAGS $object | sed -n /Version/,\\\$p" exec_output
178 set exec_output [prune_warnings $exec_output]
179 if [string match "" $exec_output] then {
180# it is normal to fail here - we have no output to compare.
181 return 1
182 } else { if { [string match "*libc*" $exec_output] } then {
183# this probably means that there is version information in libc, so we
184# can't really perform this test.
185 return 1
186 } else {
187 verbose -log "$exec_output"
188 verbose -log "objdump_emptyverstuff: did not expect any output from objdump"
189 return 0
190 } }
191
192}
193
194#
195# objdump_symstuff
196# Dump non-dynamic symbol stuff and make sure that it is sane.
197#
198proc objdump_symstuff { objdump object expectfile } {
199 global SOBJDUMP_FLAGS
200 global version_output
201 global diff
202 global tmpdir
203
204 if ![info exists SOBJDUMP_FLAGS] { set SOBJDUMP_FLAGS "" }
205
206 verbose -log "$objdump $SOBJDUMP_FLAGS $object | grep \@ | sort > $tmpdir/objdump.out"
207
208 catch "exec $objdump $SOBJDUMP_FLAGS $object | grep \@ | sort > $tmpdir/objdump.out" exec_output
209 set exec_output [prune_warnings $exec_output]
210 if [string match "" $exec_output] then {
211
212# Now do a line-by-line comparison to effectively diff the darned things
213# The stuff coming from the expectfile is actually a regex, so we can
214# skip over the actual addresses and so forth. This is currently very
215# simpleminded - it expects a one-to-one correspondence in terms of line
216# numbers.
217
218 if [file exists $expectfile] then {
219 set file_a [open $expectfile r]
220 } else {
221 perror "$expectfile doesn't exist"
222 return 0
223 }
224
225 if [file exists $tmpdir/objdump.out] then {
226 set file_b [open $tmpdir/objdump.out r]
227 } else {
228 perror "$tmpdir/objdump.out doesn't exist"
229 return 0
230 }
231
232 verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2
233
234 set eof -1
235 set differences 0
236
237 while { [gets $file_a line] != $eof } {
238 if [regexp "^#.*$" $line] then {
239 continue
240 } else {
241 lappend list_a $line
242 }
243 }
244 close $file_a
245
246 while { [gets $file_b line] != $eof } {
247 if [regexp "^#.*$" $line] then {
248 continue
249 } else {
250 lappend list_b $line
251 }
252 }
253 close $file_b
254
255 for { set i 0 } { $i < [llength $list_a] } { incr i } {
256 set line_a [lindex $list_a $i]
257 set line_b [lindex $list_b $i]
258
259
260 verbose "\t$expectfile: $i: $line_a" 3
261 verbose "\t/tmp/objdump.out: $i: $line_b" 3
262 if [regexp $line_a $line_b] then {
263 continue
264 } else {
265 verbose -log "\t$expectfile: $i: $line_a"
266 verbose -log "\t$tmpdir/objdump.out: $i: $line_b"
267
268 return 0
269 }
270 }
271
272 if { [llength $list_a] != [llength $list_b] } {
273 verbose -log "Line count"
274 return 0
275 }
276
277 if $differences<1 then {
278 return 1
279 }
280
281 return 0
282 } else {
283 verbose -log "$exec_output"
284 return 0
285 }
286
287}
288
289#
290# objdump_dymsymstuff
291# Dump dynamic symbol stuff and make sure that it is sane.
292#
293proc objdump_dynsymstuff { objdump object expectfile } {
294 global DOBJDUMP_FLAGS
295 global version_output
296 global diff
297 global tmpdir
298
299 if ![info exists DOBJDUMP_FLAGS] { set DOBJDUMP_FLAGS "" }
300
301 verbose -log "$objdump $DOBJDUMP_FLAGS $object | sed -n /VERS/p\\\;/show/p | sort | uniq > $tmpdir/objdump.out"
302
303 catch "exec $objdump $DOBJDUMP_FLAGS $object | sed -n /VERS/p\\\;/show/p | sort | uniq > $tmpdir/objdump.out" exec_output
304 set exec_output [prune_warnings $exec_output]
305 if [string match "" $exec_output] then {
306
307# Now do a line-by-line comparison to effectively diff the darned things
308# The stuff coming from the expectfile is actually a regex, so we can
309# skip over the actual addresses and so forth. This is currently very
310# simpleminded - it expects a one-to-one correspondence in terms of line
311# numbers.
312
313 if [file exists $expectfile] then {
314 set file_a [open $expectfile r]
315 } else {
316 warning "$expectfile doesn't exist"
317 return 0
318 }
319
320 if [file exists $tmpdir/objdump.out] then {
321 set file_b [open $tmpdir/objdump.out r]
322 } else {
323 fail "$tmpdir/objdump.out doesn't exist"
324 return 0
325 }
326
327 verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2
328
329 set eof -1
330 set differences 0
331
332 while { [gets $file_a line] != $eof } {
333 if [regexp "^#.*$" $line] then {
334 continue
335 } else {
336 lappend list_a $line
337 }
338 }
339 close $file_a
340
341 while { [gets $file_b line] != $eof } {
342 if [regexp "^#.*$" $line] then {
343 continue
344 } else {
345 lappend list_b $line
346 }
347 }
348 close $file_b
349
350 for { set i 0 } { $i < [llength $list_b] } { incr i } {
351 set line_b [lindex $list_b $i]
352
353# The tests are rigged so that we should never export a symbol with the
354# word 'hide' in it. Thus we just search for it, and bail if we find it.
355 if [regexp "hide" $line_b] then {
356 verbose -log "\t$tmpdir/objdump.out: $i: $line_b"
357
358 return 0
359 }
360
361 verbose "\t$expectfile: $i: $line_b" 3
362
363 # We can't assume that the sort is consistent across
364 # systems, so we must check each regexp. When we find a
365 # regexp, we null it out, so we don't match it twice.
366 for { set j 0 } { $j < [llength $list_a] } { incr j } {
367 set line_a [lindex $list_a $j]
368
369 if [regexp $line_a $line_b] then {
370 lreplace $list_a $j $j "CAN NOT MATCH"
371 break
372 }
373 }
374
375 if { $j >= [llength $list_a] } {
376 verbose -log "\t$tmpdir/objdump.out: $i: $line_b"
377
378 return 0
379 }
380 }
381
382 if { [llength $list_a] != [llength $list_b] } {
383 verbose -log "Line count"
384 return 0
385 }
386
387 if $differences<1 then {
388 return 1
389 }
390
391 return 0
392 } else {
393 verbose -log "$exec_output"
394 return 0
395 }
396
397}
398
399#
400# objdump_versionstuff
401# Dump version definitions/references and make sure that it is sane.
402#
403proc objdump_versionstuff { objdump object expectfile } {
404 global VOBJDUMP_FLAGS
405 global version_output
406 global diff
407 global tmpdir
408
409 if {[which $objdump] == 0} then {
410 perror "$objdump does not exist"
411 return 0
412 }
413
414 if ![info exists VOBJDUMP_FLAGS] { set VOBJDUMP_FLAGS "" }
415
416 verbose -log "$objdump $VOBJDUMP_FLAGS $object | sed -n /Version/,\\\$p > $tmpdir/objdump.out"
417
418 catch "exec $objdump $VOBJDUMP_FLAGS $object | sed -n /Version/,\\\$p > $tmpdir/objdump.out" exec_output
419 set exec_output [prune_warnings $exec_output]
420 if [string match "" $exec_output] then {
421
422 # It's OK if there are extra lines in the actual output; they
423 # may come from version information in libc. We require that
424 # every line in EXPECTFILE appear in the output in order.
425
426 set f1 [open $tmpdir/objdump.out r]
427 set f2 [open $expectfile r]
428 gets $f2 l2
429 while { [gets $f1 l1] != -1 } {
430 if { [string match $l2 $l1] } then {
431 if { [gets $f2 l2] == -1 } then {
432 close $f1
433 close $f2
434 return 1
435 }
436 }
437 }
438
439 # We reached the end of the output without seeing the line we
440 # expected. This is a test failure.
441
442 close $f1
443 close $f2
444
445 verbose -log "Did not find \"$l2\""
446 set f1 [open $tmpdir/objdump.out r]
447 while { [gets $f1 l1] != -1 } {
448 verbose -log $l1
449 }
450
451 verbose -log "$exec_output"
452 return 0
453 } else {
454 verbose -log "$exec_output"
455 return 0
456 }
457}
458
459proc build_vers_lib { test source libname other mapfile verexp versymexp symexp } {
460 global ld
461 global srcdir
462 global subdir
463 global exec_output
464 global host_triplet
465 global tmpdir
466 global as
467 global objdump
468 global CC
469 global CFLAGS
470 global shared
471 global script
472
473 if ![ld_compile "$CC -S $CFLAGS" $srcdir/$subdir/$source $tmpdir/$libname.s] {
474 unresolved "$test"
475 return
476 }
477
478 if ![ld_assemble $as $tmpdir/$libname.s $tmpdir/$libname.o ] {
479 unresolved "$test"
480 return
481 }
482
67954772
L
483 set other_lib ""
484 if ![string match "" $other] then {
485 foreach o $other {
82e03011 486 set other_lib "$other_lib $tmpdir/$o"
67954772 487 }
252b5132
RH
488 }
489
490 if [string match "" $mapfile] then {
491 set script_arg ""
492 } else {
493 set script_arg "$script $srcdir/$subdir/$mapfile"
494 }
495
496 if {![ld_simple_link $ld $tmpdir/$libname.so "$shared $tmpdir/$libname.o $other_lib $script_arg"]} {
497 fail "$test"
498 return
499 }
500
501 if {![objdump_versionstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$verexp ]} {
502 fail "$test"
503 return
504 }
505
506 if {![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$versymexp ]} {
507 fail "$test"
508 return
509 }
510
511 if [string match "" $symexp] then {
512 if {![objdump_emptysymstuff $objdump $tmpdir/$libname.o ]} {
513 fail "$test"
514 return
515 }
516 } else {
517 if {![objdump_symstuff $objdump $tmpdir/$libname.o $srcdir/$subdir/$symexp ]} {
518 fail "$test"
519 return
520 }
521 }
522
523 pass $test
524
525}
526
527proc test_ldfail { test flag source execname other mapfile whyfail } {
528 global ld
529 global srcdir
530 global subdir
531 global exec_output
532 global host_triplet
533 global tmpdir
534 global as
535 global objdump
536 global CC
537 global CFLAGS
538 global script
539
540 if [string match "" $other] then {
541 set other_lib ""
542 } else {
543 set other_lib $tmpdir/$other
544 }
545
546 if ![ld_compile "$CC -S $flag $CFLAGS" $srcdir/$subdir/$source $tmpdir/$execname.s] {
547 unresolved "$test"
548 return
549 }
550
551 if ![ld_assemble $as $tmpdir/$execname.s $tmpdir/$execname.o ] {
552 unresolved "$test"
553 return
554 }
555
556 verbose -log "This link should fail because of $whyfail"
557
558 if [string match "" $mapfile] then {
559 set script_arg ""
560 } else {
561 set script_arg "$script $srcdir/$subdir/$mapfile"
562 }
563
564 if {![ld_link $ld $tmpdir/$execname "$tmpdir/$execname.o $other_lib $script_arg"]} {
565 pass "$test"
566 return
567 }
568 fail "$test"
569}
570
571proc test_asfail { test flag source execname whyfail } {
572 global srcdir
573 global subdir
574 global tmpdir
575 global as
576 global CC
577 global CFLAGS
578
579 if ![ld_compile "$CC -S $flag $CFLAGS" $srcdir/$subdir/$source $tmpdir/$execname.s] {
580 unresolved "$test"
581 return
582 }
583
584 verbose -log "This assemble should fail because of $whyfail"
585 catch "exec $as -o $tmpdir/$execname.o $tmpdir/$execname.s" exec_output
586 set exec_output [prune_warnings $exec_output]
587 if [string match "" $exec_output] then {
588 fail "$test"
589 return
590 }
591 verbose -log "$exec_output"
592 pass "$test"
593}
594
595proc test_strip_vers_lib { test srclib libname verexp versymexp } {
596 global strip
597 global srcdir
598 global subdir
599 global exec_output
600 global host_triplet
601 global tmpdir
602 global objdump
603
604 verbose -log "cp $tmpdir/$srclib $tmpdir/$libname.so"
605 exec cp $tmpdir/$srclib $tmpdir/$libname.so
606
607 verbose -log "$strip $tmpdir/$libname.so"
608 catch "exec $strip $tmpdir/$libname.so" exec_output
609 if [string match "" $exec_output] then {
610
611# If strip went OK, then run the usual tests on the thing to make sure that
612# it is sane.
613 if {![objdump_versionstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$verexp ]} {
614 fail "$test"
615 return
616 }
617
618 if {![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$versymexp ]} {
619 fail "$test"
620 return
621 }
622
623 } else {
624 verbose -log "$exec_output"
625 fail "$test"
626 return
627 }
628 pass $test
629}
630
631
632proc build_exec { test source execname flags solibname verexp versymexp symexp } {
633 global ld
634 global srcdir
635 global subdir
636 global exec_output
637 global host_triplet
638 global tmpdir
639 global as
640 global objdump
641 global CC
642 global CFLAGS
643
644 set shared --shared
645 set script --version-script
646 if ![ld_compile "$CC -S $CFLAGS" $srcdir/$subdir/$source $tmpdir/$execname.s] {
647 unresolved "$test"
648 return
649 }
650
651 if ![ld_assemble $as $tmpdir/$execname.s $tmpdir/$execname.o ] {
652 unresolved "$test"
653 return
654 }
655
656 if [string match "" $solibname] then {
657 set solibname_lib ""
658 } else {
659 set solibname_lib $tmpdir/$solibname
660 }
661
662 if {![ld_link $ld $tmpdir/$execname "$flags $tmpdir/$execname.o $solibname_lib"]} {
663 fail "$test"
664 return
665 }
666
667 if [string match "" $verexp] then {
668#
669# Make sure we get nothing back.
670#
671 if {![objdump_emptyverstuff $objdump $tmpdir/$execname ]} {
672 fail "$test"
673 return
674 }
675 } else {
676 if {![objdump_versionstuff $objdump $tmpdir/$execname $srcdir/$subdir/$verexp ]} {
677 fail "$test"
678 return
679 }
680 }
681
682 if [string match "" $versymexp] then {
683 if {![objdump_emptydynsymstuff $objdump $tmpdir/$execname ]} {
684 fail "$test"
685 return
686 }
687 } else {
688 if {![objdump_dynsymstuff $objdump $tmpdir/$execname $srcdir/$subdir/$versymexp ]} {
689 fail "$test"
690 return
691 }
692 }
693
694 if [string match "" $symexp] then {
695 if {![objdump_emptysymstuff $objdump $tmpdir/$execname.o ]} {
696 fail "$test"
697 return
698 }
699 } else {
700 if {![objdump_symstuff $objdump $tmpdir/$execname.o $srcdir/$subdir/$symexp ]} {
701 fail "$test"
702 return
703 }
704 }
705
706 pass $test
707}
708
709
710#
711# Basic test - build a library with versioned symbols.
712#
713build_vers_lib "vers1" vers1.c vers1 "" vers1.map vers1.ver vers1.dsym vers1.sym
714
715
716#
717# Test #2 - build a library, and link it against the library we built in step
718# 1.
719#
720build_vers_lib "vers2" vers2.c vers2 vers1.so vers2.map vers2.ver vers2.dsym ""
721
722#
723# Test #3 - build an executable, and link it against vers1.so.
724#
725build_exec "vers3" vers3.c vers3 "" vers1.so vers3.ver vers3.dsym ""
726
727#
728# Test #4 - Make sure a version implicitly defined in an executable
729# causes a version node to be created. Verify this both with and without
730# --export-dynamic.
731#
732
733# This test fails on MIPS. On the MIPS we must put foo in the dynamic
734# symbol table, which the test does not expect.
735setup_xfail "mips*-*-*"
736build_exec "vers4" vers4.c vers4 "" "" "" "" vers4.sym
737
738build_exec "vers4a" vers4.c vers4a "-export-dynamic" "" vers4a.ver vers4a.dsym vers4a.sym
739
740
741#
742# Try multiple definitions foo@BAR and foo@@BAR and make sure the linker
743# complains.
744#
745test_ldfail "vers5" "" vers5.c vers5 "" "" "multiple definition of foo@VERS_1.2"
746
747#
748#
749# Now build a test that should reference a bunch of versioned symbols.
750# All of them should be correctly referenced.
751#
752build_exec "vers6" vers6.c vers6 "" vers1.so vers6.ver vers6.dsym vers6.sym
753
754#
755# Another test to verify that something made local via 'local' is truly not
756# accessible.
757#
758build_vers_lib "vers7a" vers7a.c vers7a "" vers7.map vers7a.ver vers7a.dsym vers7a.sym
759
760test_ldfail "vers7" "" vers7.c vers7 vers7a.so "" "undefined reference to hide_a"
761
762
763#
764# This test is designed to verify that we can pass a linker script on the
765# command line as if it were a normal .o file.
766#
767catch "exec cp $srcdir/$subdir/vers8.map $tmpdir/" ignore_output
768build_vers_lib "vers8" vers1.c vers8 vers8.map "" vers8.ver vers1.dsym vers1.sym
769
770#
771# This test tries to make sure that version references to versioned symbols
772# don't collide with default definitions with the same symbol.
773#
774build_exec "vers9" vers9.c vers9 "-export-dynamic" "" vers9.ver vers9.dsym vers9.sym
775
776
777#
778# Try and use a non-existant version node. The linker should fail with
779# an error message.
780#
781test_ldfail "vers10" "-DDO_TEST10" vers1.c vers10 "" "vers1.map --shared" "invalid version"
782
783#
784# Try and some things the assembler should complain about.
785#
786test_asfail "vers11" "-DDO_TEST11" vers1.c vers11 "no @ in symver"
787
788test_asfail "vers12" "-DDO_TEST12" vers1.c vers12 "extern version definition"
789
790#
791# Put a shared library in an archive library, and make sure the global
792# archive symbol table is sane.
793#
794test_ar "ar with versioned solib" vers13.a vers1.so vers13.asym
795
796#
797# Strip a shared library, and make sure we didn't screw something up in there.
798#
799test_strip_vers_lib "vers14" vers1.so vers14 vers1.ver vers1.dsym
800
801
802#
803# Build another test with some versioned symbols. Here we are going to
804# try and override something from the library, and we shouldn't get
805# any errors.
806#
807build_exec "vers15" vers15.c vers15 "" vers1.so vers15.ver vers15.dsym vers15.sym
808
809#
810# Test that when we override a versioned symbol from the library this
811# symbol appears in the dynamic symbol table of the executable.
812#
813build_vers_lib "vers16a" vers16a.c vers16a "" vers16.map vers16a.ver vers16a.dsym ""
814build_exec "vers16" vers16.c vers16 "" vers16a.so "" vers16.dsym ""
f0489494
ILT
815
816# Test a weak versioned symbol.
817build_vers_lib "vers17" vers17.c vers17 "" vers17.map vers17.ver vers17.dsym ""
818build_vers_lib "vers18" vers18.c vers18 vers17.so vers18.map vers18.ver vers18.dsym vers18.sym
9d8b3bf4 819build_exec "vers19" vers19.c vers19 "-rpath ." vers18.so vers19.ver vers19.dsym ""
67954772
L
820
821build_vers_lib "vers20a" vers20.c vers20a "" vers20.map vers20a.ver vers20.dsym ""
822exec cp $tmpdir/vers20a.so $tmpdir/vers20b.so
823build_vers_lib "vers20" vers20.c vers20 "vers20a.so vers20b.so" vers20.map vers20.ver vers20.dsym ""