This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Run more ld tests when not native
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: Christophe Lyon <christophe dot lyon at linaro dot org>, binutils <binutils at sourceware dot org>
- Date: Wed, 11 Jan 2017 19:22:05 +0000
- Subject: Re: Run more ld tests when not native
- Authentication-results: sourceware.org; auth=none
- References: <20170102133453.GP29355@bubble.grove.modra.org> <CAKdteOaj3dZHEOqEb+yE=4p3KVkePNM2c+r2sJe_PHTUrA85Ww@mail.gmail.com> <20170103002942.GQ29355@bubble.grove.modra.org>
On Tue, 3 Jan 2017, Alan Modra wrote:
> diff --git a/ld/testsuite/ld-pie/pie.exp b/ld/testsuite/ld-pie/pie.exp
> index e9d1162..44d9f09 100644
> --- a/ld/testsuite/ld-pie/pie.exp
> +++ b/ld/testsuite/ld-pie/pie.exp
> @@ -25,6 +25,11 @@ if { ![istarget *-*-linux*]
> return
> }
>
> +# Check to see if the C compiler works
> +if { [which $CC] == 0 } {
> + return
> +}
> +
> # Check if -pie is supported or not.
> send_log "$CC -fpie -pie $srcdir/$subdir/pie.c -o tmpdir/pie"
> catch "exec $CC -fpie -pie $srcdir/$subdir/pie.c -o tmpdir/pie" exec_output
If you've decided to broaden coverage like this, then I think that beyond
a simple check that $CC can be found in $PATH a proper installation check
for the standard system libraries ought to be made, such as by trying to
build a trivial executable comprised of `int main(void) { return 0; }'.
This check might be executed once only per LD test suite invocation and
cached rather than repeatedly for each dependent test script, taking
advantage of all the test suite being executed in the same namespace (so
that a plain global variable will do). This is to avoid spurious failures
in the case where a partial development environment has been installed
only, e.g. binutils and a bootstrap compiler, but no C library.
FWIW,
Maciej