1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
# Copyright (C) 1988-2024 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# This file used to be gcc.c-torture/special/special.exp, which
# was written by Rob Savoye. (rob@cygnus.com)
# All the other tests driven by that file have since been moved elsewhere.
load_lib gcc-defs.exp
# These tests don't run runtest_file_p consistently if it
# doesn't return the same values, so disable parallelization
# of this *.exp file. The first parallel runtest to reach
# this will run all the tests serially.
if ![gcc_parallel_test_run_p linkage] {
return
}
gcc_parallel_test_enable 0
if { [isnative] && ![is_remote host] } then {
set lines [gcc_target_compile "$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}]
if ![string match "" $lines] then {
fail "$subdir/linkage.c compile"
} else {
# This is a completely bogus test. Sorry.
# Need to ensure ABI for native compiler matches gcc
set native_cflags ""
if [istarget "mips*-linux*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*64*" $file_string ] {
set native_cflags "-mabi=64"
}
if [ string match "*ELF 32*" $file_string ] {
set native_cflags "-mabi=32"
}
if [ string match "*N32*" $file_string ] {
set native_cflags "-mabi=n32"
}
}
if [istarget "sparc*-sun-solaris2*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*64*" $file_string ] {
set native_cflags "-xarch=v9"
}
}
if {[istarget "i?86*-*-solaris2*"] || [istarget "x86_64-*-solaris2*"]} {
set file_string [exec file "linkage-x.o"]
if [ string match "*64*" $file_string ] {
set native_cflags "-xarch=amd64"
}
}
if [istarget "s390*-*-linux*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*32-bit*" $file_string ] {
set native_cflags "-m31"
}
if [ string match "*64-bit*" $file_string ] {
set native_cflags "-m64"
}
} elseif {[istarget "i?86-*-linux*"] || [istarget "x86_64-*-linux*"]
|| [istarget "i?86-*-gnu*"] || [istarget "x86_64-*-gnu*"] } then {
set file_string [exec file "linkage-x.o"]
if [ string match "*32-bit*" $file_string ] {
set native_cflags "-m32"
}
if [ string match "*64-bit*" $file_string ] {
set native_cflags "-m64"
}
} elseif [istarget "*-hp-hpux*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*ELF-64*" $file_string ] {
set native_cflags "+DD64"
}
} elseif [istarget "powerpc*-*-linux*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*64-bit*" $file_string ] {
set native_cflags "-m64"
} elseif [ string match "*32-bit*" $file_string ] {
set native_cflags "-m32"
}
} elseif [istarget "powerpc*-*-darwin*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*ppc64" $file_string ] {
set native_cflags "-m64"
} elseif [ string match "*ppc" $file_string ] {
set native_cflags "-m32"
}
} elseif [istarget "*86*-*-darwin*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*64*" $file_string ] {
set native_cflags "-m64"
} elseif [ string match "*i386" $file_string ] {
set native_cflags "-m32"
}
}
if [file exists "linkage-y.o"] then {
file delete "linkage-y.o"
}
send_log "cc -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
catch { exec cc -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
if ![file exists "linkage-y.o"] then {
send_log "c89 -c $native_cflags $srcdir/$subdir/linkage-y.c >&/dev/null\n"
catch { exec c89 -c $native_cflags "$srcdir/$subdir/linkage-y.c" >&/dev/null }
}
if [file exists "linkage-y.o"] then {
set lines [gcc_target_compile "linkage-y.o linkage-x.o" "linkage.exe" executable ""]
if [string match "" $lines] then {
pass "$subdir/linkage.c link"
file delete "linkage.exe"
} else {
fail "$subdir/linkage.c link"
}
file delete "linkage-y.o"
} else {
unsupported "$subdir/linkage.c native compile failed"
}
file delete "linkage-x.o"
}
}
gcc_parallel_test_enable 1
|