diff options
author | Tom Tromey <tromey@adacore.com> | 2020-06-19 07:52:43 -0600 |
---|---|---|
committer | Jacob Bachmeyer <jcb62281+dev@gmail.com> | 2020-06-20 21:59:48 -0500 |
commit | c8beff4a084334f07d03bb1165238147636eb7c8 (patch) | |
tree | 5b4ce4699f5b9e54508f5186ddee750b978088c3 /lib/target.exp | |
parent | 57edff84aa64cd73600491335f734e83151d39f3 (diff) | |
download | dejagnu-c8beff4a084334f07d03bb1165238147636eb7c8.zip dejagnu-c8beff4a084334f07d03bb1165238147636eb7c8.tar.gz dejagnu-c8beff4a084334f07d03bb1165238147636eb7c8.tar.bz2 |
Add Rust support to default_target_compile
This adds support for the Rust language to default_target_compile.
This comes from a gdb patch:
commit 67218854b1987d89593ccaf5feaf5b29b1b976f2
Author: Tom Tromey <tom@tromey.com>
Date: Tue Apr 26 19:38:43 2016 -0600
Update gdb test suite for Rust
[...]
2016-05-17 Tom Tromey <tom@tromey.com>
Manish Goregaokar <manishsmail@gmail.com>
Diffstat (limited to 'lib/target.exp')
-rw-r--r-- | lib/target.exp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/target.exp b/lib/target.exp index c98fbd0..132c1a3 100644 --- a/lib/target.exp +++ b/lib/target.exp @@ -400,6 +400,18 @@ proc default_target_compile {source destfile type options} { } } + if { $i eq "rust" } { + set compiler_type "rust" + if {[board_info $dest exists rustflags]} { + append add_flags " [board_info $dest rustflags]" + } + if {[board_info $dest exists rustcompiler]} { + set compiler [board_info $dest rustcompiler] + } else { + set compiler [find_rustc] + } + } + if {[regexp "^dest=" $i]} { regsub "^dest=" $i "" tmp if {[board_info $tmp exists name]} { @@ -460,6 +472,7 @@ proc default_target_compile {source destfile type options} { global F77_FOR_TARGET global F90_FOR_TARGET global GNATMAKE_FOR_TARGET + global RUSTC_FOR_TARGET if {[info exists GNATMAKE_FOR_TARGET]} { if { $compiler_type eq "ada" } { @@ -497,6 +510,12 @@ proc default_target_compile {source destfile type options} { } } + if {[info exists RUSTC_FOR_TARGET]} { + if {$compiler_type eq "rust"} { + set compiler $RUSTC_FOR_TARGET + } + } + if { $compiler eq "" } { if { [board_info $dest exists compiler] } { set compiler [board_info $dest compiler] @@ -515,7 +534,11 @@ proc default_target_compile {source destfile type options} { } if {$type eq "object"} { - append add_flags " -c" + if {$compiler_type eq "rust"} { + append add_flags "--emit obj" + } else { + append add_flags " -c" + } } if { $type eq "preprocess" } { |