| # Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002 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. |
| |
| # This file used to be gcc.c-torture/special/special.exp, which |
| # was written by Rob Savoye. (rob@cygnus.com) |
| # All the other tests driven by that file have since been moved elsewhere. |
| |
| if [isnative] then { |
| set lines [gcc_target_compile "$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}] |
| if ![string match "" $lines] then { |
| fail "linkage.c" |
| } else { |
| # This is a completely bogus test. Sorry. |
| |
| # Need to ensure ABI for native compiler matches gcc |
| set native_cflags "" |
| if [istarget "mips-sgi-irix6*"] { |
| set file_string [exec file "linkage-x.o"] |
| if [ string match "*64*" $file_string ] { |
| set native_cflags "-64" |
| } |
| if [ string match "*ELF 32*" $file_string ] { |
| set native_cflags "-32" |
| } |
| if [ string match "*N32*" $file_string ] { |
| set native_cflags "-n32" |
| } |
| } |
| if [istarget "mips-sgi-iris6*o32" ] { |
| set native_cflags "-32" |
| } |
| if [istarget "sparc*-sun-solaris2*"] { |
| set file_string [exec file "linkage-x.o"] |
| if [ string match "*64*" $file_string ] { |
| set native_cflags "-xarch=v9" |
| } |
| } |
| if [istarget "s390x-*-linux*"] { |
| set file_string [exec file "linkage-x.o"] |
| if [ string match "*32-bit*" $file_string ] { |
| set native_cflags "-m31" |
| } |
| } elseif [istarget "*-hp-hpux*"] { |
| set file_string [exec file "linkage-x.o"] |
| if [ string match "*ELF-64*" $file_string ] { |
| set native_cflags "+DD64" |
| } |
| } |
| |
| catch { exec rm -f linkage-y.o } |
| send_log "cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n" |
| catch { exec cc -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null } |
| if ![file exists "linkage-y.o"] then { |
| send_log "c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n" |
| catch { exec c89 -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null } |
| } |
| if [file exists "linkage-y.o"] then { |
| set lines [gcc_target_compile "linkage-y.o linkage-x.o" "x" executable ""] |
| if [string match "" $lines] then { |
| pass "linkage.c" |
| } else { |
| fail "linkage.c" |
| } |
| } |
| } |
| } |