diff options
author | Tom Tromey <tromey@adacore.com> | 2020-06-19 07:52:44 -0600 |
---|---|---|
committer | Jacob Bachmeyer <jcb62281+dev@gmail.com> | 2020-06-20 21:59:48 -0500 |
commit | 2e88e03ad0fd49faf09106a39d307116aaf7f4a7 (patch) | |
tree | c1e9dfb7796fda868a33843f61dc273a5c2f1b10 | |
parent | c8beff4a084334f07d03bb1165238147636eb7c8 (diff) | |
download | dejagnu-2e88e03ad0fd49faf09106a39d307116aaf7f4a7.zip dejagnu-2e88e03ad0fd49faf09106a39d307116aaf7f4a7.tar.gz dejagnu-2e88e03ad0fd49faf09106a39d307116aaf7f4a7.tar.bz2 |
Add Go support to default_target_compile
This adds Go support to default_target_compile. This comes from this
gdb patch:
commit a766d390bb857383a5f9ae80a102e1f8705f4c2e
Author: Doug Evans <dje@google.com>
Date: Wed Apr 25 14:07:23 2012 +0000
Initial pass at Go language support.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | doc/dejagnu.texi | 8 | ||||
-rw-r--r-- | lib/libgloss.exp | 24 | ||||
-rw-r--r-- | lib/target.exp | 31 |
4 files changed, 70 insertions, 0 deletions
@@ -1,5 +1,12 @@ 2020-06-19 Tom Tromey <tromey@adacore.com> + * doc/dejagnu.texi (target_compile procedure): Document Go + additions. + * lib/target.exp (default_target_compile): Handle Go. + * lib/libgloss.exp (find_go, find_go_linker): New procs. + +2020-06-19 Tom Tromey <tromey@adacore.com> + * doc/dejagnu.texi (target_compile procedure): Document rust additions. * lib/target.exp (default_target_compile): Handle rust. diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi index 5052497..f69a9c9 100644 --- a/doc/dejagnu.texi +++ b/doc/dejagnu.texi @@ -4564,6 +4564,8 @@ Use a compiler for the D language. Use a compiler for Fortran 77. @item f90 Use a compiler for Fortran 90. +@item go +Use a compiler for Go. @item rust Use a compiler for Rust. @end table @@ -4672,6 +4674,12 @@ compiler will be used and the @code{compiler} option ignored. @item F90_FOR_TARGET Override Fortran 90 compiler. If the @code{f90} option is given, this compiler will be used and the @code{compiler} option ignored. +@item GO_FOR_TARGET +Override Go compiler. If the @code{go} option is given, this +compiler will be used and the @code{compiler} option ignored. +@item GO_LD_FOR_TARGET +Override Go linker. If the @code{go} option is given, this +linker will be used. @item RUSTC_FOR_TARGET Override Rust compiler. If the @code{rust} option is given, this compiler will be used and the @code{compiler} option ignored. diff --git a/lib/libgloss.exp b/lib/libgloss.exp index 522e864..8e8a9ce 100644 --- a/lib/libgloss.exp +++ b/lib/libgloss.exp @@ -765,6 +765,30 @@ proc find_gnatmake {} { return $CC } +proc find_go {} { + global tool_root_dir + + set GO "" + + if {![is_remote host]} { + set file [lookfor_file $tool_root_dir gccgo] + if { $file ne "" } { + set root [file dirname $file] + set GO "$file -B$root/gcc/" + } + } + + if { $GO eq "" } { + set GO [transform gccgo] + } + + return $GO +} + +proc find_go_linker {} { + return [find_go] +} + proc find_rustc {} { global tool_root_dir if {![is_remote host]} { diff --git a/lib/target.exp b/lib/target.exp index 132c1a3..57f3b3a 100644 --- a/lib/target.exp +++ b/lib/target.exp @@ -400,6 +400,26 @@ proc default_target_compile {source destfile type options} { } } + if { $i eq "go" } { + set compiler_type "go" + if {[board_info $dest exists goflags]} { + append add_flags " [board_info $dest goflags]" + } + if {[board_info $dest exists gocompiler]} { + set compiler [board_info $dest gocompiler] + } else { + set compiler [find_go] + } + if {[board_info $dest exists golinker]} { + set linker [board_info $dest golinker] + } else { + set linker [find_go_linker] + } + if {[board_info $dest exists golinker_opts_order]} { + set linker_opts_order [board_info $dest golinker_opts_order] + } + } + if { $i eq "rust" } { set compiler_type "rust" if {[board_info $dest exists rustflags]} { @@ -472,6 +492,8 @@ proc default_target_compile {source destfile type options} { global F77_FOR_TARGET global F90_FOR_TARGET global GNATMAKE_FOR_TARGET + global GO_FOR_TARGET + global GO_LD_FOR_TARGET global RUSTC_FOR_TARGET if {[info exists GNATMAKE_FOR_TARGET]} { @@ -510,6 +532,15 @@ proc default_target_compile {source destfile type options} { } } + if { $compiler_type eq "go" } { + if {[info exists GO_FOR_TARGET]} { + set compiler $GO_FOR_TARGET + } + if {[info exists GO_LD_FOR_TARGET]} { + set linker $GO_LD_FOR_TARGET + } + } + if {[info exists RUSTC_FOR_TARGET]} { if {$compiler_type eq "rust"} { set compiler $RUSTC_FOR_TARGET |