From: Ian Lance Taylor <iant@google.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
Chenghua Xu <paul.hua.gm@gmail.com>,
Binutils <binutils@sourceware.org>
Subject: Re: non-conformant ELF symbol table on MIPS?
Date: Fri, 28 Jul 2023 10:11:50 -0700 [thread overview]
Message-ID: <CAKOQZ8wp3-Ni7NVbkPDXHHpV10dh-GSnJDveTmM2tSmsRuyiXA@mail.gmail.com> (raw)
In-Reply-To: <a9322e6a-e42b-63af-bb67-5621770651e7@suse.com>
On Thu, Jul 27, 2023 at 11:16 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 27.07.2023 21:04, Ian Lance Taylor wrote:
> > On Thu, Jul 27, 2023 at 7:28 AM Jan Beulich via Binutils
> > <binutils@sourceware.org> wrote:
> >>
> >> extending the gas elf/common3.s testcase (in the context of trying to fix
> >> PR gas/30688) to
> >>
> >> .comm foobar,30,4
> >> .comm buf1, 5-1, 8
> >> .comm buf2, 4, 9-1
> >> .lcomm lbuf, 9-1
> >>
> >> I notice a violation of the ELF spec on most (all?) MIPS targets I would
> >> routinely test for common code changes: "lbuf" is emitted last in the
> >> symbol table. The spec is quite clear: "In each symbol table, all
> >> symbols with STB_LOCAL binding precede the weak and global symbols." I
> >> guess I want/need to xfail that test for mips*-*-* for the time being,
> >> but it would be nice if you could shed some light on this behavior.
> >
> > This is historical behavior that dates back to the SGI Irix operating
> > system. Search for elf_bad_symtab in the BFD sources. Here is the
> > commend from elf-bfd.h:
> >
> > /* Irix 5 often screws up the symbol table, sorting local symbols
> > after global symbols. This flag is set if the symbol table in
> > this BFD appears to be screwed up. If it is, we ignore the
> > sh_info field in the symbol table header, and always read all the
> > symbols. */
> > unsigned int bad_symtab : 1;
> >
> > I believe we currently set elf_bad_symtab true by default for most MIPS targets.
>
> That explains consuming behavior. But gas is a producer, and from what
> you say and quote I can't see why gas also needs to produce non-
> conforming symbol tables.
It was required for the linker, because otherwise the SGI IRIX dynamic
linker would not work correctly.
I don't recall whether it was required for gas. That may have been an
accidental carry-over. Or it may have been required for the IRIX
static linker to work, I don't remember.
Doing it for the plan mips-elf target is probably not the best choice today.
Ian
next prev parent reply other threads:[~2023-07-28 17:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 14:27 Jan Beulich
2023-07-27 19:04 ` Ian Lance Taylor
2023-07-27 19:39 ` Maciej W. Rozycki
2023-07-28 6:16 ` Jan Beulich
2023-07-28 17:11 ` Ian Lance Taylor [this message]
2023-07-28 23:58 ` Alan Modra
2023-07-27 19:28 ` Maciej W. Rozycki
2023-07-28 6:13 ` Jan Beulich
2023-07-28 7:18 ` Jan Beulich
2023-07-28 6:18 ` Jan Beulich
2023-07-28 6:56 ` Maciej W. Rozycki
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=CAKOQZ8wp3-Ni7NVbkPDXHHpV10dh-GSnJDveTmM2tSmsRuyiXA@mail.gmail.com \
--to=iant@google.com \
--cc=binutils@sourceware.org \
--cc=jbeulich@suse.com \
--cc=macro@orcam.me.uk \
--cc=paul.hua.gm@gmail.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).