1 # Copyright
(C
) 1988-2024 Free Software Foundation
, Inc.
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.
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.
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
/>.
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.
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
] {
30 gcc_parallel_test_enable
0
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"
37 # This is a completely bogus test. Sorry.
39 # Need to ensure ABI
for native compiler matches gcc
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"
46 if [ string match
"*ELF 32*" $file_string ] {
47 set native_cflags
"-mabi=32"
49 if [ string match
"*N32*" $file_string ] {
50 set native_cflags
"-mabi=n32"
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"
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"
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"
70 if [ string match
"*64-bit*" $file_string ] {
71 set native_cflags
"-m64"
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"
79 if [ string match
"*64-bit*" $file_string ] {
80 set native_cflags
"-m64"
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"
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"
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"
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"
110 if [file
exists "linkage-y.o"] then {
111 file
delete "linkage-y.o"
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 }
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"
125 fail
"$subdir/linkage.c link"
127 file
delete "linkage-y.o"
129 unsupported
"$subdir/linkage.c native compile failed"
131 file
delete "linkage-x.o"
135 gcc_parallel_test_enable
1