Abort in elflink.c: elf_link_check_versioned_symbol

Ramana Radhakrishnan ramana.radhakrishnan@arm.com
Wed Aug 26 11:31:00 GMT 2009


Hi,

I've been looking at a linker abort in
elflink.c:elf_link_check_versioned_symbol as a part of a larger project
that a coworker is doing on an arm-linux-gnueabi platform. 

I haven't yet constructed a smaller testcase but I am looking at a bit
of code that doesn't look correct to me. 

This bit of code is the bit that aborts in
elflink.c:elf_link_check_versioned_symbol .

  if ((iver.vs_vers & VERSYM_HIDDEN) == 0)
            {
              /* If we have a non-hidden versioned sym, then it should
                 have provided a definition for the undefined sym.  */
              abort ();
            }

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

>From the Version Table of libstdc++

3a8:   2 (GLIBCXX_3.4)   2 (GLIBCXX_3.4)   2 (GLIBCXX_3.4)   2
(GLIBCXX_3.4)

There is a reference to this file in foo.o compiled with fPIC present in
a library lib.a which is in the final link.

00005950  0003d51b R_ARM_PLT32            00000000
_ZNSsC1IN9__gnu_cxx17__normal_iteratorIPcSsEEEET_S4_RKSaIcE



Shouldn't this be an error condition for an undefined symbol instead of
an abort as here ? While fixing this will not  fix the underlying
problem my colleague faces, surely the linker should at this point give
an error for an undefined reference and bail out gracefully rather than
aborting. 


cheers
Ramana






More information about the Binutils mailing list