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) ""
12 load_gcc_lib file-format.exp
13 load_gcc_lib target-supports.exp
14 load_gcc_lib target-supports-dg.exp
15 load_gcc_lib scanasm.exp
16 load_gcc_lib scandump.exp
17 load_gcc_lib scantree.exp
18 load_gcc_lib scanipa.exp
19 load_gcc_lib prune.exp
20 load_gcc_lib target-libpath.exp
21 load_gcc_lib wrapper.exp
22 load_gcc_lib gcc-defs.exp
23 load_gcc_lib gcc-dg.exp
24 load_gcc_lib gfortran-dg.exp
26 set dg-do-what-default run
29 # GCC_UNDER_TEST is the compiler under test.
32 set libgomp_compile_options ""
35 # libgomp_init -- This gets run more than it should be....
38 if [info exists TOOL_OPTIONS] {
39 set multilibs [get_multilibs $TOOL_OPTIONS]
41 set multilibs [get_multilibs]
43 set blddir [lookfor_file $multilibs libgomp]
45 proc libgomp_init { args } {
46 global srcdir blddir objdir tool_root_dir
47 global libgomp_initialized
49 global gluefile wrap_flags
52 global TOOL_EXECUTABLE TOOL_OPTIONS
54 global TESTING_IN_BUILD_TREE
56 global ld_library_path
58 global lang_library_path
59 global lang_link_flags
61 # We set LC_ALL and LANG to C so that we get the same error
62 # messages as expected.
66 if ![info exists GCC_UNDER_TEST] then {
67 if [info exists TOOL_EXECUTABLE] {
68 set GCC_UNDER_TEST $TOOL_EXECUTABLE
70 set GCC_UNDER_TEST "[find_gcc]"
74 if ![info exists tmpdir] {
78 if [info exists gluefile] {
82 if {![info exists CFLAGS]} {
86 # Locate libgcc.a so we don't need to account for different values of
87 # SHLIB_EXT on different platforms
88 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
90 set gccdir [file dirname $gccdir]
93 # Compute what needs to be put into LD_LIBRARY_PATH
94 set ld_library_path ".:${blddir}/.libs"
97 append ld_library_path ":${gccdir}"
100 if { [info exists lang_test_file] && [file exists "${blddir}/"] } {
101 append ld_library_path ":${blddir}/${lang_library_path}"
103 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
104 set_ld_library_path_env_vars
107 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
108 lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
109 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
110 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs -lgomp"
111 if { [info exists lang_test_file] && [file exists "${blddir}/"] } {
112 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${lang_library_path} ${lang_link_flags}"
115 # We use atomic operations in the testcases to validate results.
116 if [istarget i?86-*-*] {
117 lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
119 if [istarget sparc*-*-*] {
120 lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
123 if [info exists TOOL_OPTIONS] {
124 lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
127 # Make sure that lines are not wrapped. That can confuse the
128 # error-message parsing machinery.
129 lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
131 # And, gee, turn on OpenMP.
132 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
136 # libgomp_target_compile -- compile a source file
139 proc libgomp_target_compile { source dest type options } {
141 global libgomp_compile_options
142 global gluefile wrap_flags
144 global GCC_UNDER_TEST
148 if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
149 lappend options "libs=${gluefile}"
150 lappend options "ldflags=${wrap_flags}"
153 lappend options "additional_flags=[libio_include_flags]"
154 lappend options "compiler=$GCC_UNDER_TEST"
156 set options [concat $libgomp_compile_options $options]
158 set options [concat "$ALWAYS_CFLAGS" $options]
160 set options [dg-additional-files-options $options $source]
162 set result [target_compile $source $dest $type $options]
167 # ??? The same as in standard.exp. Why doesn't anyone else have to
170 proc libgomp_load { program args } {
171 if { [llength $args] > 0 } {
172 set program_args [lindex $args 0]
177 if { [llength $args] > 1 } {
178 set input_file [lindex $args 1]
182 return [remote_load target $program $program_args $input_file]
185 proc libgomp_option_help { } {
186 send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
189 proc libgomp_option_proc { option } {
190 if [regexp "^--additional_options," $option] {
191 global libgomp_compile_options
192 regsub "--additional_options," $option "" option
193 foreach x [split $option ","] {
194 lappend libgomp_compile_options "additional_flags=$x"
202 proc libgomp-dg-test { prog do_what extra_tool_flags } {
203 return [gcc-dg-test-1 libgomp_target_compile $prog $do_what $extra_tool_flags]
206 proc libgomp-dg-prune { system text } {
207 return [gcc-dg-prune $system $text]