public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: "Clément Chigot" <chigot@adacore.com>,
	"Nelson Chu" <nelson@rivosinc.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] RISC-V: fix linker message when relaxation deletes bytes
Date: Fri, 14 Oct 2022 18:42:49 -0600	[thread overview]
Message-ID: <d88c24c5-3c5d-bc8b-b3a5-6a98de47e27b@gmail.com> (raw)
In-Reply-To: <CAJ307Ei=0gjDZRwj=+3KJM-GeakGPHrDXMr61=HwbZPKk-c-yA@mail.gmail.com>


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.

That code is very old and may not have seen many updates through the 
last 20 years, but it should give you a good idea of how ports have 
handled this.

Jeff


  reply	other threads:[~2022-10-15  0:42 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 [this message]
2022-10-17  8:32         ` Clément Chigot
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=d88c24c5-3c5d-bc8b-b3a5-6a98de47e27b@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=chigot@adacore.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).