OSDN Git Service

* gcc.misc-tests/linkage.exp: Handle biarch GCC for powerpc64.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.misc-tests / linkage.exp
1 # Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002 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 # This file used to be gcc.c-torture/special/special.exp, which
18 # was written by Rob Savoye. (rob@cygnus.com)
19 # All the other tests driven by that file have since been moved elsewhere.
20
21 if [isnative] then {
22     set lines [gcc_target_compile "$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}]
23     if ![string match "" $lines] then {
24         fail "$subdir/linkage.c compile"
25     } else {
26         # This is a completely bogus test. Sorry.
27
28         # Need to ensure ABI for native compiler matches gcc
29         set native_cflags ""
30         if  [istarget "mips-sgi-irix6*"] {
31             set file_string [exec file "linkage-x.o"]
32             if [ string match "*64*" $file_string ] {
33                 set native_cflags "-64"
34             }
35             if [ string match "*ELF 32*" $file_string ] {
36                 set native_cflags "-32"
37             }
38             if [ string match "*N32*" $file_string ] {
39                 set native_cflags "-n32"
40             }
41         }
42         if  [istarget "mips-sgi-iris6*o32" ] {
43             set native_cflags "-32"
44         }
45         if  [istarget "sparc*-sun-solaris2*"] {
46             set file_string [exec file "linkage-x.o"]
47             if [ string match "*64*" $file_string ] {
48                 set native_cflags "-xarch=v9"
49             }
50         }
51         if [istarget "s390x-*-linux*"] {
52             set file_string [exec file "linkage-x.o"]
53             if [ string match "*32-bit*" $file_string ] {
54                 set native_cflags "-m31"
55             }
56         } elseif [istarget "x86_64-*-linux*"] {
57             set file_string [exec file "linkage-x.o"]
58             if [ string match "*32-bit*" $file_string ] {
59                 set native_cflags "-m32"
60             }
61         } elseif [istarget "*-hp-hpux*"] {
62             set file_string [exec file "linkage-x.o"]
63             if [ string match "*ELF-64*" $file_string ] {
64                 set native_cflags "+DD64"
65             }
66         } elseif [istarget "powerpc64*-*-linux*"] {
67             set file_string [exec file "linkage-x.o"]
68             if [ string match "*64-bit*" $file_string ] {
69                 set native_cflags "-m64"
70             }
71         }
72
73         if [file exists "linkage-y.o"] then {
74             file delete "linkage-y.o"
75         }
76         send_log "cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
77         catch { exec cc -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
78         if ![file exists "linkage-y.o"] then {
79             send_log "c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
80             catch { exec c89 -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
81         }
82         if [file exists "linkage-y.o"] then {
83             set lines [gcc_target_compile "linkage-y.o linkage-x.o" "linkage.exe" executable ""]
84             if [string match "" $lines] then {
85                 pass "$subdir/linkage.c link"
86                 file delete "linkage.exe"
87             } else {
88                 fail "$subdir/linkage.c link"
89             }
90             file delete "linkage-y.o"
91         } else {
92             unsupported "$subdir/linkage.c native compile failed"
93         }
94         file delete "linkage-x.o"
95     }
96 }