public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "Thomas Röthenbacher" <thomas@43t.de>
Cc: binutils@sourceware.org
Subject: Re: bfd enforces a specific value of sh_info on SHT_GNU_verneed
Date: Sat, 14 May 2022 10:36:55 +0930	[thread overview]
Message-ID: <Yn8Ar3WhcSU5KZ4L@squeak.grove.modra.org> (raw)
In-Reply-To: <716eb868d262e063382c7b63901fb02dfad9f2bb.camel@mailbox.org>

On Fri, May 13, 2022 at 09:17:32PM +0200, Thomas Röthenbacher wrote:
> Hello,
> 
> as stated in the subect, bfd (and therefore `objdump -d`) seems to fail
> in _bfd_elf_slurp_version_tables if the value of sh_info for a
> ".gnu.version_r" section (SHT_GNU_verdef) is zero.

SHT_GNU_verneed you mean.  sh_info is the number of version
dependencies in .gnu.version_r.

> I couldn't however find a specification to justify this behaviour or
> anything specifying the sh_info field of this section type at all.
> The only reference I could find, was in the SUN "Linker and Libraries
> Guide", where they defined the sh_info value for their section type
> SHT_SUNW_verdef. But does this standard apply here?

Yes.  SHT_GNU_verneed even has the same value as SHT_SUNW_verneed.
If sh_info isn't described in documents specifying .gnu.version.r,
then that is a deficiency of the specification document.

> I'm asking, because a program I work with generates binaries that
> violate this constraint, but can't really justify why it should NOT
> just have a sh_info of zero in this section.

I can give you a reason why sh_info has a count.  Consider the
contents of .gnu.version_r, both Elfxx_Verneed and Elfxx_Vernaux
structures.  You can't calculate the number of entries from the
section size.  Thus without reading the section you can't validate
.gnu.version entries.  If that isn't persuasive, justify it by the
need to work with other programs that interpret ELF files!

-- 
Alan Modra
Australia Development Lab, IBM

      reply	other threads:[~2022-05-14  1:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 19:17 Thomas Röthenbacher
2022-05-14  1:06 ` 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=Yn8Ar3WhcSU5KZ4L@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=thomas@43t.de \
    /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).