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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [lib/] [gcc.exp] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2003, 2004 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 2 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 this program; if not, write to the Free Software
15
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16
 
17
# This file was written by Rob Savoye (rob@cygnus.com)
18
# Currently maintained by Doug Evans (dje@cygnus.com)
19
 
20
# This file is loaded by the tool init file (eg: unix.exp).  It provides
21
# default definitions for gcc_start, etc. and other supporting cast members.
22
 
23
# These globals are used by gcc_start if no compiler arguments are provided.
24
# They are also used by the various testsuites to define the environment:
25
# where to find stdio.h, libc.a, etc.
26
 
27
# we want to use libgloss so we can get find_gcc.
28
load_lib libgloss.exp
29
load_lib prune.exp
30
load_lib gcc-defs.exp
31
 
32
#
33
# GCC_UNDER_TEST is the compiler under test.
34
#
35
 
36
#
37
# default_gcc_version -- extract and print the version number of the compiler
38
#
39
 
40
proc default_gcc_version { } {
41
    global GCC_UNDER_TEST
42
 
43
    gcc_init
44
 
45
    # ignore any arguments after the command
46
    set compiler [lindex $GCC_UNDER_TEST 0]
47
 
48
    if ![is_remote host] {
49
        set compiler_name [which $compiler]
50
    } else {
51
        set compiler_name $compiler
52
    }
53
 
54
    # verify that the compiler exists
55
    if { $compiler_name != 0 } then {
56
        set tmp [remote_exec host "$compiler -v"]
57
        set status [lindex $tmp 0]
58
        set output [lindex $tmp 1]
59
        regexp " version \[^\n\r\]*" $output version
60
        if { $status == 0 && [info exists version] } then {
61
            clone_output "$compiler_name $version\n"
62
        } else {
63
            clone_output "Couldn't determine version of $compiler_name: $output\n"
64
        }
65
    } else {
66
        # compiler does not exist (this should have already been detected)
67
        warning "$compiler does not exist"
68
    }
69
}
70
 
71
#
72
# gcc_version -- Call default_gcc_version, so we can override it if needed.
73
#
74
 
75
proc gcc_version { } {
76
    default_gcc_version
77
}
78
 
79
#
80
# gcc_init -- called at the start of each .exp script.
81
#
82
# There currently isn't much to do, but always using it allows us to
83
# make some enhancements without having to go back and rewrite the scripts.
84
#
85
 
86
set gcc_initialized 0
87
 
88
proc gcc_init { args } {
89
    global tmpdir
90
    global libdir
91
    global gluefile wrap_flags
92
    global gcc_initialized
93
    global GCC_UNDER_TEST
94
    global TOOL_EXECUTABLE
95
 
96
    if { $gcc_initialized == 1 } { return; }
97
 
98
    if ![info exists GCC_UNDER_TEST] {
99
        if [info exists TOOL_EXECUTABLE] {
100
            set GCC_UNDER_TEST $TOOL_EXECUTABLE
101
        } else {
102
            set GCC_UNDER_TEST "[find_gcc]"
103
        }
104
    }
105
 
106
    if ![info exists tmpdir] then {
107
        set tmpdir /tmp
108
    }
109
 
110
    gcc_maybe_build_wrapper "${tmpdir}/gcc-testglue.o"
111
}
112
 
113
#
114
# gcc_target_compile -- compile a source file
115
#
116
 
117
proc gcc_target_compile { source dest type options } {
118
    global tmpdir
119
    global gluefile wrap_flags
120
    global GCC_UNDER_TEST
121
    global TOOL_OPTIONS
122
 
123
    if {[target_info needs_status_wrapper] != "" && \
124
            [target_info needs_status_wrapper] != "0" && \
125
            [info exists gluefile] } {
126
        lappend options "libs=${gluefile}"
127
        lappend options "ldflags=$wrap_flags"
128
    }
129
 
130
    if [target_info exists gcc,stack_size] {
131
        lappend options "additional_flags=-DSTACK_SIZE=[target_info gcc,stack_size]"
132
    }
133
    if [target_info exists gcc,no_trampolines] {
134
        lappend options "additional_flags=-DNO_TRAMPOLINES"
135
    }
136
    if [target_info exists gcc,no_label_values] {
137
        lappend options "additional_flags=-DNO_LABEL_VALUES"
138
    }
139
    # TOOL_OPTIONS must come first, so that it doesn't override testcase
140
    # specific options.
141
    if [info exists TOOL_OPTIONS] {
142
        set options [concat "{additional_flags=$TOOL_OPTIONS}" $options]
143
    }
144
    if [target_info exists gcc,timeout] {
145
        lappend options "timeout=[target_info gcc,timeout]"
146
    }
147
    lappend options "additional_flags=-fno-show-column"
148
    lappend options "compiler=$GCC_UNDER_TEST"
149
    set options [dg-additional-files-options $options $source]
150
    return [target_compile $source $dest $type $options]
151
}

powered by: WebSVN 2.1.0

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