[PATCH] ld/testsuite: consistently add board_ldflags when linking with GCC
Clément Chigot
chigot@adacore.com
Tue Oct 4 07:36:43 GMT 2022
On Mon, Oct 3, 2022 at 7:10 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Fri, 30 Sep 2022 07:05:03 PDT (-0700), binutils@sourceware.org wrote:
> > Currently, the functions checking if the compiler is available or if a
> > feature is available add both board_cflags and board_ldflags.
> > However, functions running the tests only retrieve board_cflags. This
> > can lead to unexpected errors when mandaratory flags are defined in
> > board_ldflags and not board_cflags.
> >
> > ld/ChangeLog:
> >
> > * testsuite/ld-unique/unique.exp: Add board_ldflags when
> > linking with GCC.
> > * testsuite/lib/ld-lib.exp: Likewise.
> > ---
> > ld/testsuite/ld-unique/unique.exp | 8 +++++++-
> > ld/testsuite/lib/ld-lib.exp | 22 ++++++++++++++++++----
> > 2 files changed, 25 insertions(+), 5 deletions(-)
>
> Sorry if I'm misunderstanding what's going on here, but with this
> applied I'm still getting the tests skipped when I just run "check-ld".
>
> Running /home/palmer/life/binutils-gdb/ld/testsuite/ld-undefined/undefined.exp ...
> UNTESTED: undefined
> UNTESTED: undefined function
> UNTESTED: undefined line
>
> === ld Summary ===
>
> # of expected passes 797
> # of expected failures 8
> # of untested testcases 26
> # of unsupported tests 175
> ./ld-new 2.39.50.20220930
>
> I always kind of end up fumbling my way around these test suite
> infrastructure things though, so sorry if I'm just lost...
Haha don't worry, I spent quite some time trying to understand what
was going on.
AFAIU, there are several ways to pass flags to the DejaGNU driver.
The easiest is through environment variables or .exp files. For the ld
testsuite, they will be detected and applied correctly within
config/default.exp.
However, for more complex targets (like cross), you can pass a
"board" to DejaGNU with --target_board flag [1]. This allows deeper
configuration like setting up a "simulator" (we are using qemu to run
our Risc-V executables for exemple).
My patch aims to improve supports when LDFLAGS are passed through the
board as follow:
| set_board_info ldflags "${LDFLAGS}"
| set_currtarget_info ldflags "${LDFLAGS}"
Note that I don't know the exact difference between the two. Sometimes
the first one is enough, sometimes the second is required.
If someone has better knowledge than me on that I would be glad.
[1] https://www.gnu.org/software/dejagnu/manual/Adding-a-new-board.html
Thanks,
Clément
More information about the Binutils
mailing list