1 # Copyright
(C
) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010
2 # Free Software Foundation
, Inc.
4 # This
program is free software
; you can redistribute it and
/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation
; either version
3 of the License
, or
7 #
(at your option
) any later version.
9 # This
program is distributed in the hope that it will be useful
,
10 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License
for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with GCC
; see the file COPYING3.
If not see
16 #
<http
://www.gnu.org
/licenses
/>.
18 # This file used to be gcc.c
-torture
/special
/special.exp
, which
19 # was written by Rob Savoye.
(rob@cygnus.com
)
20 # All the other tests driven by that file have since been moved elsewhere.
22 if { [isnative
] && ![is_remote host
] } then {
23 set lines
[gcc_target_compile
"$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}]
24 if ![string match
"" $lines] then {
25 fail
"$subdir/linkage.c compile"
27 # This is a completely bogus test. Sorry.
29 # Need to ensure ABI
for native compiler matches gcc
31 if [istarget
"mips-sgi-irix6*"] {
32 set file_string
[exec file
"linkage-x.o"]
33 if [ string match
"*64*" $file_string ] {
34 set native_cflags
"-64"
36 if [ string match
"*ELF 32*" $file_string ] {
37 set native_cflags
"-32"
39 if [ string match
"*N32*" $file_string ] {
40 set native_cflags
"-n32"
43 if [istarget
"sparc*-sun-solaris2*"] {
44 set file_string
[exec file
"linkage-x.o"]
45 if [ string match
"*64*" $file_string ] {
46 set native_cflags
"-xarch=v9"
49 if [istarget
"i?86*-*-solaris2*"] {
50 set file_string
[exec file
"linkage-x.o"]
51 if [ string match
"*64*" $file_string ] {
52 set native_cflags
"-xarch=amd64"
55 if [istarget
"s390*-*-linux*"] {
56 set file_string
[exec file
"linkage-x.o"]
57 if [ string match
"*32-bit*" $file_string ] {
58 set native_cflags
"-m31"
60 if [ string match
"*64-bit*" $file_string ] {
61 set native_cflags
"-m64"
63 } elseif
{[istarget
"i*86-*-linux*"] || [istarget "x86_64-*-linux*"]} {
64 set file_string
[exec file
"linkage-x.o"]
65 if [ string match
"*32-bit*" $file_string ] {
66 set native_cflags
"-m32"
68 if [ string match
"*64-bit*" $file_string ] {
69 set native_cflags
"-m64"
71 } elseif
[istarget
"*-hp-hpux*"] {
72 set file_string
[exec file
"linkage-x.o"]
73 if [ string match
"*ELF-64*" $file_string ] {
74 set native_cflags
"+DD64"
76 } elseif
[istarget
"powerpc*-*-linux*"] {
77 set file_string
[exec file
"linkage-x.o"]
78 if [ string match
"*64-bit*" $file_string ] {
79 set native_cflags
"-m64"
80 } elseif
[ string match
"*32-bit*" $file_string ] {
81 set native_cflags
"-m32"
83 } elseif
[istarget
"powerpc*-*-darwin*"] {
84 set file_string
[exec file
"linkage-x.o"]
85 if [ string match
"*ppc64" $file_string ] {
86 set native_cflags
"-m64"
87 } elseif
[ string match
"*ppc" $file_string ] {
88 set native_cflags
"-m32"
90 } elseif
[istarget
"*86*-*-darwin*"] {
91 set file_string
[exec file
"linkage-x.o"]
92 if [ string match
"*64*" $file_string ] {
93 set native_cflags
"-m64"
94 } elseif
[ string match
"*i386" $file_string ] {
95 set native_cflags
"-m32"
99 if [file
exists "linkage-y.o"] then {
100 file
delete "linkage-y.o"
102 send_log
"cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
103 catch
{ exec cc
-c $native_cflags
"$srcdir/$subdir/linkage-y.c" >&/dev/null }
104 if ![file
exists "linkage-y.o"] then {
105 send_log
"c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
106 catch
{ exec c89
-c $native_cflags
"$srcdir/$subdir/linkage-y.c" >&/dev/null }
108 if [file
exists "linkage-y.o"] then {
109 set lines
[gcc_target_compile
"linkage-y.o linkage-x.o" "linkage.exe" executable ""]
110 if [string match
"" $lines] then {
111 pass
"$subdir/linkage.c link"
112 file
delete "linkage.exe"
114 fail
"$subdir/linkage.c link"
116 file
delete "linkage-y.o"
118 unsupported
"$subdir/linkage.c native compile failed"
120 file
delete "linkage-x.o"