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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 737 jeremybenn
# This program is free software; you can redistribute it and/or modify
2
# it under the terms of the GNU General Public License as published by
3
# the Free Software Foundation; either version 2 of the License, or
4
# (at your option) any later version.
5
#
6
# This program is distributed in the hope that it will be useful,
7
# but WITHOUT ANY WARRANTY; without even the implied warranty of
8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9
# GNU General Public License for more details.
10
#
11
# You should have received a copy of the GNU General Public License
12
# along with this program; if not, write to the Free Software
13
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14
 
15
# Damn dejagnu for not having proper library search paths for load_lib.
16
# We have to explicitly load everything that gcc-dg.exp wants to load.
17
 
18
proc load_gcc_lib { filename } {
19
    global srcdir loaded_libs
20
 
21
    load_file $srcdir/../../gcc/testsuite/lib/$filename
22
    set loaded_libs($filename) ""
23
}
24
 
25
load_lib dg.exp
26
load_gcc_lib file-format.exp
27
load_gcc_lib target-supports.exp
28
load_gcc_lib target-supports-dg.exp
29
load_gcc_lib scanasm.exp
30
load_gcc_lib scandump.exp
31
load_gcc_lib scanrtl.exp
32
load_gcc_lib scantree.exp
33
load_gcc_lib scanipa.exp
34
load_gcc_lib prune.exp
35
load_gcc_lib target-libpath.exp
36
load_gcc_lib wrapper.exp
37
load_gcc_lib gcc-defs.exp
38
load_gcc_lib torture-options.exp
39
load_gcc_lib timeout.exp
40
load_gcc_lib timeout-dg.exp
41
load_gcc_lib gcc-dg.exp
42
 
43
set dg-do-what-default run
44
 
45
#
46
# GCC_UNDER_TEST is the compiler under test.
47
#
48
 
49
set libitm_compile_options ""
50
 
51
#
52
# libitm_init
53
#
54
 
55
if [info exists TOOL_OPTIONS] {
56
    set multilibs [get_multilibs $TOOL_OPTIONS]
57
} else {
58
    set multilibs [get_multilibs]
59
}
60
 
61
proc libitm_init { args } {
62
    global srcdir blddir objdir tool_root_dir
63
    global libitm_initialized
64
    global tmpdir
65
    global blddir
66
    global gluefile wrap_flags
67
    global ALWAYS_CFLAGS
68
    global CFLAGS
69
    global TOOL_EXECUTABLE TOOL_OPTIONS
70
    global GCC_UNDER_TEST
71
    global TESTING_IN_BUILD_TREE
72
    global target_triplet
73
    global always_ld_library_path
74
 
75
    set blddir [lookfor_file [get_multilibs] libitm]
76
 
77
    # We set LC_ALL and LANG to C so that we get the same error
78
    # messages as expected.
79
    setenv LC_ALL C
80
    setenv LANG C
81
 
82
    if ![info exists GCC_UNDER_TEST] then {
83
        if [info exists TOOL_EXECUTABLE] {
84
            set GCC_UNDER_TEST $TOOL_EXECUTABLE
85
        } else {
86
            set GCC_UNDER_TEST "[find_gcc]"
87
        }
88
    }
89
 
90
    if ![info exists tmpdir] {
91
        set tmpdir "/tmp"
92
    }
93
 
94
    if [info exists gluefile] {
95
        unset gluefile
96
    }
97
 
98
    if {![info exists CFLAGS]} {
99
        set CFLAGS ""
100
    }
101
 
102
    # Locate libgcc.a so we don't need to account for different values of
103
    # SHLIB_EXT on different platforms
104
    set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
105
    if {$gccdir != ""} {
106
        set gccdir [file dirname $gccdir]
107
    }
108
 
109
    # Compute what needs to be put into LD_LIBRARY_PATH
110
    set always_ld_library_path ".:${blddir}/.libs"
111
 
112
    # Compute what needs to be added to the existing LD_LIBRARY_PATH.
113
    if {$gccdir != ""} {
114
        # Add AIX pthread directory first.
115
        if { [llength [glob -nocomplain ${gccdir}/pthread/libgcc_s*.a]] >= 1 } {
116
            append always_ld_library_path ":${gccdir}/pthread"
117
        }
118
        append always_ld_library_path ":${gccdir}"
119
        set compiler [lindex $GCC_UNDER_TEST 0]
120
 
121
        if { [is_remote host] == 0 && [which $compiler] != 0 } {
122
          foreach i "[exec $compiler --print-multi-lib]" {
123
            set mldir ""
124
            regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
125
            set mldir [string trimright $mldir "\;@"]
126
            if { "$mldir" == "." } {
127
              continue
128
            }
129
            if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
130
              append always_ld_library_path ":${gccdir}/${mldir}"
131
            }
132
          }
133
        }
134
    }
135
 
136
    set ALWAYS_CFLAGS ""
137
    if { $blddir != "" } {
138
        lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
139
        lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
140
        lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
141
    }
142
    lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
143
 
144
    # We use atomic operations in the testcases to validate results.
145
    if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
146
         && [check_effective_target_ia32] } {
147
        lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
148
    }
149
 
150
    if [istarget *-*-darwin*] {
151
        lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
152
    }
153
 
154
    if [istarget sparc*-*-*] {
155
        lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
156
    }
157
 
158
    if [info exists TOOL_OPTIONS] {
159
        lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
160
    }
161
 
162
    # Make sure that lines are not wrapped.  That can confuse the
163
    # error-message parsing machinery.
164
    lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
165
 
166
    # Turn on transactional memory support.
167
    lappend ALWAYS_CFLAGS "additional_flags=-fgnu-tm"
168
}
169
 
170
#
171
# libitm_target_compile -- compile a source file
172
#
173
 
174
proc libitm_target_compile { source dest type options } {
175
    global blddir
176
    global libitm_compile_options
177
    global gluefile wrap_flags
178
    global ALWAYS_CFLAGS
179
    global GCC_UNDER_TEST
180
    global lang_test_file
181
    global lang_library_path
182
    global lang_link_flags
183
 
184
    if { [info exists lang_test_file] } {
185
        if { $blddir != "" } {
186
            lappend options "ldflags=-L${blddir}/${lang_library_path}"
187
        }
188
        lappend options "ldflags=${lang_link_flags}"
189
    }
190
 
191
    if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
192
        lappend options "libs=${gluefile}"
193
        lappend options "ldflags=${wrap_flags}"
194
    }
195
 
196
    lappend options "additional_flags=[libio_include_flags]"
197
    lappend options "timeout=[timeout_value]"
198
    lappend options "compiler=$GCC_UNDER_TEST"
199
 
200
    set options [concat $libitm_compile_options $options]
201
 
202
    if [info exists ALWAYS_CFLAGS] {
203
        set options [concat "$ALWAYS_CFLAGS" $options]
204
    }
205
 
206
    set options [dg-additional-files-options $options $source]
207
 
208
    set result [target_compile $source $dest $type $options]
209
 
210
    return $result
211
}
212
 
213
proc libitm_option_help { } {
214
    send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
215
}
216
 
217
proc libitm_option_proc { option } {
218
    if [regexp "^--additional_options," $option] {
219
        global libitm_compile_options
220
        regsub "--additional_options," $option "" option
221
        foreach x [split $option ","] {
222
            lappend libitm_compile_options "additional_flags=$x"
223
        }
224
        return 1
225
    } else {
226
        return 0
227
    }
228
}

powered by: WebSVN 2.1.0

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