OSDN Git Service

Use -static when testing --gc-sections on native targets
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / special / ecos.exp
1 #   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # jlarmour@cygnus.co.uk
19
20 # This file was written by Jonathan Larmour (jlarmour@cygnus.co.uk).
21
22 # GCC testsuite that uses the `dg.exp' driver.
23
24 # Load support procs.
25 load_lib gcc-dg.exp
26
27 ###############################
28 # proc gcc_target_object_format {}
29 ###############################
30 # has been moved to:  gcc/testsuite/lib/file-format.exp
31
32 ###############################
33 # proc check_weak_available { }
34 ###############################
35 # has been moved to:  gcc/testsuite/lib/target-supports.exp
36
37 ##########
38 # weak-1.c
39 ##########
40
41 if { [ check_weak_available ] == 1 } {
42     dg-init
43
44     set lines [gcc_target_compile "$srcdir/$subdir/weak-1a.c" "weak-1a.o" object ""]
45     if ![string match "" $lines] then {
46         fail "weak-1a.o"
47     } else {
48         dg-runtest "$srcdir/$subdir/weak-1.c" "weak-1a.o" "" 
49         file delete weak-1a.o
50     }
51     dg-finish
52 } elseif { [ check_weak_available ] == 0 } {
53     unsupported "weak-1.c"
54 } else {
55     unresolved "weak-1.c"
56 }
57
58 ##########
59 # weak-2.c
60 ##########
61
62 if { [ check_weak_available ] == 1 } {
63     dg-init
64     
65     set lines [gcc_target_compile "$srcdir/$subdir/weak-2a.c" "weak-2a.o" object ""]
66     if ![string match "" $lines] then {
67         fail "weak-2a.o"
68     } else {
69         set lines [gcc_target_compile "$srcdir/$subdir/weak-2b.c" "weak-2b.o" object ""]
70         if ![string match "" $lines] then {
71             fail "weak-2b.o"
72         } else {
73             dg-runtest "$srcdir/$subdir/weak-2.c" "weak-2a.o weak-2b.o" "" 
74             file delete weak-2a.o weak-2b.o
75         }
76     }
77     dg-finish
78 } elseif { [ check_weak_available ] == 0 } {
79     unsupported "weak-2.c"
80 } else {
81     unresolved "weak-2.c"
82 }
83
84 ###########
85 # alias-1.c
86 ###########
87
88 dg-init
89 switch [check_alias_available "$srcdir/$subdir/alias-1.c"] {
90     yes     { dg-runtest "$srcdir/$subdir/alias-1.c" "" "" }
91     no      { unsupported "alias-1.c" }
92     default { fail "alias-1.c" }
93 }
94 dg-finish
95
96 ###########
97 # wkali-1.c
98 ###########
99
100 dg-init
101 switch [check_alias_available "$srcdir/$subdir/wkali-1.c"] {
102     yes     { dg-runtest "$srcdir/$subdir/wkali-1.c" "" "" }
103     no      { unsupported "wkali-1.c" }
104     default { fail "wkali-1.c" }
105 }
106 dg-finish
107
108 ###########
109 # wkali-2.c
110 ###########
111
112 if { [ check_weak_available ] == 1 } {
113     dg-init
114     set lines [gcc_target_compile "$srcdir/$subdir/wkali-2a.c" "wkali-2a.o" object ""]
115     if ![string match "" $lines] then {
116         fail "wkali-2a.o"
117     } else {
118         set lines [gcc_target_compile "$srcdir/$subdir/wkali-2b.c" "wkali-2b.o" object ""]
119         if ![string match "" $lines] then {
120             fail "wkali-2b.o"
121         } else {
122             dg-runtest "$srcdir/$subdir/wkali-2.c" "wkali-2a.o wkali-2b.o" ""
123             file delete wkali-2a.o wkali-2b.o
124         }
125     }
126     dg-finish
127 } elseif { [ check_weak_available ] == 0 } {
128     unsupported "wkali-2.c"
129 } else {
130     unresolved "wkali-2.c"
131 }
132
133 ###########
134 # gcsec-1.c
135 ###########
136
137 set ld_output [ remote_exec host "[ find_ld ]" "--help" ]
138
139 if { [ string first "--gc-sections" $ld_output ] >= 0 } {
140
141     dg-init
142     if [isnative] {
143         dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" ""
144     } else {
145         dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" ""
146     }
147     dg-finish
148 } else {
149     unsupported "gcsec-1.c"
150 }
151
152 ### EOF ecos.exp