This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Abort in elflink.c: elf_link_check_versioned_symbol
- From: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 02 Sep 2009 13:49:17 +0100
- Subject: Re: Abort in elflink.c: elf_link_check_versioned_symbol
- References: <1251281400.4775.15.camel@e200593-lin.cambridge.arm.com> <m3d46i4o49.fsf@google.com>
- Reply-to: ramana dot radhakrishnan at arm dot com
Hi Ian,
Thanks for your email and apologies for the late response.
On Wed, 2009-08-26 at 07:59 -0700, Ian Lance Taylor wrote:
> Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> writes:
>
> > The symbol for which this abort happens is
> > _ZNSsC1IN9__gnu_cxx17__normal_iteratorIPcSsEEEET_S4_RKSaIcE from libstdc
> > ++.so. Looking at this symbol in libstdc++.so, I can see that this is
> > versioned and weak as below but the actual symbol doesn't appear in the
> > shared object.
> >
> >>From the Symbol Table of libstdc++
> >
> > 936: 0008e1e4 40 FUNC WEAK DEFAULT 11
> > _ZNSsC1IN9__gnu_cxx17__normal_iteratorIPcSsEEEET_S4_RKSaIcE@@GLIBCXX_3.4
>
> That is a real symbol definition. It merely happens to be marked weak.
Fair enough. If this is a real symbol definition and happens to be just
marked weak , then shouldn't all references resolve to this symbol.
>
> I think what is happening is that elf_link_check_versioned_symbol
> assumes that it will only be called when the regular symbol resolution
> code did not resolve the symbol. So it does not expect to see an
> unhidden symbol here; an unhidden symbol should already have been
> resolved. So you should find out why elf_link_check_versioned_symbol is
> being called here.
elf_link_check_versioned_symbol is being called from the following call
stack
Breakpoint 1, _bfd_abort (file=0xe2c18
"/home/ramrad01/sources/src/bfd/elflink.c", line=8440, fn=0xe36f0
"elf_link_check_versioned_symbol")
at /home/ramrad01/sources/src/bfd/bfd.c:928
928 {
(gdb) bt
#0 _bfd_abort (file=0xe2c18 "/home/ramrad01/sources/src/bfd/elflink.c",
line=8440, fn=0xe36f0 "elf_link_check_versioned_symbol")
at /home/ramrad01/sources/src/bfd/bfd.c:928
#1 0x00068474 in elf_link_check_versioned_symbol (info=<value optimized
out>, bed=0xbeffca84, h=0x1a405e0)
at /home/ramrad01/sources/src/bfd/elflink.c:8440
#2 0x00068a4c in elf_link_output_extsym (h=0x1a405e0, data=<value
optimized out>) at /home/ramrad01/sources/src/bfd/elflink.c:8531
#3 0x00039308 in bfd_hash_traverse (table=0x110578, func=0x68484
<elf_link_output_extsym>, info=0xbeffca84)
at /home/ramrad01/sources/src/bfd/hash.c:603
#4 0x0006f114 in bfd_elf_final_link (abfd=0x16b18, info=0x845a8)
at /home/ramrad01/sources/src/bfd/elflink.c:10588
#5 0x0004a99c in elf32_arm_final_link (abfd=0xe2c18, info=0x20f8)
at /home/ramrad01/sources/src/bfd/elf32-arm.c:9296
#6 0x0001ea1c in ldwrite ()
at /home/ramrad01/sources/src/ld/ldwrite.c:567
#7 0x0001de58 in main (argc=0, argv=0x9984)
at /home/ramrad01/sources/src/ld/ldmain.c:464
(gdb) up
#1 0x00068474 in elf_link_check_versioned_symbol (info=<value optimized
out>, bed=0xbeffca84, h=0x1a405e0)
at /home/ramrad01/sources/src/bfd/elflink.c:8440
8440 abort ();
(gdb) up
#2 0x00068a4c in elf_link_output_extsym (h=0x1a405e0, data=<value
optimized out>) at /home/ramrad01/sources/src/bfd/elflink.c:8531
8531 if (! finfo->info->relocatable
As you can see this is getting called from bfd_elf_final_link which ends
up calling elf_link_output_extsym where the abort happens.
The reason that we call this in elf_link_output_extsym from the
following comment is -
(gdb) l 8536
8531 if (! finfo->info->relocatable
8532 && (! finfo->info->shared)
8533 && h->forced_local
8534 && h->ref_dynamic
8535 && !h->dynamic_def
8536 && !h->dynamic_weak
8537 && ! elf_link_check_versioned_symbol (finfo->info, bed,
h))
8538 {
8539 (*_bfd_error_handler)
8540 (_("%B: %s symbol `%s' in %B is referenced by DSO"),
which appears to be correct. From what you say and looking at the code
it appears as though one might have to refactor the code accordingly -
to give errors depending on when this function is called ?
cheers
Ramana