summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.misc-tests/linkage.exp
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.misc-tests/linkage.exp
downloadcbb-gcc-4.6.4-upstream.tar.bz2
cbb-gcc-4.6.4-upstream.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.misc-tests/linkage.exp')
-rw-r--r--gcc/testsuite/gcc.misc-tests/linkage.exp122
1 files changed, 122 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.misc-tests/linkage.exp b/gcc/testsuite/gcc.misc-tests/linkage.exp
new file mode 100644
index 000000000..954dc29a5
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/linkage.exp
@@ -0,0 +1,122 @@
+# Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010
+# 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.
+
+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-sgi-irix6*"] {
+ set file_string [exec file "linkage-x.o"]
+ if [ string match "*64*" $file_string ] {
+ set native_cflags "-64"
+ }
+ if [ string match "*ELF 32*" $file_string ] {
+ set native_cflags "-32"
+ }
+ if [ string match "*N32*" $file_string ] {
+ set native_cflags "-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*"] {
+ 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*"]} {
+ 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"
+ }
+}