RFC: Discrepancy between sh_info and DT_VERNEEDNUM

Alan Modra amodra@gmail.com
Thu Nov 27 12:38:00 GMT 2014

On Thu, Nov 27, 2014 at 11:34:46AM +0000, Nick Clifton wrote:
> Hi Guys,
>   In the tarball attached to PR 17512, comment 112 there is a file
>   id:000010,src:000000,op:flip4,pos:4940, which I have also attached to
>   this email.  This file contains a discrepancy between the value of
>   DT_VERNEEDNUM (1) and the sh_info field of the SHT_GNU_Verneed section
>   header (0xe000), which leads "objdump -x <that file>" to go into a
>   very long loop printing out garbage version need information.
>   As far as I can tell the use of the sh_info field is an undocumented

I looked at this recently, and I'd say this is just an omission in the
documentation.  .gnu.version_r first appeared in binutils-2.8 and
we've set sh_info right from the beginning.

>   shortcut and that really the DT_VERNEEDNUM value should be used.

No, I don't think so.  _bfd_elf_print_private_bfd_data is one of many
places that assumes linking model ELF info (section headers) are
available in executables.  If the section headers are there, use them.

Outside of fuzzed objects, if sh_info disagrees with DT_VERNEEDNUM
then you have nasty gremlins lurking in your system.

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list