]>
Commit | Line | Data |
---|---|---|
789b7de5 | 1 | # Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. |
3be6ce46 ZW |
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. | |
f7288899 | 7 | # |
3be6ce46 ZW |
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. | |
f7288899 | 12 | # |
3be6ce46 ZW |
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 | |
f7288899 | 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
3be6ce46 | 16 | |
3be6ce46 ZW |
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 { | |
af980752 | 24 | fail "$subdir/linkage.c compile" |
3be6ce46 ZW |
25 | } else { |
26 | # This is a completely bogus test. Sorry. | |
3af21e04 DB |
27 | |
28 | # Need to ensure ABI for native compiler matches gcc | |
29 | set native_cflags "" | |
30 | if [istarget "mips-sgi-irix6*"] { | |
42a9e4e4 DB |
31 | set file_string [exec file "linkage-x.o"] |
32 | if [ string match "*64*" $file_string ] { | |
3af21e04 DB |
33 | set native_cflags "-64" |
34 | } | |
789b7de5 RO |
35 | if [ string match "*ELF 32*" $file_string ] { |
36 | set native_cflags "-32" | |
37 | } | |
87327987 | 38 | if [ string match "*N32*" $file_string ] { |
42a9e4e4 DB |
39 | set native_cflags "-n32" |
40 | } | |
3af21e04 | 41 | } |
789b7de5 RO |
42 | if [istarget "mips-sgi-iris6*o32" ] { |
43 | set native_cflags "-32" | |
44 | } | |
71fad614 | 45 | if [istarget "sparc*-sun-solaris2*"] { |
ee3c0639 KG |
46 | set file_string [exec file "linkage-x.o"] |
47 | if [ string match "*64*" $file_string ] { | |
48 | set native_cflags "-xarch=v9" | |
49 | } | |
50 | } | |
ab71324a | 51 | if [istarget "s390*-*-linux*"] { |
ecef5e87 UW |
52 | set file_string [exec file "linkage-x.o"] |
53 | if [ string match "*32-bit*" $file_string ] { | |
54 | set native_cflags "-m31" | |
55 | } | |
ab71324a AK |
56 | if [ string match "*64-bit*" $file_string ] { |
57 | set native_cflags "-m64" | |
58 | } | |
96a4ec03 L |
59 | } elseif [istarget "x86_64-*-linux*"] { |
60 | set file_string [exec file "linkage-x.o"] | |
61 | if [ string match "*32-bit*" $file_string ] { | |
62 | set native_cflags "-m32" | |
63 | } | |
35f73a73 | 64 | } elseif [istarget "*-hp-hpux*"] { |
7741796c MM |
65 | set file_string [exec file "linkage-x.o"] |
66 | if [ string match "*ELF-64*" $file_string ] { | |
67 | set native_cflags "+DD64" | |
68 | } | |
65b1344e | 69 | } elseif [istarget "powerpc*-*-linux*"] { |
46d1d0da JJ |
70 | set file_string [exec file "linkage-x.o"] |
71 | if [ string match "*64-bit*" $file_string ] { | |
72 | set native_cflags "-m64" | |
65b1344e AM |
73 | } elseif [ string match "*32-bit*" $file_string ] { |
74 | set native_cflags "-m32" | |
46d1d0da | 75 | } |
f7288899 EC |
76 | } elseif [istarget "*-*-darwin*"] { |
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" | |
82 | } | |
83 | } | |
3af21e04 | 84 | |
af980752 JJ |
85 | if [file exists "linkage-y.o"] then { |
86 | file delete "linkage-y.o" | |
87 | } | |
87327987 | 88 | send_log "cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n" |
3af21e04 | 89 | catch { exec cc -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null } |
3be6ce46 | 90 | if ![file exists "linkage-y.o"] then { |
87327987 | 91 | send_log "c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n" |
3af21e04 | 92 | catch { exec c89 -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null } |
3be6ce46 ZW |
93 | } |
94 | if [file exists "linkage-y.o"] then { | |
af980752 | 95 | set lines [gcc_target_compile "linkage-y.o linkage-x.o" "linkage.exe" executable ""] |
3be6ce46 | 96 | if [string match "" $lines] then { |
af980752 JJ |
97 | pass "$subdir/linkage.c link" |
98 | file delete "linkage.exe" | |
3be6ce46 | 99 | } else { |
af980752 | 100 | fail "$subdir/linkage.c link" |
3be6ce46 | 101 | } |
af980752 JJ |
102 | file delete "linkage-y.o" |
103 | } else { | |
104 | unsupported "$subdir/linkage.c native compile failed" | |
3be6ce46 | 105 | } |
af980752 | 106 | file delete "linkage-x.o" |
3be6ce46 ZW |
107 | } |
108 | } |