1# Copyright (C) 1999, 2000, 2001 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. 25load_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 41if { [ 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 62if { [ 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 88dg-init 89switch [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} 94dg-finish 95 96########### 97# alias-2.c 98########### 99 100dg-init 101switch [check_alias_available "$srcdir/$subdir/alias-2.c"] { 102 yes { dg-runtest "$srcdir/$subdir/alias-2.c" "" "" } 103 no { unsupported "alias-2.c" } 104 default { fail "alias-2.c" } 105} 106dg-finish 107 108########### 109# wkali-1.c 110########### 111 112if { [ check_weak_available ] == 1 } { 113 dg-init 114 switch [check_alias_available "$srcdir/$subdir/wkali-1.c"] { 115 yes { dg-runtest "$srcdir/$subdir/wkali-1.c" "" "" } 116 no { unsupported "wkali-1.c" } 117 default { fail "wkali-1.c" } 118 } 119 dg-finish 120} elseif { [ check_weak_available ] == 0 } { 121 unsupported "wkali-1.c" 122} else { 123 unresolved "wkali-1.c" 124} 125 126########### 127# wkali-2.c 128########### 129 130if { [ check_weak_available ] == 1 } { 131 dg-init 132 set lines [gcc_target_compile "$srcdir/$subdir/wkali-2a.c" "wkali-2a.o" object ""] 133 if ![string match "" $lines] then { 134 fail "wkali-2a.o" 135 } else { 136 set lines [gcc_target_compile "$srcdir/$subdir/wkali-2b.c" "wkali-2b.o" object ""] 137 if [string match "*only weak aliases*" $lines] then { 138 xfail "wkali-2b.o" 139 file delete $srcdir/$subdir/wkali-2.exe 140 } elseif ![string match "" $lines] then { 141 fail "wkali-2b.o" 142 } else { 143 dg-runtest "$srcdir/$subdir/wkali-2.c" "wkali-2a.o wkali-2b.o" "" 144 file delete wkali-2a.o wkali-2b.o 145 } 146 } 147 dg-finish 148} elseif { [ check_weak_available ] == 0 } { 149 unsupported "wkali-2.c" 150} else { 151 unresolved "wkali-2.c" 152} 153 154########### 155# gcsec-1.c 156########### 157 158# Check if the ld used by gcc supports --gc-sections. 159set gcc_ld [lindex [gcc_target_compile "-print-prog-name=ld" "" "none" ""] 0] 160set ld_output [remote_exec host "$gcc_ld" "--help"] 161 162# AIX gld supports garbage collection. But AIX gcc does not support 163# -ffunction-sections or -fdata-sections. 164if { [ string first "--gc-sections" $ld_output ] >= 0 165 && ! [istarget rs6000-*-aix*] 166 && ! [istarget powerpc*-*-aix*] } { 167 168 dg-init 169 if [isnative] { 170 dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" "" 171 } else { 172 dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" "" 173 } 174 dg-finish 175} else { 176 unsupported "gcsec-1.c" 177} 178 179### EOF ecos.exp 180