OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-elf/] [exclude.exp] - Blame information for rev 394

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
# Expect script for --exclude-libs tests
2
#   Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
3
#
4
# This file is part of the GNU Binutils.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
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
18
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19
# MA 02110-1301, USA.
20
 
21
# Make sure that ld can hide symbols from libraries when building a shared
22
# library.
23
 
24
# This test can only be run on ELF platforms.
25
if ![is_elf_format] {
26
    return
27
}
28
 
29
# No shared lib support on this target.
30
if { [istarget "mcore-*-*"] } {
31
    return
32
}
33
 
34
global ar
35
global as
36
global ld
37
global nm
38
global nm_output
39
 
40
set test1 "ld link shared library"
41
set test2 "ld export symbols from archive"
42
set test3 "ld link shared library with --exclude-libs"
43
set test4 "ld exclude symbols from archive - --exclude-libs libexclude"
44
set test5 "ld exclude symbols from archive - --exclude-libs libexclude.a"
45
set test6 "ld exclude symbols from archive - --exclude-libs ALL"
46
set test7 "ld exclude symbols from archive - --exclude-libs foo:libexclude.a"
47
set test8 "ld exclude symbols from archive - --exclude-libs foo,libexclude.a"
48
set test9 "ld don't exclude symbols from archive - --exclude-libs foo:bar"
49
 
50
if { ![ld_assemble $as $srcdir/$subdir/exclude1.s tmpdir/exclude1.o ]
51
     || ![ld_assemble $as $srcdir/$subdir/exclude2.s tmpdir/exclude2.o] } {
52
    unresolved $test1
53
    return
54
}
55
 
56
remote_file host delete "tmpdir/libexclude.a"
57
set catch_output [run_host_cmd "$ar" "cq tmpdir/libexclude.a tmpdir/exclude2.o"]
58
if {![string match "" $catch_output]} {
59
    unresolved $test1
60
    return
61
}
62
 
63
# Test that the symbol is normally exported.
64
 
65
if { [ld_simple_link $ld tmpdir/exclude.so "--shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } {
66
    pass $test1
67
} else {
68
    if [string match "*shared not supported*" $link_output] {
69
        unsupported "$test1 - -shared is not supported by this target"
70
    } else {
71
        fail $test1
72
    }
73
    return
74
}
75
 
76
if ![ld_nm $nm "-D" tmpdir/exclude.so] {
77
    unresolved $test2
78
} elseif { [info exists nm_output(exclude_sym)] } {
79
    pass $test2
80
} else {
81
    fail $test2
82
}
83
 
84
# Test --exclude-libs libexclude
85
 
86
if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs libexclude --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } {
87
    pass $test3
88
} else {
89
    fail $test3
90
}
91
 
92
if ![ld_nm $nm "-D" tmpdir/exclude.so] {
93
    unresolved $test4
94
} elseif { ! [info exists nm_output(exclude_sym)] } {
95
    pass $test4
96
} else {
97
    fail $test4
98
}
99
 
100
# Test alternate spellings of --exclude-libs
101
 
102
if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
103
     && [ld_nm $nm "-D" tmpdir/exclude.so]
104
     && ! [info exists nm_output(exclude_sym)] } {
105
    pass $test5
106
} else {
107
    fail $test5
108
}
109
 
110
if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs ALL --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
111
     && [ld_nm $nm "-D" tmpdir/exclude.so]
112
     && ! [info exists nm_output(exclude_sym)] } {
113
    pass $test6
114
} else {
115
    fail $test6
116
}
117
 
118
if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo:libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
119
     && [ld_nm $nm "-D" tmpdir/exclude.so]
120
     && ! [info exists nm_output(exclude_sym)] } {
121
    pass $test7
122
} else {
123
    fail $test7
124
}
125
 
126
if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo,libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
127
     && [ld_nm $nm "-D" tmpdir/exclude.so]
128
     && ! [info exists nm_output(exclude_sym)] } {
129
    pass $test8
130
} else {
131
    fail $test8
132
}
133
 
134
if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo:bar --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
135
     && [ld_nm $nm "-D" tmpdir/exclude.so]
136
     && [info exists nm_output(exclude_sym)] } {
137
    pass $test9
138
} else {
139
    fail $test9
140
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.