OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.misc-tests/] [linkage.exp] - Blame information for rev 756

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.