1 # Damn dejagnu
for not having proper library search paths
for load_lib.
2 # We have to explicitly
load everything that gcc
-dg.exp wants to
load.
4 proc load_gcc_lib
{ filename
} {
5 global srcdir loaded_libs
7 load_file $srcdir
/..
/..
/gcc
/testsuite
/lib
/$filename
8 set loaded_libs
($filename
) ""
13 # Required to use gcc
-dg.exp
- however
, the latter should NOT be
14 # loaded until $
{tool
}_target_compile is defined since it uses that
15 # to determine default LTO options.
17 load_gcc_lib prune.exp
18 load_gcc_lib target
-libpath.exp
19 load_gcc_lib wrapper.exp
20 load_gcc_lib gcc
-defs.exp
21 load_gcc_lib timeout.exp
22 load_gcc_lib target
-supports.exp
23 load_gcc_lib file
-format.exp
24 load_gcc_lib target
-supports
-dg.exp
25 load_gcc_lib scanasm.exp
26 load_gcc_lib scandump.exp
27 load_gcc_lib scanrtl.exp
28 load_gcc_lib scantree.exp
29 load_gcc_lib scanipa.exp
30 load_gcc_lib timeout
-dg.exp
31 load_gcc_lib torture
-options.exp
32 load_gcc_lib fortran
-modules.exp
34 set dg
-do-what
-default run
37 # GCC_UNDER_TEST is the compiler under test.
40 set libgomp_compile_options
""
46 if [info exists TOOL_OPTIONS
] {
47 set multilibs
[get_multilibs $TOOL_OPTIONS
]
49 set multilibs
[get_multilibs
]
52 proc libgomp_init
{ args } {
53 global srcdir blddir objdir tool_root_dir
54 global libgomp_initialized
57 global gluefile wrap_flags
60 global TOOL_EXECUTABLE TOOL_OPTIONS
62 global TESTING_IN_BUILD_TREE
64 global always_ld_library_path
66 set blddir
[lookfor_file
[get_multilibs
] libgomp
]
68 # We
set LC_ALL and LANG to C so that we
get the same error
69 # messages as expected.
73 # Many hosts now default to a non
-ASCII C locale
, however
, so
74 # they can
set a
charset encoding here
if they need.
75 if { [ishost
"*-*-cygwin*"] } {
80 if ![info exists GCC_UNDER_TEST
] then {
81 if [info exists TOOL_EXECUTABLE
] {
82 set GCC_UNDER_TEST $TOOL_EXECUTABLE
84 set GCC_UNDER_TEST
"[find_gcc]"
88 if ![info exists tmpdir
] {
92 if [info exists gluefile
] {
96 if {![info exists CFLAGS
]} {
100 # Locate libgcc.a so we don
't need to account for different values of
101 # SHLIB_EXT on different platforms
102 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
104 set gccdir [file dirname $gccdir]
107 # Compute what needs to be put into LD_LIBRARY_PATH
108 set always_ld_library_path ".:${blddir}/.libs"
110 # Compute what needs to be added to the existing LD_LIBRARY_PATH.
112 # Add AIX pthread directory first.
113 if { [llength [glob -nocomplain ${gccdir}/pthread/libgcc_s*.a]] >= 1 } {
114 append always_ld_library_path ":${gccdir}/pthread"
116 append always_ld_library_path ":${gccdir}"
117 set compiler [lindex $GCC_UNDER_TEST 0]
119 if { [is_remote host] == 0 && [which $compiler] != 0 } {
120 foreach i "[exec $compiler --print-multi-lib]" {
122 regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
123 set mldir [string trimright $mldir "\;@"]
124 if { "$mldir" == "." } {
127 if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
128 append always_ld_library_path ":${gccdir}/${mldir}"
135 if { $blddir != "" } {
136 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
137 # targets that use libgomp.a%s in their specs need a -B option
138 # for uninstalled testing.
139 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
140 lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
141 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
143 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
145 # We use atomic operations in the testcases to validate results.
146 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
147 && [check_effective_target_ia32] } {
148 lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
151 if [istarget *-*-darwin*] {
152 lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
155 if [istarget sparc*-*-*] {
156 lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
159 if [info exists TOOL_OPTIONS] {
160 lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
163 # Make sure that lines are not wrapped. That can confuse the
164 # error-message parsing machinery.
165 lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
168 lappend ALWAYS_CFLAGS "additional_flags=-fno-diagnostics-show-caret"
170 # Disable color diagnostics
171 lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
175 # libgomp_target_compile -- compile a source file
178 proc libgomp_target_compile { source dest type options } {
180 global libgomp_compile_options
181 global gluefile wrap_flags
183 global GCC_UNDER_TEST
184 global lang_test_file
185 global lang_library_path
186 global lang_link_flags
187 global lang_include_flags
188 global lang_source_re
190 if { [info exists lang_test_file] } {
191 if { $blddir != "" } {
192 # Some targets use libgfortran.a%s in their specs, so they need
193 # a -B option for uninstalled testing.
194 lappend options "additional_flags=-B${blddir}/${lang_library_path}"
195 lappend options "ldflags=-L${blddir}/${lang_library_path}"
197 lappend options "ldflags=${lang_link_flags}"
198 if { [info exists lang_include_flags] \
199 && [regexp ${lang_source_re} ${source}] } {
200 lappend options "additional_flags=${lang_include_flags}"
204 if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
205 lappend options "libs=${gluefile}"
206 lappend options "ldflags=${wrap_flags}"
209 lappend options "additional_flags=[libio_include_flags]"
210 lappend options "timeout=[timeout_value]"
211 lappend options "compiler=$GCC_UNDER_TEST"
213 set options [concat $libgomp_compile_options $options]
215 if [info exists ALWAYS_CFLAGS] {
216 set options [concat "$ALWAYS_CFLAGS" $options]
219 set options [dg-additional-files-options $options $source]
221 set result [target_compile $source $dest $type $options]
226 proc libgomp_option_help { } {
227 send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
230 proc libgomp_option_proc { option } {
231 if [regexp "^--additional_options," $option] {
232 global libgomp_compile_options
233 regsub "--additional_options," $option "" option
234 foreach x [split $option ","] {
235 lappend libgomp_compile_options "additional_flags=$x"