#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# This file was written by Rob Savoye (rob@cygnus.com)
# Currently maintained by James A. Morrison (ja2morri@uwaterloo.ca)
# Having this file here magically tells dejagnu that the treelang
# directory is worthy of testing
-# This file is basically treelang.exp with treelang replaced with treelang.
+# This file is basically gcc.exp with gcc replaced with treelang.
# This file is loaded by the tool init file (eg: unix.exp). It provides
-# default definitions for treelang_start, etc. and other supporting cast members.
+# default definitions for treelang_start, etc. and other supporting cast
+# members.
-# These globals are used by treelang_start if no compiler arguments are provided.
-# They are also used by the various testsuites to define the environment:
-# where to find stdio.h, libc.a, etc.
+# These globals are used by treelang_start if no compiler arguments are
+# provided. They are also used by the various testsuites to define the
+# environment: where to find stdio.h, libc.a, etc.
load_lib libgloss.exp
load_lib prune.exp
load_lib gcc-defs.exp
+load_lib target-libpath.exp
#
# TREELANG_UNDER_TEST is the compiler under test.
proc default_treelang_version { } {
global TREELANG_UNDER_TEST
- treelang_init;
+ treelang_init
# ignore any arguments after the command
set compiler [lindex $TREELANG_UNDER_TEST 0]
if ![is_remote host] {
- set compiler_name [which $compiler];
+ set compiler_name [which $compiler]
} else {
- set compiler_name $compiler;
+ set compiler_name $compiler
}
# verify that the compiler exists
if { $compiler_name != 0 } then {
set tmp [remote_exec host "$compiler -v"]
- set status [lindex $tmp 0];
- set output [lindex $tmp 1];
+ set status [lindex $tmp 0]
+ set output [lindex $tmp 1]
regexp " version \[^\n\r\]*" $output version
if { $status == 0 && [info exists version] } then {
clone_output "$compiler_name $version\n"
set treelang_initialized 0
proc treelang_init { args } {
- global rootme
global tmpdir
global libdir
global gluefile wrap_flags
if ![info exists TREELANG_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
- set TREELANG_UNDER_TEST $TOOL_EXECUTABLE;
+ set TREELANG_UNDER_TEST $TOOL_EXECUTABLE
} else {
set TREELANG_UNDER_TEST [find_gcc]
}
treelang_maybe_build_wrapper "${tmpdir}/treelang-testglue.o"
- set treelang_libgcc_s_path "${rootme}"
- set compiler [lindex $TREELANG_UNDER_TEST 0]
- if { [is_remote host] == 0 && [which $compiler] != 0 } {
- foreach i "[exec $compiler --print-multi-lib]" {
- set mldir ""
- regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
- set mldir [string trimright $mldir "\;@"]
- if { "$mldir" == "." } {
- continue
- }
- if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
- append treelang_libgcc_s_path ":${rootme}/${mldir}"
- }
- }
- }
+ set treelang_libgcc_s_path \
+ [gcc-set-multilib-library-path $TREELANG_UNDER_TEST]
}
proc treelang_target_compile { source dest type options } {
- global rootme;
- global tmpdir;
- global gluefile wrap_flags;
+ global rootme
+ global tmpdir
+ global gluefile wrap_flags
global srcdir
global TREELANG_UNDER_TEST
global TOOL_OPTIONS
global treelang_libgcc_s_path
set ld_library_path ".:${treelang_libgcc_s_path}"
- lappend options "libs=-ltreelang"
+ set_ld_library_path_env_vars
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
lappend options "libs=${gluefile}"
# TOOL_OPTIONS must come first, so that it doesn't override testcase
# specific options.
if [info exists TOOL_OPTIONS] {
- set options [concat "additional_flags=$TOOL_OPTIONS" $options];
+ set options [concat "{additional_flags=$TOOL_OPTIONS}" $options]
}
# If we have built libtreelang along with the compiler (which usually
proc treelang_finish { } {
# The testing harness apparently requires this.
- global errorInfo;
+ global errorInfo
if [info exists errorInfo] then {
unset errorInfo
}
proc treelang_exit { } {
- global gluefile;
+ global gluefile
if [info exists gluefile] {
- file_on_build delete $gluefile;
- unset gluefile;
+ file_on_build delete $gluefile
+ unset gluefile
}
}