1 # Expect script for LD selective linking tests
2 # Copyright (C) 1998 Free Software Foundation
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Written by Catherine Moore (clm@cygnus.com)
19 # Make sure that constructors are handled correctly.
22 set test1 "selective1"
23 set test2 "selective2"
24 set test3 "selective3"
25 set test4 "selective4"
26 set test5 "selective5"
27 set test6 "selective6"
29 set cflags "-w -O2 -ffunction-sections -fdata-sections"
30 set cxxflags "-fvtable-gc -fno-exceptions -fno-rtti"
31 set ldflags "--gc-sections -Bstatic"
33 if { [which $CXX] == 0 } {
43 if { ![ld_compile "$CC $cflags" $srcdir/$subdir/1.c tmpdir/1.o]} {
48 if ![ld_simple_link $ld tmpdir/1.x "$ldflags tmpdir/1.o"] {
51 if ![ld_nm $nm tmpdir/1.x] {
54 if {[info exists nm_output(dropme1)]} {
55 send_log "dropme1 == $nm_output(dropme1)\n"
56 verbose "dropme1 == $nm_output(dropme1)"
59 if {[info exists nm_output(dropme2)]} {
60 send_log "dropme2 == $nm_output(dropme2)\n"
61 verbose "dropme2 == $nm_output(dropme2)"
70 if { ![ld_compile "$CC $cflags" $srcdir/$subdir/2.c tmpdir/2.o]} {
75 if ![ld_simple_link $ld tmpdir/2.x "$ldflags tmpdir/2.o"] {
78 if ![ld_nm $nm tmpdir/2.x] {
81 if {[info exists nm_output(foo)] } {
82 send_log "foo == $nm_output(foo)\n"
83 verbose "foo== $nm_output(foo)"
91 if { ![ld_compile "$CC $cflags" $srcdir/$subdir/2.c tmpdir/2.o]} {
96 if ![ld_simple_link $ld tmpdir/2.x "$ldflags -u foo tmpdir/2.o"] {
99 if ![ld_nm $nm tmpdir/2.x] {
102 if {![info exists nm_output(foo)] } {
103 send_log "bad output from nm\n"
104 verbose "bad output from nm"
107 if {$nm_output(foo) == 0} {
108 send_log "foo == $nm_output(foo)\n"
109 verbose "foo== $nm_output(foo)"
119 setup_xfail "v850*-*-elf"
121 if { ![ld_compile "$CC $cflags $cxxflags" $srcdir/$subdir/3.cc tmpdir/3.o]} {
126 setup_xfail "v850*-*-elf"
128 if { ![ld_compile "$CC $cflags $cxxflags" $srcdir/$subdir/4.cc tmpdir/4.o]} {
133 if ![ld_simple_link $ld tmpdir/3.x "$ldflags tmpdir/3.o"] {
136 if ![ld_nm $nm tmpdir/3.x] {
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)"
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)"
156 if ![ld_simple_link $ld tmpdir/4.x "$ldflags tmpdir/4.o"] {
159 if ![ld_nm $nm tmpdir/4.x] {
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)"
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)"
178 setup_xfail "v850*-*-elf"
180 if { ![ld_compile "$CC $cflags $cxxflags" $srcdir/$subdir/5.cc tmpdir/5.o]} {
185 if ![ld_simple_link $ld tmpdir/5.x "$ldflags tmpdir/5.o"] {
188 if ![ld_nm $nm tmpdir/5.x] {
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)"
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)"