]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.misc-tests/linkage.exp
re PR bootstrap/39150 (Configure scripts have no 64-Bit Solaris defined (only i386...
[thirdparty/gcc.git] / gcc / testsuite / gcc.misc-tests / linkage.exp
CommitLineData
78f56a7b 1# Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010
66647d44 2# Free Software Foundation, Inc.
3be6ce46
ZW
3
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
cd976c16 6# the Free Software Foundation; either version 3 of the License, or
3be6ce46 7# (at your option) any later version.
f7288899 8#
3be6ce46
ZW
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.
f7288899 13#
3be6ce46 14# You should have received a copy of the GNU General Public License
cd976c16
NC
15# along with GCC; see the file COPYING3. If not see
16# <http://www.gnu.org/licenses/>.
3be6ce46 17
3be6ce46
ZW
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.
21
485b51a7 22if { [isnative] && ![is_remote host] } then {
3be6ce46
ZW
23 set lines [gcc_target_compile "$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}]
24 if ![string match "" $lines] then {
af980752 25 fail "$subdir/linkage.c compile"
3be6ce46
ZW
26 } else {
27 # This is a completely bogus test. Sorry.
3af21e04
DB
28
29 # Need to ensure ABI for native compiler matches gcc
30 set native_cflags ""
31 if [istarget "mips-sgi-irix6*"] {
42a9e4e4
DB
32 set file_string [exec file "linkage-x.o"]
33 if [ string match "*64*" $file_string ] {
3af21e04
DB
34 set native_cflags "-64"
35 }
789b7de5
RO
36 if [ string match "*ELF 32*" $file_string ] {
37 set native_cflags "-32"
38 }
87327987 39 if [ string match "*N32*" $file_string ] {
42a9e4e4
DB
40 set native_cflags "-n32"
41 }
3af21e04 42 }
71fad614 43 if [istarget "sparc*-sun-solaris2*"] {
ee3c0639
KG
44 set file_string [exec file "linkage-x.o"]
45 if [ string match "*64*" $file_string ] {
46 set native_cflags "-xarch=v9"
47 }
48 }
fbdd5d87
RO
49 if {[istarget "i?86*-*-solaris2*"]
50 || [istarget "x86_64-*-solaris2.1\[0-9\]*"]} {
78f56a7b
RO
51 set file_string [exec file "linkage-x.o"]
52 if [ string match "*64*" $file_string ] {
53 set native_cflags "-xarch=amd64"
54 }
55 }
ab71324a 56 if [istarget "s390*-*-linux*"] {
ecef5e87
UW
57 set file_string [exec file "linkage-x.o"]
58 if [ string match "*32-bit*" $file_string ] {
59 set native_cflags "-m31"
60 }
ab71324a
AK
61 if [ string match "*64-bit*" $file_string ] {
62 set native_cflags "-m64"
63 }
76425f89 64 } elseif {[istarget "i*86-*-linux*"] || [istarget "x86_64-*-linux*"]} {
96a4ec03
L
65 set file_string [exec file "linkage-x.o"]
66 if [ string match "*32-bit*" $file_string ] {
67 set native_cflags "-m32"
68 }
daf1735f
SB
69 if [ string match "*64-bit*" $file_string ] {
70 set native_cflags "-m64"
71 }
35f73a73 72 } elseif [istarget "*-hp-hpux*"] {
7741796c
MM
73 set file_string [exec file "linkage-x.o"]
74 if [ string match "*ELF-64*" $file_string ] {
75 set native_cflags "+DD64"
76 }
65b1344e 77 } elseif [istarget "powerpc*-*-linux*"] {
46d1d0da
JJ
78 set file_string [exec file "linkage-x.o"]
79 if [ string match "*64-bit*" $file_string ] {
80 set native_cflags "-m64"
65b1344e
AM
81 } elseif [ string match "*32-bit*" $file_string ] {
82 set native_cflags "-m32"
46d1d0da 83 }
38439253 84 } elseif [istarget "powerpc*-*-darwin*"] {
f7288899 85 set file_string [exec file "linkage-x.o"]
38439253 86 if [ string match "*ppc64" $file_string ] {
f7288899 87 set native_cflags "-m64"
38439253 88 } elseif [ string match "*ppc" $file_string ] {
f7288899
EC
89 set native_cflags "-m32"
90 }
38439253
JH
91 } elseif [istarget "*86*-*-darwin*"] {
92 set file_string [exec file "linkage-x.o"]
4796d66e 93 if [ string match "*64*" $file_string ] {
38439253
JH
94 set native_cflags "-m64"
95 } elseif [ string match "*i386" $file_string ] {
96 set native_cflags "-m32"
97 }
98 }
3af21e04 99
af980752
JJ
100 if [file exists "linkage-y.o"] then {
101 file delete "linkage-y.o"
102 }
87327987 103 send_log "cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
3af21e04 104 catch { exec cc -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
3be6ce46 105 if ![file exists "linkage-y.o"] then {
87327987 106 send_log "c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
3af21e04 107 catch { exec c89 -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
3be6ce46
ZW
108 }
109 if [file exists "linkage-y.o"] then {
af980752 110 set lines [gcc_target_compile "linkage-y.o linkage-x.o" "linkage.exe" executable ""]
3be6ce46 111 if [string match "" $lines] then {
af980752
JJ
112 pass "$subdir/linkage.c link"
113 file delete "linkage.exe"
3be6ce46 114 } else {
af980752 115 fail "$subdir/linkage.c link"
3be6ce46 116 }
af980752
JJ
117 file delete "linkage-y.o"
118 } else {
119 unsupported "$subdir/linkage.c native compile failed"
3be6ce46 120 }
af980752 121 file delete "linkage-x.o"
3be6ce46
ZW
122 }
123}