[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/3] Merge in gdb default_target_compile changes
From: |
Jacob Bachmeyer |
Subject: |
Re: [PATCH 0/3] Merge in gdb default_target_compile changes |
Date: |
Mon, 22 Jun 2020 19:06:27 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090807 MultiZilla/1.8.3.4e SeaMonkey/1.1.17 Mnenhy/0.7.6.0 |
Tom Tromey wrote:
This series merges in gdb's changes to default_target_compile,
updating them to follow newer conventions at the same time.
While integrating these patches and writing tests, I found a few issues,
fixed in the attached patches, which are posted here for review. I have
these in Git and will be pushing the branch after basic acceptance
tests, in progress as of this writing, complete. Assuming that the
tests pass and I do not have to rework these patches, I expect to push
the branch later this evening.
-- Jacob
>From 26de73569e64b6a0e37d35541032f205095fb7c6 Mon Sep 17 00:00:00 2001
From: Jacob Bachmeyer <jcb62281+dev@gmail.com>
Date: Sat, 20 Jun 2020 23:19:20 -0500
Subject: [PATCH 4/8] Document find_* procedures imported from GDB testsuite
---
ChangeLog | 6 ++++++
doc/dejagnu.texi | 47 +++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 13a8266..3c45036 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-06-20 Jacob Bachmeyer <jcb62281+dev@gmail.com>
+
+ * doc/dejagnu.texi (Libgloss): Update menu.
+ (find_go procedure, find_go_linker procedure): New nodes.
+ (find_rustc procedure): New node.
+
2020-06-19 Tom Tromey <tromey@adacore.com>
* doc/dejagnu.texi (target_compile procedure): Document Go
diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi
index f69a9c9..3e68f19 100644
--- a/doc/dejagnu.texi
+++ b/doc/dejagnu.texi
@@ -5288,6 +5288,9 @@ systems.
* find_g++ Procedure: find_g++ procedure
* find_g77 Procedure: find_g77 procedure
* find_gfortran Procedure: find_gfortran procedure
+* find_go Procedure: find_go procedure
+* find_go_linker Procedure: find_go_linker procedure
+* find_rustc Procedure: find_rustc procedure
* process_multilib_options Procedure: process_multilib_options procedure
* add_multilib_option Procedure: add_multilib_option procedure
* find_gas Procedure: find_gas procedure
@@ -5527,7 +5530,7 @@ for a cross-compiler if the build tree is configured for
one.
@t{@b{find_g77}}
@end quotation
-@node find_gfortran procedure, process_multilib_options procedure, find_g77
procedure, Libgloss
+@node find_gfortran procedure, find_go procedure, find_g77 procedure, Libgloss
@subsubheading find_gfortran Procedure
@findex find_gfortran
@@ -5539,7 +5542,46 @@ for a cross-compiler if the build tree is configured for
one.
@t{@b{find_gfortran}}
@end quotation
-@node process_multilib_options procedure, add_multilib_option procedure,
find_gfortran procedure, Libgloss
+@node find_go procedure, find_go_linker procedure, find_gfortran procedure,
Libgloss
+@subsubheading find_go Procedure
+@findex find_go
+
+Looks for a copy of the GNU compiler for the Go language in the build
+tree and in the @code{PATH}. This will also return the proper
+transformed name for a cross-compiler if the build tree is configured
+for one.
+
+@quotation
+@t{@b{find_go}}
+@end quotation
+
+@node find_go_linker procedure, find_rustc procedure, find_go procedure,
Libgloss
+@subsubheading find_go_linker Procedure
+@findex find_go_linker
+
+Looks for a copy of the special linker associated with the GNU
+compiler for the Go language in the build tree and in the @code{PATH}.
+This will also return the proper transformed name for a cross-compiler
+if the build tree is configured for one.
+
+@quotation
+@t{@b{find_go_linker}}
+@end quotation
+
+@node find_rustc procedure, process_multilib_options procedure, find_go_linker
procedure, Libgloss
+@subsubheading find_rustc Procedure
+@findex find_rustc
+
+Looks for a copy of a compiler for the Rust language in the build tree
+and in the @code{PATH}. The Rust compiler is different and this
+procedure also ensures that it will be called with options to suppress
+output coloration.
+
+@quotation
+@t{@b{find_rustc}}
+@end quotation
+
+@node process_multilib_options procedure, add_multilib_option procedure,
find_rustc procedure, Libgloss
@subsubheading process_multilib_options Procedure
@findex process_multilib_options
@@ -5856,3 +5898,4 @@ This makes @code{runtest} exit. Abbreviation: @kbd{q}.
@c LocalWords: subdirectory prepend prepended testsuite filename Expect's svn
@c LocalWords: DejaGnu CVS RCS SCCS prepending subcommands Tcl Awk Readline
@c LocalWords: POSIX KFAIL KPASS XFAIL XPASS hostname multitable gfortran
+@c LocalWords: rustc
--
1.7.4.1
>From 3a4313df675a83e598bcb8fcfacf8761fe997db5 Mon Sep 17 00:00:00 2001
From: Jacob Bachmeyer <jcb62281+dev@gmail.com>
Date: Mon, 22 Jun 2020 18:24:10 -0500
Subject: [PATCH 5/8] Fix up upstreamed GDB testsuite patches
---
ChangeLog | 9 +++++++++
lib/target.exp | 13 +++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3c45036..8bc1dde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-06-22 Jacob Bachmeyer <jcb62281+dev@gmail.com>
+
+ * lib/target.exp (default_target_compile): Actually use internal
+ option for separate linker provided for Go language support. This
+ seems to have been accidentally omitted from Tom Tromey's patches.
+ (default_target_compile): Ensure that "--emit obj" is spaced from
+ previous item when used to compile Rust. Use "--emit asm" instead
+ of "-S" when generating assembly from Rust sources.
+
2020-06-20 Jacob Bachmeyer <jcb62281+dev@gmail.com>
* doc/dejagnu.texi (Libgloss): Update menu.
diff --git a/lib/target.exp b/lib/target.exp
index 57f3b3a..627f07f 100644
--- a/lib/target.exp
+++ b/lib/target.exp
@@ -320,6 +320,7 @@ proc default_target_compile {source destfile type options} {
set libs ""
set compiler_type "c"
set compiler ""
+ set linker ""
set ldflags ""
set dest [target_info name]
@@ -547,6 +548,10 @@ proc default_target_compile {source destfile type options}
{
}
}
+ if { $type eq "executable" && $linker ne "" } {
+ set compiler $linker
+ }
+
if { $compiler eq "" } {
if { [board_info $dest exists compiler] } {
set compiler [board_info $dest compiler]
@@ -566,7 +571,7 @@ proc default_target_compile {source destfile type options} {
if {$type eq "object"} {
if {$compiler_type eq "rust"} {
- append add_flags "--emit obj"
+ append add_flags " --emit obj"
} else {
append add_flags " -c"
}
@@ -577,7 +582,11 @@ proc default_target_compile {source destfile type options}
{
}
if { $type eq "assembly" } {
- append add_flags " -S"
+ if {$compiler_type eq "rust"} {
+ append add_flags " --emit asm"
+ } else {
+ append add_flags " -S"
+ }
}
if {[board_info $dest exists cflags]} {
--
1.7.4.1
>From a641e4899fbde3cfe8e0611542be2742818adc12 Mon Sep 17 00:00:00 2001
From: Jacob Bachmeyer <jcb62281+dev@gmail.com>
Date: Mon, 22 Jun 2020 18:25:30 -0500
Subject: [PATCH 6/8] Add "linker=" option to target_compile to support testing
---
ChangeLog | 6 ++++++
doc/dejagnu.texi | 5 ++++-
lib/target.exp | 12 ++++++++----
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8bc1dde..a87496e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,14 @@
2020-06-22 Jacob Bachmeyer <jcb62281+dev@gmail.com>
+ * doc/dejagnu.texi (target_compile procedure): Document new
+ "linker=" option to target_compile.
+
* lib/target.exp (default_target_compile): Actually use internal
option for separate linker provided for Go language support. This
seems to have been accidentally omitted from Tom Tromey's patches.
+ (default_target_compile): Add "linker=" option, similar to
+ "compiler=" option, but the former overrides the latter when
+ building an executable.
(default_target_compile): Ensure that "--emit obj" is spaced from
previous item when used to compile Rust. Use "--emit asm" instead
of "-S" when generating assembly from Rust sources.
diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi
index 3e68f19..fa03a07 100644
--- a/doc/dejagnu.texi
+++ b/doc/dejagnu.texi
@@ -4599,6 +4599,9 @@ this option is given multiple times, only the last use is
significant.
@item compiler=@var{command}
Override the defaults and use @var{command} as the compiler. If
this option is given multiple times, only the last use is significant.
+@item linker=@var{command}
+Override the defaults and use @var{command} to build executables. If
+this option is given multiple times, only the last use is significant.
@item early_flags=@var{flags}
Prepend @var{flags} to the set of arguments to be passed to the compiler.
Multiple uses of this option specify additional arguments.
@@ -5898,4 +5901,4 @@ This makes @code{runtest} exit. Abbreviation: @kbd{q}.
@c LocalWords: subdirectory prepend prepended testsuite filename Expect's svn
@c LocalWords: DejaGnu CVS RCS SCCS prepending subcommands Tcl Awk Readline
@c LocalWords: POSIX KFAIL KPASS XFAIL XPASS hostname multitable gfortran
-@c LocalWords: rustc
+@c LocalWords: rustc executables
diff --git a/lib/target.exp b/lib/target.exp
index 627f07f..30f6eb3 100644
--- a/lib/target.exp
+++ b/lib/target.exp
@@ -312,15 +312,15 @@ proc default_target_compile {source destfile type
options} {
}
set early_flags ""
- # linker_opts_order is one of "sources-then-flags", "flags-then-sources".
- # The order matters for things like -Wl,--as-needed. The default is to
- # preserve existing behavior.
- set linker_opts_order "sources-then-flags"
set add_flags ""
set libs ""
set compiler_type "c"
set compiler ""
set linker ""
+ # linker_opts_order is one of "sources-then-flags", "flags-then-sources".
+ # The order matters for things like -Wl,--as-needed. The default is to
+ # preserve existing behavior.
+ set linker_opts_order "sources-then-flags"
set ldflags ""
set dest [target_info name]
@@ -445,6 +445,10 @@ proc default_target_compile {source destfile type options}
{
regsub "^compiler=" $i "" tmp
set compiler $tmp
}
+ if {[regexp "^linker=" $i]} {
+ regsub "^linker=" $i "" tmp
+ set linker $tmp
+ }
if {[regexp "^early_flags=" $i]} {
regsub "^early_flags=" $i "" tmp
append early_flags " $tmp"
--
1.7.4.1
>From 862a6a5af79dd76f9dc32baefaebe6b1e551d2c5 Mon Sep 17 00:00:00 2001
From: Jacob Bachmeyer <jcb62281+dev@gmail.com>
Date: Mon, 22 Jun 2020 18:26:48 -0500
Subject: [PATCH 7/8] Add tests for new features in default_target_compile
---
ChangeLog | 3 +
testsuite/runtest.libs/target.test | 319 +++++++++++++++++++++++++++++++++++-
2 files changed, 319 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a87496e..58a1201 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@
previous item when used to compile Rust. Use "--emit asm" instead
of "-S" when generating assembly from Rust sources.
+ * testsuite/runtest.libs/target.test: Add tests for Go and Rust.
+ Also add tests for the new "early_flags=" and "linker=" options.
+
2020-06-20 Jacob Bachmeyer <jcb62281+dev@gmail.com>
* doc/dejagnu.texi (Libgloss): Update menu.
diff --git a/testsuite/runtest.libs/target.test
b/testsuite/runtest.libs/target.test
index 629637f..11d32ba 100644
--- a/testsuite/runtest.libs/target.test
+++ b/testsuite/runtest.libs/target.test
@@ -106,7 +106,8 @@ create_test_interpreter compile_test {
}
}
# mock find_* procedures from libgloss.exp
-foreach { prog } { gcc gcj g++ gdc g77 gfortran gnatmake nm gas ld } {
+foreach { prog } { gcc gcj g++ gdc g77 gfortran go go_linker rustc gnatmake
+ nm gas ld } {
establish_mock compile_test find_$prog {} [list found-$prog]
}
@@ -205,6 +206,39 @@ eval_tests compile_test {
"remote_exec host" U { 2 {found-gcc foo.c -g -lm -Tidp.ld -o foo} }
}
}
+
+ { "minimal simple preprocess with early flags"
+ { default_target_compile "foo.c" "" preprocess {
+ "early_flags=-fearly"
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {found-gcc -fearly foo.c -E} }
+ }
+ }
+ { "minimal simple compile to assembly with early flags"
+ { default_target_compile "foo.c" "foo.s" assembly {
+ "early_flags=-fearly"
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {found-gcc -fearly foo.c -S -o foo.s} }
+ }
+ }
+ { "minimal simple compile to object with early flags"
+ { default_target_compile "foo.c" "foo.o" object {
+ "early_flags=-fearly"
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {found-gcc -fearly -c -o foo.o foo.c} }
+ }
+ }
+ { "minimal simple compile and link with early flags"
+ { default_target_compile "foo.c" "foo" executable {
+ "early_flags=-fearly"
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {found-gcc -fearly foo.c -lm -Tidp.ld -o
foo} }
+ }
+ }
}
# add more keys to the board_info array for a more complex target description
@@ -447,6 +481,30 @@ eval_tests compile_test {
{ 2 {host-gcc foo.c -lm -Tmvme.ld -o foo} }
}
}
+ { "override destination to host and compile and link with host-gcc via
linker"
+ { default_target_compile "foo.c" "foo" executable {
+ "dest=host" "linker=host-gcc"
+ } }
+ check_calls {
+ "find_gcc" ! {}
+ "board_info host" * { 2 exists 3 name }
+ "board_info host" * { 2 name }
+ "remote_exec host" U
+ { 2 {host-gcc foo.c -lm -Tmvme.ld -o foo} }
+ }
+ }
+ { "override destination to host and compile and link with host-gcc-ld via
linker"
+ { default_target_compile "foo.c" "foo" executable {
+ "dest=host" "compiler=host-gcc" "linker=host-gcc-ld"
+ } }
+ check_calls {
+ "find_gcc" ! {}
+ "board_info host" * { 2 exists 3 name }
+ "board_info host" * { 2 name }
+ "remote_exec host" U
+ { 2 {host-gcc-ld foo.c -lm -Tmvme.ld -o foo} }
+ }
+ }
{ "override ldscript"
{ default_target_compile "foo.c" "foo" executable {
"ldscript=-Tspecial.ld"
@@ -605,9 +663,12 @@ set board_info(idp,cxxflags) "-fgnu-c++"
set board_info(idp,dflags) "-fdflag"
set board_info(idp,f77flags) "-flong-f77-flag"
set board_info(idp,f90flags) "-flonger-f90-flag"
+set board_info(idp,goflags) "-fgo"
+set board_info(idp,rustflags) "-frust"
foreach {k v} {
- gnatmake gnatmake c++compiler g++ dcompiler gdc
- f77compiler g77 f90compiler gfortran
+ gnatmake gnatmake c++compiler g++ dcompiler gdc
+ f77compiler g77 f90compiler gfortran rustcompiler rustc
+ gocompiler gccgo golinker gccgo-ld
} { set board_info(idp,$k) "$board_info(idp,config)-$v" }
eval_tests compile_test {
@@ -1173,6 +1234,258 @@ eval_tests compile_test {
}
}
+ # Go
+ { "preprocess Go with target compiler"
+ { default_target_compile "foo.go" "" preprocess {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-gccgo foo.go -midp -fgo
+ -E -I/usr/gnemul/idp/include} }
+ }
+ }
+ { "compile Go to assembly with target compiler"
+ { default_target_compile "foo.go" "foo.s" assembly {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-gccgo foo.go -midp -fgo
+ -S -I/usr/gnemul/idp/include -o foo.s} }
+ }
+ }
+ { "compile Go to object with target compiler"
+ { default_target_compile "foo.go" "foo.o" object {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-gccgo -midp -fgo
+ -c -I/usr/gnemul/idp/include
+ -o foo.o foo.go} }
+ }
+ }
+ { "compile and link Go with target compiler"
+ { default_target_compile "foo.go" "foo" executable {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-gccgo-ld foo.go -midp -fgo
+ -I/usr/gnemul/idp/include -L/usr/gnemul/idp/lib
+ -lidpsup -lm_idp -Tidp.ld -o foo} }
+ }
+ }
+
+ { "setup GO_FOR_TARGET"
+ { set GO_FOR_TARGET "target-gccgo" }
+ }
+ { "preprocess Go with GO_FOR_TARGET"
+ { default_target_compile "foo.go" "" preprocess {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {target-gccgo foo.go -midp -fgo
+ -E -I/usr/gnemul/idp/include} }
+ }
+ }
+ { "compile Go to assembly with GO_FOR_TARGET"
+ { default_target_compile "foo.go" "foo.s" assembly {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {target-gccgo foo.go -midp -fgo
+ -S -I/usr/gnemul/idp/include -o foo.s} }
+ }
+ }
+ { "compile Go to object with GO_FOR_TARGET"
+ { default_target_compile "foo.go" "foo.o" object {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {target-gccgo -midp -fgo
+ -c -I/usr/gnemul/idp/include
+ -o foo.o foo.go} }
+ }
+ }
+ { "clean up GO_FOR_TARGET"
+ { unset GO_FOR_TARGET }
+ }
+ { "setup GO_LD_FOR_TARGET"
+ { set GO_LD_FOR_TARGET "target-gccgo-ld" }
+ }
+ { "compile and link Go with GO_LD_FOR_TARGET"
+ { default_target_compile "foo.go" "foo" executable {go} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_go" ! {}
+ "find_go_linker" ! {}
+ "remote_exec host" U
+ { 2 {target-gccgo-ld foo.go -midp -fgo
+ -I/usr/gnemul/idp/include -L/usr/gnemul/idp/lib
+ -lidpsup -lm_idp -Tidp.ld -o foo} }
+ }
+ }
+ { "clean up GO_LD_FOR_TARGET"
+ { unset GO_LD_FOR_TARGET }
+ }
+
+ { "override destination to host and compile Go to object"
+ { default_target_compile "foo.go" "foo.o" object {
+ "dest=host" go
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {found-go -c -o foo.o foo.go} }
+ }
+ }
+ { "override destination to host and compile Go to object with host-gccgo"
+ { default_target_compile "foo.go" "foo.o" object {
+ "dest=host" go "compiler=host-gccgo"
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {host-gccgo -c -o foo.o foo.go} }
+ }
+ }
+ { "override destination to host and compile and link Go"
+ { default_target_compile "foo.go" "foo" executable {
+ "dest=host" go
+ } }
+ check_calls {
+ "remote_exec host" U
+ { 2 {found-go_linker foo.go -lm -Tmvme.ld -o foo} }
+ }
+ }
+ { "override destination to host and compile and link Go with host-gccgo-ld"
+ { default_target_compile "foo.go" "foo" executable {
+ "dest=host" go "compiler=host-gccgo" "linker=host-gccgo-ld"
+ } }
+ check_calls {
+ "remote_exec host" U
+ { 2 {host-gccgo-ld foo.go -lm -Tmvme.ld -o foo} }
+ }
+ }
+
+ # Rust
+ { "preprocess Rust with target compiler"
+ { default_target_compile "foo.rs" "" preprocess {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-rustc foo.rs -midp -frust
+ -E -I/usr/gnemul/idp/include} }
+ }
+ }
+ { "compile Rust to assembly with target compiler"
+ { default_target_compile "foo.rs" "foo.s" assembly {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-rustc foo.rs -midp -frust
+ --emit asm -I/usr/gnemul/idp/include -o foo.s} }
+ }
+ }
+ { "compile Rust to object with target compiler"
+ { default_target_compile "foo.rs" "foo.o" object {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-rustc -midp -frust
+ --emit obj -I/usr/gnemul/idp/include
+ -o foo.o foo.rs} }
+ }
+ }
+ { "compile and link Rust with target compiler"
+ { default_target_compile "foo.rs" "foo" executable {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {m68k-unknown-aout-rustc foo.rs -midp -frust
+ -I/usr/gnemul/idp/include -L/usr/gnemul/idp/lib
+ -lidpsup -lm_idp -Tidp.ld -o foo} }
+ }
+ }
+
+ { "setup RUSTC_FOR_TARGET"
+ { set RUSTC_FOR_TARGET "target-rustc" }
+ }
+ { "preprocess Rust with RUSTC_FOR_TARGET"
+ { default_target_compile "foo.rs" "" preprocess {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {target-rustc foo.rs -midp -frust
+ -E -I/usr/gnemul/idp/include} }
+ }
+ }
+ { "compile Rust to assembly with RUSTC_FOR_TARGET"
+ { default_target_compile "foo.rs" "foo.s" assembly {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {target-rustc foo.rs -midp -frust
+ --emit asm -I/usr/gnemul/idp/include -o foo.s} }
+ }
+ }
+ { "compile Rust to object with RUSTC_FOR_TARGET"
+ { default_target_compile "foo.rs" "foo.o" object {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {target-rustc -midp -frust
+ --emit obj -I/usr/gnemul/idp/include
+ -o foo.o foo.rs} }
+ }
+ }
+ { "compile and link Rust with RUSTC_FOR_TARGET"
+ { default_target_compile "foo.rs" "foo" executable {rust} }
+ check_calls {
+ "find_gcc" ! {}
+ "find_rustc" ! {}
+ "remote_exec host" U
+ { 2 {target-rustc foo.rs -midp -frust
+ -I/usr/gnemul/idp/include -L/usr/gnemul/idp/lib
+ -lidpsup -lm_idp -Tidp.ld -o foo} }
+ }
+ }
+ { "clean up RUSTC_FOR_TARGET"
+ { unset RUSTC_FOR_TARGET }
+ }
+
+ { "override destination to host and compile and link Rust"
+ { default_target_compile "foo.rs" "foo" executable {
+ "dest=host" rust
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {found-rustc foo.rs -lm -Tmvme.ld -o foo} }
+ }
+ }
+ { "override destination to host and compile and link Rust with host-rustc"
+ { default_target_compile "foo.rs" "foo" executable {
+ "dest=host" rust "compiler=host-rustc"
+ } }
+ check_calls {
+ "remote_exec host" U { 2 {host-rustc foo.rs -lm -Tmvme.ld -o foo} }
+ }
+ }
+
}
# mock [file exists ...] in slave interpreter for testing libs= option
--
1.7.4.1
>From 024297c3b4444b1210d869cc868558e10d75bd97 Mon Sep 17 00:00:00 2001
From: Jacob Bachmeyer <jcb62281+dev@gmail.com>
Date: Mon, 22 Jun 2020 19:01:36 -0500
Subject: [PATCH 8/8] Update NEWS
---
ChangeLog | 2 ++
NEWS | 4 ++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 58a1201..95a4deb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2020-06-22 Jacob Bachmeyer <jcb62281+dev@gmail.com>
+ * NEWS: Mention "linker=" option and added language support.
+
* doc/dejagnu.texi (target_compile procedure): Document new
"linker=" option to target_compile.
diff --git a/NEWS b/NEWS
index 209e9c4..9e6dff7 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,10 @@ Changes since 1.6.2:
retrieving or providing information about the current testsuite.
6. A command "testsuite file" is added to replace the use of the
"*dir" variables in test scripts.
+X. The target_compile procedure now accepts a "linker=" option that
+ overrides the compiler selection when producing an executable.
+X. The internal default_target_compile procedure now supports compiling
+ sources in Go (using GCC Go) and Rust.
7. A shell command "dejagnu" is added as a place to hang various
auxiliary commands not directly involved with running tests. The
"runtest" command will remain for that purpose for the foreseeable
--
1.7.4.1