]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.misc-tests/linkage.exp
Remove long deprecated tilegx and tilepro ports
[thirdparty/gcc.git] / gcc / testsuite / gcc.misc-tests / linkage.exp
1 # Copyright (C) 1988-2022 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 3 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 GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
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 load_lib gcc-defs.exp
22
23 # These tests don't run runtest_file_p consistently if it
24 # doesn't return the same values, so disable parallelization
25 # of this *.exp file. The first parallel runtest to reach
26 # this will run all the tests serially.
27 if ![gcc_parallel_test_run_p linkage] {
28 return
29 }
30 gcc_parallel_test_enable 0
31
32 if { [isnative] && ![is_remote host] } then {
33 set lines [gcc_target_compile "$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}]
34 if ![string match "" $lines] then {
35 fail "$subdir/linkage.c compile"
36 } else {
37 # This is a completely bogus test. Sorry.
38
39 # Need to ensure ABI for native compiler matches gcc
40 set native_cflags ""
41 if [istarget "mips*-linux*"] {
42 set file_string [exec file "linkage-x.o"]
43 if [ string match "*64*" $file_string ] {
44 set native_cflags "-mabi=64"
45 }
46 if [ string match "*ELF 32*" $file_string ] {
47 set native_cflags "-mabi=32"
48 }
49 if [ string match "*N32*" $file_string ] {
50 set native_cflags "-mabi=n32"
51 }
52 }
53 if [istarget "sparc*-sun-solaris2*"] {
54 set file_string [exec file "linkage-x.o"]
55 if [ string match "*64*" $file_string ] {
56 set native_cflags "-xarch=v9"
57 }
58 }
59 if {[istarget "i?86*-*-solaris2*"] || [istarget "x86_64-*-solaris2*"]} {
60 set file_string [exec file "linkage-x.o"]
61 if [ string match "*64*" $file_string ] {
62 set native_cflags "-xarch=amd64"
63 }
64 }
65 if [istarget "s390*-*-linux*"] {
66 set file_string [exec file "linkage-x.o"]
67 if [ string match "*32-bit*" $file_string ] {
68 set native_cflags "-m31"
69 }
70 if [ string match "*64-bit*" $file_string ] {
71 set native_cflags "-m64"
72 }
73 } elseif {[istarget "i?86-*-linux*"] || [istarget "x86_64-*-linux*"]
74 || [istarget "i?86-*-gnu*"] || [istarget "x86_64-*-gnu*"] } then {
75 set file_string [exec file "linkage-x.o"]
76 if [ string match "*32-bit*" $file_string ] {
77 set native_cflags "-m32"
78 }
79 if [ string match "*64-bit*" $file_string ] {
80 set native_cflags "-m64"
81 }
82 } elseif [istarget "*-hp-hpux*"] {
83 set file_string [exec file "linkage-x.o"]
84 if [ string match "*ELF-64*" $file_string ] {
85 set native_cflags "+DD64"
86 }
87 } elseif [istarget "powerpc*-*-linux*"] {
88 set file_string [exec file "linkage-x.o"]
89 if [ string match "*64-bit*" $file_string ] {
90 set native_cflags "-m64"
91 } elseif [ string match "*32-bit*" $file_string ] {
92 set native_cflags "-m32"
93 }
94 } elseif [istarget "powerpc*-*-darwin*"] {
95 set file_string [exec file "linkage-x.o"]
96 if [ string match "*ppc64" $file_string ] {
97 set native_cflags "-m64"
98 } elseif [ string match "*ppc" $file_string ] {
99 set native_cflags "-m32"
100 }
101 } elseif [istarget "*86*-*-darwin*"] {
102 set file_string [exec file "linkage-x.o"]
103 if [ string match "*64*" $file_string ] {
104 set native_cflags "-m64"
105 } elseif [ string match "*i386" $file_string ] {
106 set native_cflags "-m32"
107 }
108 }
109
110 if [file exists "linkage-y.o"] then {
111 file delete "linkage-y.o"
112 }
113 send_log "cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
114 catch { exec cc -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
115 if ![file exists "linkage-y.o"] then {
116 send_log "c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
117 catch { exec c89 -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
118 }
119 if [file exists "linkage-y.o"] then {
120 set lines [gcc_target_compile "linkage-y.o linkage-x.o" "linkage.exe" executable ""]
121 if [string match "" $lines] then {
122 pass "$subdir/linkage.c link"
123 file delete "linkage.exe"
124 } else {
125 fail "$subdir/linkage.c link"
126 }
127 file delete "linkage-y.o"
128 } else {
129 unsupported "$subdir/linkage.c native compile failed"
130 }
131 file delete "linkage-x.o"
132 }
133 }
134
135 gcc_parallel_test_enable 1