]>
Commit | Line | Data |
---|---|---|
71e45bc2 | 1 | # Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010, 2011, |
2 | # 2012 Free Software Foundation, Inc. | |
2bb7f797 | 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 | |
f63ff66b | 6 | # the Free Software Foundation; either version 3 of the License, or |
2bb7f797 | 7 | # (at your option) any later version. |
3ebc7dec | 8 | # |
2bb7f797 | 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. | |
3ebc7dec | 13 | # |
2bb7f797 | 14 | # You should have received a copy of the GNU General Public License |
f63ff66b | 15 | # along with GCC; see the file COPYING3. If not see |
16 | # <http://www.gnu.org/licenses/>. | |
2bb7f797 | 17 | |
2bb7f797 | 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 | ||
76f3b287 | 22 | if { [isnative] && ![is_remote host] } then { |
2bb7f797 | 23 | set lines [gcc_target_compile "$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}] |
24 | if ![string match "" $lines] then { | |
fea09e07 | 25 | fail "$subdir/linkage.c compile" |
2bb7f797 | 26 | } else { |
27 | # This is a completely bogus test. Sorry. | |
19b5784b | 28 | |
29 | # Need to ensure ABI for native compiler matches gcc | |
30 | set native_cflags "" | |
717818c3 | 31 | if [istarget "sparc*-sun-solaris2*"] { |
2f0465ea | 32 | set file_string [exec file "linkage-x.o"] |
33 | if [ string match "*64*" $file_string ] { | |
34 | set native_cflags "-xarch=v9" | |
35 | } | |
36 | } | |
14f27bc6 | 37 | if {[istarget "i?86*-*-solaris2*"] |
38 | || [istarget "x86_64-*-solaris2.1\[0-9\]*"]} { | |
bc33bf0a | 39 | set file_string [exec file "linkage-x.o"] |
40 | if [ string match "*64*" $file_string ] { | |
41 | set native_cflags "-xarch=amd64" | |
42 | } | |
43 | } | |
fcda08ff | 44 | if [istarget "s390*-*-linux*"] { |
5f1f093f | 45 | set file_string [exec file "linkage-x.o"] |
46 | if [ string match "*32-bit*" $file_string ] { | |
47 | set native_cflags "-m31" | |
48 | } | |
fcda08ff | 49 | if [ string match "*64-bit*" $file_string ] { |
50 | set native_cflags "-m64" | |
51 | } | |
56f02220 | 52 | } elseif {[istarget "i*86-*-linux*"] || [istarget "x86_64-*-linux*"]} { |
09892c52 | 53 | set file_string [exec file "linkage-x.o"] |
54 | if [ string match "*32-bit*" $file_string ] { | |
55 | set native_cflags "-m32" | |
56 | } | |
41ababb4 | 57 | if [ string match "*64-bit*" $file_string ] { |
58 | set native_cflags "-m64" | |
59 | } | |
c286b7d4 | 60 | } elseif [istarget "*-hp-hpux*"] { |
e18ceeff | 61 | set file_string [exec file "linkage-x.o"] |
62 | if [ string match "*ELF-64*" $file_string ] { | |
63 | set native_cflags "+DD64" | |
64 | } | |
e6025d4c | 65 | } elseif [istarget "powerpc*-*-linux*"] { |
8495accb | 66 | set file_string [exec file "linkage-x.o"] |
67 | if [ string match "*64-bit*" $file_string ] { | |
68 | set native_cflags "-m64" | |
e6025d4c | 69 | } elseif [ string match "*32-bit*" $file_string ] { |
70 | set native_cflags "-m32" | |
8495accb | 71 | } |
af8da8df | 72 | } elseif [istarget "powerpc*-*-darwin*"] { |
3ebc7dec | 73 | set file_string [exec file "linkage-x.o"] |
af8da8df | 74 | if [ string match "*ppc64" $file_string ] { |
3ebc7dec | 75 | set native_cflags "-m64" |
af8da8df | 76 | } elseif [ string match "*ppc" $file_string ] { |
3ebc7dec | 77 | set native_cflags "-m32" |
78 | } | |
7ce78e23 | 79 | } elseif [istarget "tilegx-*-linux*"] { |
80 | set file_string [exec file "linkage-x.o"] | |
81 | if [ string match "*64-bit*" $file_string ] { | |
82 | set native_cflags "-m64" | |
83 | } elseif [ string match "*32-bit*" $file_string ] { | |
84 | set native_cflags "-m32" | |
85 | } | |
af8da8df | 86 | } elseif [istarget "*86*-*-darwin*"] { |
87 | set file_string [exec file "linkage-x.o"] | |
f57361c4 | 88 | if [ string match "*64*" $file_string ] { |
af8da8df | 89 | set native_cflags "-m64" |
90 | } elseif [ string match "*i386" $file_string ] { | |
91 | set native_cflags "-m32" | |
92 | } | |
93 | } | |
19b5784b | 94 | |
fea09e07 | 95 | if [file exists "linkage-y.o"] then { |
96 | file delete "linkage-y.o" | |
97 | } | |
3faa8a40 | 98 | send_log "cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n" |
19b5784b | 99 | catch { exec cc -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null } |
2bb7f797 | 100 | if ![file exists "linkage-y.o"] then { |
3faa8a40 | 101 | send_log "c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n" |
19b5784b | 102 | catch { exec c89 -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null } |
2bb7f797 | 103 | } |
104 | if [file exists "linkage-y.o"] then { | |
fea09e07 | 105 | set lines [gcc_target_compile "linkage-y.o linkage-x.o" "linkage.exe" executable ""] |
2bb7f797 | 106 | if [string match "" $lines] then { |
fea09e07 | 107 | pass "$subdir/linkage.c link" |
108 | file delete "linkage.exe" | |
2bb7f797 | 109 | } else { |
fea09e07 | 110 | fail "$subdir/linkage.c link" |
2bb7f797 | 111 | } |
fea09e07 | 112 | file delete "linkage-y.o" |
113 | } else { | |
114 | unsupported "$subdir/linkage.c native compile failed" | |
2bb7f797 | 115 | } |
fea09e07 | 116 | file delete "linkage-x.o" |
2bb7f797 | 117 | } |
118 | } |