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: Mon, 17 Oct 2022 10:32:29 +0200	[thread overview]
Message-ID: <CAJ307Eh7TZacx642TFCnia+1csKj-udhFD1eV6+XZ4vC5HqaDg@mail.gmail.com> (raw)
In-Reply-To: <d88c24c5-3c5d-bc8b-b3a5-6a98de47e27b@gmail.com>

Hi Jeff,

On Sat, Oct 15, 2022 at 2:42 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
> On 10/14/22 01:24, Clément Chigot via Binutils wrote:
> > On Fri, Oct 14, 2022 at 7:08 AM Nelson Chu <nelson@rivosinc.com> wrote:
> >> Hi,
> >>
> >> On Thu, Oct 13, 2022 at 8:06 PM Clément Chigot via Binutils
> >> <binutils@sourceware.org> wrote:
> >>> Gentle ping
> >>>
> >>> Thanks,
> >>> Clément
> >>>
> >>> On Thu, Oct 6, 2022 at 1:46 PM Clément Chigot <chigot@adacore.com> wrote:
> >>>> The section relaxation can delete some bytes resulting in the symbols'
> >>>> value being modified.
> >>>> As the linker messages retrieve a symbol information using the
> >>>> outsymbols field of abfd, it must be updated as well.
> >> Interesting, I never noticed this.  If this is necessary, then other
> >> targets should also update the output symbols when relaxing (nds32 and
> >> sh), but it seems like they don't do that as well.
> > Yeah, I agree there are probably other targets having a similar issue.
> > I don't know at what extend outsymbols is being used for. But the fact
> > that is being filled with "untouched" symbols in object files looks
> > weird to me. Maybe there is something to look into this direction.
> > For now, this patch aims just to fix ld-undefined on Risc-V targets.
> >
> >
>
> The target has to adjust the local and global symbols defined in the
> relaxed section.      I haven't done relaxing in a long time, but the
> one I'm most familiar with is the H8.  If you look at
> elf32_h8_relax_delete_bytes you'll see suitable code to update the local
> and global symbols.

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.
So I guess H8 might have the same kind of errors. Are ld-undefined
tests succeeding ?

Thanks,
Clémebt

  reply	other threads:[~2022-10-17  8:32 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 [this message]
2022-10-19 17:38           ` Jeff Law
2022-10-20  7:20             ` Clément Chigot
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=CAJ307Eh7TZacx642TFCnia+1csKj-udhFD1eV6+XZ4vC5HqaDg@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).