aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/special/ecos.exp
blob: 835233f1d4b631f889b5ba11050140e0bc022de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

# Please email any bugs, comments, and/or additions to this file to:
# jlarmour@cygnus.co.uk

# This file was written by Jonathan Larmour (jlarmour@cygnus.co.uk).

# GCC testsuite that uses the `dg.exp' driver.

# Load support procs.
load_lib gcc-dg.exp

###############################
# proc gcc_target_object_format {}
###############################
# has been moved to:  gcc/testsuite/lib/file-format.exp

###############################
# proc check_weak_available { }
###############################
# has been moved to:  gcc/testsuite/lib/target-supports.exp

##########
# weak-1.c
##########

if { [ check_weak_available ] == 1 } {
    dg-init

    set lines [gcc_target_compile "$srcdir/$subdir/weak-1a.c" "weak-1a.o" object ""]
    if ![string match "" $lines] then {
        fail "weak-1a.o"
    } else {
        dg-runtest "$srcdir/$subdir/weak-1.c" "weak-1a.o" "" 
        file delete weak-1a.o
    }
    dg-finish
} elseif { [ check_weak_available ] == 0 } {
    unsupported "weak-1.c"
} else {
    unresolved "weak-1.c"
}

##########
# weak-2.c
##########

if { [ check_weak_available ] == 1 } {
    dg-init
    
    set lines [gcc_target_compile "$srcdir/$subdir/weak-2a.c" "weak-2a.o" object ""]
    if ![string match "" $lines] then {
        fail "weak-2a.o"
    } else {
        set lines [gcc_target_compile "$srcdir/$subdir/weak-2b.c" "weak-2b.o" object ""]
        if ![string match "" $lines] then {
            fail "weak-2b.o"
        } else {
            dg-runtest "$srcdir/$subdir/weak-2.c" "weak-2a.o weak-2b.o" "" 
            file delete weak-2a.o weak-2b.o
        }
    }
    dg-finish
} elseif { [ check_weak_available ] == 0 } {
    unsupported "weak-2.c"
} else {
    unresolved "weak-2.c"
}

###########
# alias-1.c
###########

dg-init
switch [check_alias_available "$srcdir/$subdir/alias-1.c"] {
    yes     { dg-runtest "$srcdir/$subdir/alias-1.c" "" "" }
    no      { unsupported "alias-1.c" }
    default { fail "alias-1.c" }
}
dg-finish

###########
# alias-2.c
###########

dg-init
switch [check_alias_available "$srcdir/$subdir/alias-2.c"] {
    yes     { dg-runtest "$srcdir/$subdir/alias-2.c" "" "" }
    no      { unsupported "alias-2.c" }
    default { fail "alias-2.c" }
}
dg-finish

###########
# wkali-1.c
###########

if { [ check_weak_available ] == 1 } {
    dg-init
    switch [check_alias_available "$srcdir/$subdir/wkali-1.c"] {
        yes     { dg-runtest "$srcdir/$subdir/wkali-1.c" "" "" }
        no      { unsupported "wkali-1.c" }
        default { fail "wkali-1.c" }
    }
    dg-finish
} elseif { [ check_weak_available ] == 0 } {
    unsupported "wkali-1.c"
} else {
    unresolved "wkali-1.c"
}

###########
# wkali-2.c
###########

if { [ check_weak_available ] == 1 } {
    dg-init
    set lines [gcc_target_compile "$srcdir/$subdir/wkali-2a.c" "wkali-2a.o" object ""]
    if ![string match "" $lines] then {
        fail "wkali-2a.o"
    } else {
        set lines [gcc_target_compile "$srcdir/$subdir/wkali-2b.c" "wkali-2b.o" object ""]
        if [string match "*only weak aliases*" $lines] then {
	    xfail "wkali-2b.o"
	    file delete $srcdir/$subdir/wkali-2.exe
        } elseif ![string match "" $lines] then {
            fail "wkali-2b.o"
        } else {
            dg-runtest "$srcdir/$subdir/wkali-2.c" "wkali-2a.o wkali-2b.o" ""
            file delete wkali-2a.o wkali-2b.o
        }
    }
    dg-finish
} elseif { [ check_weak_available ] == 0 } {
    unsupported "wkali-2.c"
} else {
    unresolved "wkali-2.c"
}

###########
# gcsec-1.c
###########

# Check if the ld used by gcc supports --gc-sections.
set gcc_ld [lindex [gcc_target_compile "-print-prog-name=ld" "" "none" ""] 0]
set ld_output [remote_exec host "$gcc_ld" "--help"]

# AIX gld supports garbage collection. But AIX gcc does not support 
# -ffunction-sections or -fdata-sections.
if { [ string first "--gc-sections" $ld_output ] >= 0 
     && ! [istarget rs6000-*-aix*]
     && ! [istarget powerpc*-*-aix*] } {

    dg-init
    if [isnative] {
	dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" ""
    } else {
	dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" ""
    }
    dg-finish
} else {
    unsupported "gcsec-1.c"
}

### EOF ecos.exp