From: Alan Modra <amodra@gmail.com>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: YunQiang Su <wzssyqa@gmail.com>,
YunQiang Su <yunqiang.su@cipunited.com>,
binutils@sourceware.org, Nick Clifton <nickc@redhat.com>
Subject: Re: [PATCH v2] MIPS: Don't move __gnu_lto_slim to .scommon
Date: Fri, 21 Jul 2023 08:14:14 +0930 [thread overview]
Message-ID: <ZLm4vp7YpTx6cLKm@squeak.grove.modra.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2307201529001.18156@angie.orcam.me.uk>
On Thu, Jul 20, 2023 at 03:32:49PM +0100, Maciej W. Rozycki wrote:
> On Thu, 20 Jul 2023, Alan Modra wrote:
>
> > > > I think the patch is OK, but the same should be applied to another
> > > > place to stop objcopy modifying __gnu_lto_slim.
> > > >
> > > > mips-linux-gnu testcase after running make check:
> > > > binutils/objcopy ld/tmpdir/pr15323a-r.o ld/tmpdir/xxx
> > > > then inspect ld/tmpdir/xxx with readelf.
> > > >
> > > > I'm going to apply the following to mainline, and will also apply to
> > > > the 2.41 branch tomorrow if no one objects.
> > >
> > > You are the author of this code, so I guess you know what's going on
> > > here. I still don't understand the circumstances that cause linker.c to
> > > reject this symbol if it's in an SHN_MIPS_SCOMMON rather than SHN_COMMON
> > > section, and the relevant git change descriptions (going back to commit
> > > b794fc1d1c3a ("Warn for ar/nm/ranlib/ld on lto objects without plugin"))
> > > do not explain it, so I'd appreciate if you got me enlightened.
> >
> > It isn't anything in linker.c, I believe the problem occurs in the lto
> > plugin which processes object files using libiberty/simple-object*.
> > Code in libiberty/simple-object-elf.c removes SHN_COMMON symbols,
> > which for most architectures removes __gnu_lto_slim, but not on mips
> > if the symbol is moved to SHN_MIPS_SCOMMON. Then the symbol appears
> > in lto output files, resulting in linker errors like:
> > /tmp/ccg5JkW9.debug.temp.o: plugin needed to handle lto object
>
> It seems to me then we should be fixing libiberty instead, to also remove
> SHN_MIPS_SCOMMON symbols, for whatever intent it's done, shouldn't we?
It would be quite reasonable to change the libiberty code to test for
EM_MIPS and SHN_MIPS_SCOMMON, or to discard __gnu_lto_slim by name.
(The only reason that simple_object_elf_copy_lto_debug_sections
removes SHN_COMMON symbols is to remove __gnu_lto_slim.)
However the symbol is a marker only, so I think it is also entirely
reasonable to stop mips ld -r or objcopy from modifying it
unexpectedly.
--
Alan Modra
Australia Development Lab, IBM
prev parent reply other threads:[~2023-07-20 22:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 10:36 [PATCH] MIPS: Don't " YunQiang Su
2023-07-03 10:50 ` [PATCH v2] MIPS: Don't move " YunQiang Su
2023-07-05 1:42 ` YunQiang Su
2023-07-13 5:39 ` YunQiang Su
2023-07-19 14:55 ` Maciej W. Rozycki
2023-07-19 17:26 ` YunQiang Su
2023-07-20 9:05 ` Alan Modra
2023-07-20 9:34 ` Maciej W. Rozycki
2023-07-20 11:23 ` Alan Modra
2023-07-20 14:32 ` Maciej W. Rozycki
2023-07-20 22:44 ` Alan Modra [this message]
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=ZLm4vp7YpTx6cLKm@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=macro@orcam.me.uk \
--cc=nickc@redhat.com \
--cc=wzssyqa@gmail.com \
--cc=yunqiang.su@cipunited.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).