]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-selective/selective.exp
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-selective / selective.exp
CommitLineData
f4355fa5
CM
1# Expect script for LD selective linking tests
2# Copyright (C) 1998 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 Catherine Moore (clm@cygnus.com)
19# Make sure that constructors are handled correctly.
20
21
22set test1 "selective1"
23set test2 "selective2"
24set test3 "selective3"
25set test4 "selective4"
26set test5 "selective5"
27set test6 "selective6"
28
29set cflags "-w -O2 -ffunction-sections -fdata-sections"
30set cxxflags "-fvtable-gc -fno-exceptions -fno-rtti"
31set ldflags "--gc-sections -Bstatic"
32
33if { [which $CXX] == 0 } {
34 untested $test1
35 untested $test2
36 untested $test3
37 untested $test4
38 untested $test5
39 untested $test6
40 return
41}
42
43if { ![ld_compile "$CC $cflags" $srcdir/$subdir/1.c tmpdir/1.o]} {
44 unresolved $test1
45 return
46}
47
48if ![ld_simple_link $ld tmpdir/1.x "$ldflags tmpdir/1.o"] {
49 fail $test1
50} else {
51 if ![ld_nm $nm tmpdir/1.x] {
52 unresolved $test1
53 } else {
54 if {[info exists nm_output(dropme1)]} {
55 send_log "dropme1 == $nm_output(dropme1)\n"
56 verbose "dropme1 == $nm_output(dropme1)"
57 fail $test1
58 } else {
59 if {[info exists nm_output(dropme2)]} {
60 send_log "dropme2 == $nm_output(dropme2)\n"
61 verbose "dropme2 == $nm_output(dropme2)"
62 fail $test1
63 } else {
64 pass $test1
65 }
66 }
67 }
68 }
69
70if { ![ld_compile "$CC $cflags" $srcdir/$subdir/2.c tmpdir/2.o]} {
71 unresolved $test2
72 return
73}
74
75if ![ld_simple_link $ld tmpdir/2.x "$ldflags tmpdir/2.o"] {
76 fail $test2
77} else {
78 if ![ld_nm $nm tmpdir/2.x] {
79 unresolved $test2
80 } else {
81 if {[info exists nm_output(foo)] } {
82 send_log "foo == $nm_output(foo)\n"
83 verbose "foo== $nm_output(foo)"
84 fail $test2
85 } else {
86 pass $test2
87 }
88 }
89 }
90
91if { ![ld_compile "$CC $cflags" $srcdir/$subdir/2.c tmpdir/2.o]} {
92 unresolved $test3
93 return
94}
95
96if ![ld_simple_link $ld tmpdir/2.x "$ldflags -u foo tmpdir/2.o"] {
97 fail $test3
98} else {
99 if ![ld_nm $nm tmpdir/2.x] {
100 unresolved $test3
101 } else {
102 if {![info exists nm_output(foo)] } {
103 send_log "bad output from nm\n"
104 verbose "bad output from nm"
105 fail $test3
106 } else {
107 if {$nm_output(foo) == 0} {
108 send_log "foo == $nm_output(foo)\n"
109 verbose "foo== $nm_output(foo)"
110 fail $test3
111 } else {
112 pass $test3
113 }
114 }
115 }
116}
117
118
119setup_xfail "v850*-*-elf"
120
121if { ![ld_compile "$CC $cflags $cxxflags" $srcdir/$subdir/3.cc tmpdir/3.o]} {
122 unresolved $test4
123 return
124}
125
126setup_xfail "v850*-*-elf"
127
128if { ![ld_compile "$CC $cflags $cxxflags" $srcdir/$subdir/4.cc tmpdir/4.o]} {
129 unresolved $test5
130 return
131}
132
133if ![ld_simple_link $ld tmpdir/3.x "$ldflags tmpdir/3.o"] {
134 fail $test4
135} else {
136 if ![ld_nm $nm tmpdir/3.x] {
137 unresolved $test4
138 } else {
139 if {[info exists nm_output(foo__1B)]} {
140 send_log "foo__1B == $nm_output(foo__1B)\n"
141 verbose "foo__1B == $nm_output(foo__1B)"
142 fail $test4
143 } else {
144 if {[ info exists nm_output(bar__1A)]} {
145 send_log "bar__1A== $nm_output(_bar__1A)\n"
146 verbose "bar__1A == $nm_output(_bar__1A)"
147 fail $test4
148 } else {
149 pass $test4
150 }
151 }
152 }
153}
154
155
156if ![ld_simple_link $ld tmpdir/4.x "$ldflags tmpdir/4.o"] {
157 fail $test5
158} else {
159 if ![ld_nm $nm tmpdir/4.x] {
160 unresolved $test5
161 } else {
162 if {[info exists nm_output(foo__1B)]} {
163 send_log "foo__1B == $nm_output(foo__1B)\n"
164 verbose "foo__1B == $nm_output(foo__1B)"
165 fail $test5
166 } else {
167 if {[info exists nm_output(foo__1A)]} {
168 send_log "foo__1A== $nm_output(foo__1A)\n"
169 verbose "foo__1A == $nm_output(foo__1A)"
170 fail $test5
171 } else {
172 pass $test5
173 }
174 }
175 }
176}
177
178setup_xfail "v850*-*-elf"
179
180if { ![ld_compile "$CC $cflags $cxxflags" $srcdir/$subdir/5.cc tmpdir/5.o]} {
181 unresolved $test6
182 return
183}
184
185if ![ld_simple_link $ld tmpdir/5.x "$ldflags tmpdir/5.o"] {
186 fail $test6
187} else {
188 if ![ld_nm $nm tmpdir/5.x] {
189 unresolved $test6
190 } else {
191 if {[info exists nm_output(foo__1B)] } {
192 send_log "foo__1B == $nm_output(foo__1B)\n"
193 verbose "foo__1B == $nm_output(foo__1B)"
194 fail $test6
195 } else {
196 if { [info exists nm_output(foo__1A)]} {
197 send_log "foo__1A== $nm_output(foo__1A)\n"
198 verbose "foo__1A == $nm_output(foo__1A)"
199 fail $test6
200 } else {
201 pass $test6
202 }
203 }
204 }
205}