public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Clément Chigot" <chigot@adacore.com>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] ld/testsuite: consistently add board_ldflags when linking with GCC
Date: Tue, 4 Oct 2022 09:36:43 +0200	[thread overview]
Message-ID: <CAJ307EgkjkmDHeS==HMWDMhwtOtz05QVaQ2eUWQejyqSyfAT6g@mail.gmail.com> (raw)
In-Reply-To: <mhng-555f7ad5-dacc-4679-9e02-fcf641500d42@palmer-ri-x1c9>

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

  reply	other threads:[~2022-10-04  7:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 14:05 Clément Chigot
2022-10-03 17:10 ` Palmer Dabbelt
2022-10-04  7:36   ` Clément Chigot [this message]
2022-10-13 12:05 ` Clément Chigot
2022-10-17 10:52   ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ307EgkjkmDHeS==HMWDMhwtOtz05QVaQ2eUWQejyqSyfAT6g@mail.gmail.com' \
    --to=chigot@adacore.com \
    --cc=binutils@sourceware.org \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).