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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [lib/] [gcc.exp] - Blame information for rev 701

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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