1 # Expect script
for --exclude
-libs tests
2 # Copyright
2004 Free Software Foundation
, Inc.
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.
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.
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.
, 51 Franklin Street
- Fifth Floor
, Boston
, MA
02110-1301, USA.
18 # Make sure that
ld can
hide symbols from libraries when building a shared
21 # This test can only be run
on ELF platforms.
26 # No shared lib support
on this target.
27 if { [istarget
"mcore-*-*"] } {
37 set test1
"ld link shared library"
38 set test2
"ld export symbols from archive"
39 set test3
"ld link shared library with --exclude-libs"
40 set test4
"ld exclude symbols from archive - --exclude-libs libexclude"
41 set test5
"ld exclude symbols from archive - --exclude-libs libexclude.a"
42 set test6
"ld exclude symbols from archive - --exclude-libs ALL"
43 set test7
"ld exclude symbols from archive - --exclude-libs foo:libexclude.a"
44 set test8
"ld exclude symbols from archive - --exclude-libs foo,libexclude.a"
45 set test9
"ld don't exclude symbols from archive - --exclude-libs foo:bar"
47 if { ![ld_assemble $as $srcdir
/$subdir
/exclude1.s tmpdir
/exclude1.o
]
48 ||
![ld_assemble $as $srcdir
/$subdir
/exclude2.s tmpdir
/exclude2.o
] } {
53 catch
"exec rm -f tmpdir/libexclude.a" catch_output
54 catch
"exec $ar cq tmpdir/libexclude.a tmpdir/exclude2.o" catch_output
55 if {![string match
"" $catch_output]} {
60 # Test that the symbol is normally exported.
62 if { [ld_simple_link $
ld tmpdir
/exclude.so
"--shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } {
65 if [string match
"*shared not supported*" $link_output] {
66 unsupported
"$test1 - -shared is not supported by this target"
73 if ![ld_nm $nm
"-D" tmpdir/exclude.so] {
75 } elseif
{ [info exists nm_output
(exclude_sym
)] } {
81 # Test
--exclude
-libs libexclude
83 if { [ld_simple_link $
ld tmpdir
/exclude.so
"--exclude-libs libexclude --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } {
89 if ![ld_nm $nm
"-D" tmpdir/exclude.so] {
91 } elseif
{ ! [info exists nm_output
(exclude_sym
)] } {
97 # Test alternate spellings of
--exclude
-libs
99 if { [ld_simple_link $
ld tmpdir
/exclude.so
"--exclude-libs libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
100 && [ld_nm $nm
"-D" tmpdir/exclude.so]
101 && ! [info exists nm_output
(exclude_sym
)] } {
107 if { [ld_simple_link $
ld tmpdir
/exclude.so
"--exclude-libs ALL --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
108 && [ld_nm $nm
"-D" tmpdir/exclude.so]
109 && ! [info exists nm_output
(exclude_sym
)] } {
115 if { [ld_simple_link $
ld tmpdir
/exclude.so
"--exclude-libs foo:libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
116 && [ld_nm $nm
"-D" tmpdir/exclude.so]
117 && ! [info exists nm_output
(exclude_sym
)] } {
123 if { [ld_simple_link $
ld tmpdir
/exclude.so
"--exclude-libs foo,libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
124 && [ld_nm $nm
"-D" tmpdir/exclude.so]
125 && ! [info exists nm_output
(exclude_sym
)] } {
131 if { [ld_simple_link $
ld tmpdir
/exclude.so
"--exclude-libs foo:bar --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
132 && [ld_nm $nm
"-D" tmpdir/exclude.so]
133 && [info exists nm_output
(exclude_sym
)] } {