public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Clément Chigot" <chigot@adacore.com>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: Nelson Chu <nelson@rivosinc.com>, binutils@sourceware.org
Subject: Re: [PATCH] RISC-V: fix linker message when relaxation deletes bytes
Date: Thu, 20 Oct 2022 09:20:23 +0200	[thread overview]
Message-ID: <CAJ307EjTRuyEP4J2M0uOcar_wvXd8gRFxgtcV2LE9zT_kfL83A@mail.gmail.com> (raw)
In-Reply-To: <5d1faf3a-f33b-f3db-4fc7-36bc4419f49d@gmail.com>

Hi Jeff

On Wed, Oct 19, 2022 at 7:38 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
> On 10/17/22 02:32, Clément Chigot wrote:
> >
> > Yeah, that's what was already done in the Risc-V function:
> > riscv_relax_delete_bytes.
> > However, local and global symbols aren't enough for linker warnings
> > and errors. These ones are using the "outsymbols" BFD field which IIUC
> > is reading the object files directly and thus cannot know about the
> > deleted bytes.
>
> But if you're getting the outsymbols for the output bfd, then they
> should have the right address.  If they don't, then the symbol table in
> the output file is going to be wrong.  And changing the local/global
> symbols when relaxing should directly influence the outsymbols for the
> output bfd.

For Risc-V, it seems that outsymbols aren't needed for the output file
symbol table. I've tried with different programs, bfd_get_outsymbols
seems to be reached only when an error has to be displayed.

> > So I guess H8 might have the same kind of errors. Are ld-undefined
> > tests succeeding ?
>
> Which test specifically?  None are failing, but some are
> UNTESTED/UNSUPPORTED:
>
>
> UNSUPPORTED: -shared --entry foo archive
> UNSUPPORTED: -shared --entry foo -u foo archive
> UNTESTED: undefined
> UNTESTED: undefined function
> UNTESTED: undefined line
> UNSUPPORTED: undefined symbols in shared lib
> UNSUPPORTED: weak undefined function symbols in shared lib
>
>
> Do I need to turn on relaxing by default to see this issue (unlike
> riscv, h8 does not enable relaxing by default).

Hum, I guess they are probably disabled because you haven't a compiler
available for H8 or at least it's not properly set up for the
testsuites.
The way I'm enabling them is by passing a "board" to DejaGNU (see
[1]). This board will have the correct CFLAGS and LDFLAGS.
  | set_board_info ldflags  "${CFLAGS}"
  | set_board_info ldflags  "${LDFLAGS}"
  | set_currtarget_info ldflags  "${CFLAGS}"
  | set_currtarget_info ldflags  "${LDFLAGS}"

Note that I stated in a recent patch improving the support for
LDFLAGS, I'm not sure why both set_board and set_currtarget are
needed. But I do need both to make it work.

[1] https://www.gnu.org/software/dejagnu/manual/Adding-a-new-board.html
[2] https://sourceware.org/pipermail/binutils/2022-October/123314.html

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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 11:46 Clément Chigot
2022-10-13 12:05 ` Clément Chigot
2022-10-14  5:08   ` Nelson Chu
2022-10-14  7:24     ` Clément Chigot
2022-10-15  0:42       ` Jeff Law
2022-10-17  8:32         ` Clément Chigot
2022-10-19 17:38           ` Jeff Law
2022-10-20  7:20             ` Clément Chigot [this message]
2022-10-31  9:57       ` Clément Chigot
2022-11-17  9:36         ` Clément Chigot
2022-11-18  1:43       ` Nelson Chu
2022-11-18  8:17         ` Clément Chigot

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=CAJ307EjTRuyEP4J2M0uOcar_wvXd8gRFxgtcV2LE9zT_kfL83A@mail.gmail.com \
    --to=chigot@adacore.com \
    --cc=binutils@sourceware.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=nelson@rivosinc.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).