[PATCH 2/4] ld/testsuite: don't output to /dev/null on mingw hosts
Alan Modra
amodra@gmail.com
Mon Feb 20 10:59:52 GMT 2023
On Mon, Feb 20, 2023 at 09:22:22AM +0100, Clément Chigot via Binutils wrote:
> Mingw doesn't have /dev/null and thus "-o /dev/null" will fail.
> Currently, all the options are checked using this "-o /dev/null",
> resulting in them being disabled on mingw hosts. Fix that by
> outputting to a real .exe file.
>
> ld/ChangeLog:
>
> * testsuite/config/default.exp: Replace "-o /dev/null" by a file
> on mingw hosts.
I think I'd prefer this to always output to a file, which you should
delete afterwards.
> ---
> ld/testsuite/config/default.exp | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
> index 257fd4ba985..776b33842c2 100644
> --- a/ld/testsuite/config/default.exp
> +++ b/ld/testsuite/config/default.exp
> @@ -383,6 +383,9 @@ proc compiler_supports { flag args } {
> append flags " [board_info [target_info name] ldflags]"
> }
> set fn "cs[pid].c"
> + if [ishost "*-*-mingw*"] {
> + set fno "cs[pid].exe"
> + }
> set f [open $fn "w"]
> if { [llength $args] > 0 } {
> puts $f [lindex $args 0]
> @@ -391,7 +394,12 @@ proc compiler_supports { flag args } {
> }
> close $f
> set rfn [remote_download host $fn]
> - set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o /dev/null"]
> + if [ishost "*-*-mingw*"] {
> + set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o $fno"]
> + file delete $fno
> + } else {
> + set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o /dev/null"]
> + }
> remote_file host delete $rfn
> file delete $fn
> return $avail
> --
> 2.25.1
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list