[PATCH] ld: Skip bootstrap tests for -fprofile-generate=

Hans-Peter Nilsson hp@axis.com
Fri Oct 23 14:25:08 GMT 2020


> From: "H.J. Lu via Binutils" <binutils@sourceware.org>
> Date: Thu, 22 Oct 2020 14:41:31 +0200

> On Wed, Oct 21, 2020 at 11:44 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > Make plug_opt available to all linker tests.  Skip bootstrap tests when
> > linker is compiled with -fprofile-generate=.
> >
> >         * testsuite/ld-plugin/lto.exp (plug_opt): Moved to ...
> >         * testsuite/config/default.exp (plug_opt): Here.  New.
> >         * testsuite/ld-bootstrap/bootstrap.exp: Skip when linker is
> >         compiled with -fprofile-generate=.
> > ---
> >  ld/testsuite/config/default.exp         | 17 +++++++++++++++++
> >  ld/testsuite/ld-bootstrap/bootstrap.exp |  8 +++++++-
> >  ld/testsuite/ld-plugin/lto.exp          | 16 ----------------
> >  3 files changed, 24 insertions(+), 17 deletions(-)
> >
> > diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
> > index e5730ff5654..73d61dec272 100644
> > --- a/ld/testsuite/config/default.exp
> > +++ b/ld/testsuite/config/default.exp
> > @@ -424,3 +424,20 @@ if { [istarget alpha*-*-*vms*] } {
> >      }
> >      unset f src
> >  }
> > +
> > +set plugin_names {
> > +    liblto_plugin.so
> > +    liblto_plugin-0.dll
> > +    cyglto_plugin-0.dll
> > +}
> > +set plug_opt ""
> > +foreach plug $plugin_names {
> > +    set plug_so [run_host_cmd $CC "--print-prog-name $plug"]
> > +    if { $plug_so eq $plug } then {
> > +       set plug_so [run_host_cmd $CC "--print-file-name $plug"]
> > +    }
> > +    if { $plug_so ne $plug } then {
> > +       set plug_opt "--plugin $plug_so"
> > +       break
> > +    }
> > +}
> > diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
> > index 43928fb6483..2342d509fc0 100644
> > --- a/ld/testsuite/ld-bootstrap/bootstrap.exp
> > +++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
> > @@ -29,7 +29,13 @@ if ![isnative] {
> >      return
> >  }
> >
> > -# Determine if plugin support is present.
> > +# Skip for -fprofile-generate=.
> > +catch "exec $nm $plug_opt $OFILES" exec_output
> > +send_log "foo: $exec_output"
> > +if { [ string match "*__gcov_*" $exec_output ] } {
> > +    return
> > +}
> > +
> >  remote_exec host "$nm --help" "" "/dev/null" "plugin-support"
> >  set tmp [file_contents "plugin-support"]
> >  regexp ".*\(--plugin\).*\n" $tmp foo plugins
> > diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
> > index abb712575f4..9f9f2d13ced 100644
> > --- a/ld/testsuite/ld-plugin/lto.exp
> > +++ b/ld/testsuite/ld-plugin/lto.exp
> > @@ -41,22 +41,6 @@ proc restore_notify { } {
> >    set CXXFLAGS "$saved_CXXFLAGS"
> >  }
> >
> > -set plugin_names {
> > -    liblto_plugin.so
> > -    liblto_plugin-0.dll
> > -    cyglto_plugin-0.dll
> > -}
> > -set plug_opt ""
> > -foreach plug $plugin_names {
> > -    set plug_so [run_host_cmd $CC "--print-prog-name $plug"]
> > -    if { $plug_so eq $plug } then {
> > -       set plug_so [run_host_cmd $CC "--print-file-name $plug"]
> > -    }
> > -    if { $plug_so ne $plug } then {
> > -       set plug_opt "--plugin $plug_so"
> > -       break
> > -    }
> > -}
> >  set lto_fat ""
> >  set lto_no_fat ""
> >  if { [check_lto_fat_available] } {
> > --
> > 2.26.2
> >
> 
> I am checking in this.

In doing so (and apparently without any approval), you moved
compiler-assuming code past the check for a compiler at the top
of lto.exp:

# Check to see if the C and C++ compilers work
if { ![check_compiler_available] || [which $CXX] == 0 } {
    return
}

...leading so errors if a compiler isn't present, where no error
was emitted before this commit, making "make check-ld" exit with
an error.  E.g.:

		=== ld tests ===

Schedule of variations:
    unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using x/hpautotest-binutils/bsrc/src/ld/testsuite/config/default.exp as tool-and-target-specific interface file.
ERROR: mmix-knuth-mmixware-cc does not exist

Please fix.

brgds, H-P


More information about the Binutils mailing list