public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
To: Ian Lance Taylor <iant@google.com>
Cc: binutils@sourceware.org
Subject: Re: Abort in elflink.c: elf_link_check_versioned_symbol
Date: Wed, 02 Sep 2009 12:49:00 -0000	[thread overview]
Message-ID: <1251895757.8812.97.camel@e200593-lin.cambridge.arm.com> (raw)
In-Reply-To: <m3d46i4o49.fsf@google.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


  reply	other threads:[~2009-09-02 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 11:31 Ramana Radhakrishnan
2009-08-26 13:17 ` Ramana Radhakrishnan
2009-08-26 19:04 ` Ian Lance Taylor
2009-09-02 12:49   ` Ramana Radhakrishnan [this message]
2009-09-02 16:28     ` Ian Lance Taylor
2009-09-03 11:15       ` Ramana Radhakrishnan
2009-09-02 16:37     ` H.J. Lu

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=1251895757.8812.97.camel@e200593-lin.cambridge.arm.com \
    --to=ramana.radhakrishnan@arm.com \
    --cc=binutils@sourceware.org \
    --cc=iant@google.com \
    /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).