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