public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: 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 08:13:31 +0200	[thread overview]
Message-ID: <b5cd724f-449e-8e8c-6bae-e93309b1d17c@suse.com> (raw)
In-Reply-To: <alpine.DEB.2.21.2307271717100.10240@angie.orcam.me.uk>

On 27.07.2023 21:28, Maciej W. Rozycki wrote:
> On Thu, 27 Jul 2023, Jan Beulich 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.
> 
>  Which specific MIPS target is it?

Among the 9 I test, it's mips-unknown-elf, mipsisa32r2el-unknown-elf,
mips-sgi-irix6, and mipstx39-unknown-elf.

>  There are two kinds of MIPS targets, ones that use the older IRIX symbol 
> sorting rules and ones that use the newer "traditional" symbol sorting 
> rules.  The IRIX symbol sorting rules mandate that section symbols precede 
> all other symbols, see e.g. bfd/elf32-mips.c:mips_elf_sym_is_global.  
> Mind that SGI was an early adopter of the ELF standard and things weren't 
> as settled as they are nowadays, hence e.g. the odd solution for composed 
> relocations with the n64 psABI (later n32 uses standard ELF gABI ones) and 
> other peculiarities here and there.
> 
>  Determining whether a MIPS target uses the IRIX emulation is complex, see 
> e.g. how binutils/testsuite/binutils-all/mips/mips.exp sets `irixemul'.  
> If you provide me with test case details (input and output), then I may be 
> able to give you further advice,

I've provided you the input (see context above), and you'll be able to
generate the object file from it yourself. But I don't see what this
would bring, when you already indicate that this is "expected" behavior.

> but otherwise you may want to mark the 
> test case with `notarget' or suchlike rather than `xfail', because that's 
> not a bug with the backend that the symbol ordering varies.

I'm okay making mips*-*-irix* "notarget", but I don't view this as
appropriate for e.g. mips*-unknown-elf. Instead I would prefer leaving
further tweaking (if so needed) to you. The immediate goal is to get a
regression fix (with an accompanying extension to a testcase) in
quickly, such that hopefully Nick would still be able to pick it up for
2.41 (as in principle it affects most if not all targets).

Jan

  reply	other threads:[~2023-07-28  6:13 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
2023-07-28 23:58       ` Alan Modra
2023-07-27 19:28 ` Maciej W. Rozycki
2023-07-28  6:13   ` Jan Beulich [this message]
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=b5cd724f-449e-8e8c-6bae-e93309b1d17c@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --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).