* Broken symbol version number check.
@ 2004-11-04 15:33 Paul Brook
2004-11-15 4:13 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Paul Brook @ 2004-11-04 15:33 UTC (permalink / raw)
To: binutils
The check in elf_link_add_object_symbols assumes they are consecutive and
zero-based. This is happens to be true for DSOs produced by GNU ld, but
AFAICS is not a requirement. Comments (and code) in
_bfd_elf_slurp_version_tables also indicate that defined symbol version
numbers need not be consecutive.
The patch below fixes the test to accept non-consecutive symbol versions. It
takes advantage of the fact that verdef array is allocated with bfd_zalloc,
so unused version indices will have a NULL name.
Build --enable-targets=all and tested on i686-linux.
Ok?
Paul
2004-11-04 Paul Brook <paul@codesourcery.com>
* elflink.c (elf_link_add_object_symbols): Don't assume version
indices are consecutive.
Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.116
diff -c -p -r1.116 elflink.c
*** elflink.c 2 Nov 2004 05:44:34 -0000 1.116
--- elflink.c 4 Nov 2004 15:23:47 -0000
*************** elf_link_add_object_symbols (bfd *abfd,
*** 3518,3537 ****
if (isym->st_shndx != SHN_UNDEF)
{
! if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info)
{
(*_bfd_error_handler)
(_("%B: %s: invalid version %u (max %d)"),
abfd, name, vernum,
! elf_tdata (abfd)->dynverdef_hdr.sh_info);
bfd_set_error (bfd_error_bad_value);
goto error_free_vers;
}
- else if (vernum > 1)
- verstr =
- elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
- else
- verstr = "";
}
else
{
--- 3518,3540 ----
if (isym->st_shndx != SHN_UNDEF)
{
! if (vernum > elf_tdata (abfd)->cverdefs)
! verstr = NULL;
! else if (vernum > 1)
! verstr =
! elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
! else
! verstr = "";
!
! if (verstr == NULL)
{
(*_bfd_error_handler)
(_("%B: %s: invalid version %u (max %d)"),
abfd, name, vernum,
! elf_tdata (abfd)->cverdefs);
bfd_set_error (bfd_error_bad_value);
goto error_free_vers;
}
}
else
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Broken symbol version number check.
2004-11-04 15:33 Broken symbol version number check Paul Brook
@ 2004-11-15 4:13 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2004-11-15 4:13 UTC (permalink / raw)
To: Paul Brook; +Cc: binutils
On Thu, Nov 04, 2004 at 03:32:46PM +0000, Paul Brook wrote:
> * elflink.c (elf_link_add_object_symbols): Don't assume version
> indices are consecutive.
OK. You might like to look at bfd_elf_print_symbol too.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-15 4:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-04 15:33 Broken symbol version number check Paul Brook
2004-11-15 4:13 ` Alan Modra
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).