bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/815] [C-api -> C++ lib] undefined symbol _Unwind*


From: amodra at bigpond dot net dot au
Subject: [Bug ld/815] [C-api -> C++ lib] undefined symbol _Unwind*
Date: 15 Apr 2005 11:19:01 -0000

------- Additional Comments From amodra at bigpond dot net dot au  2005-04-15 
11:19 -------
libqt-mt.so.3.3.4 defines address@hidden

$22 = {root = {root = {next = 0x85d2380, 
      string = 0x85a9ea0 "address@hidden", hash = 421875337}, 
    type = bfd_link_hash_undefweak, u = {undef = {next = 0x0, 
        abfd = 0x85890e8, weak = 0x85890e8}, def = {next = 0x0, 
        section = 0x85890e8, value = 140021992}, i = {next = 0x0, 
        link = 0x85890e8, warning = 0x85890e8 "\002"}, c = {next = 0x0, 
        p = 0x85890e8, size = 140021992}}}, indx = -1, dynindx = -1, got = {
    refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, plt = {refcount = 0, 
    offset = 0, glist = 0x0, plist = 0x0}, size = 0, type = 0, other = 0, 
  ref_regular = 0, def_regular = 0, ref_dynamic = 0, def_dynamic = 0, 
  ref_regular_nonweak = 0, dynamic_adjusted = 0, needs_copy = 0, 
  needs_plt = 0, non_elf = 0, hidden = 0, forced_local = 0, mark = 0, 
  non_got_ref = 0, dynamic_def = 0, dynamic_weak = 0, 
  pointer_equality_needed = 0, dynstr_index = 0, u = {weakdef = 0x0, 
    elf_hash_value = 0}, verinfo = {verdef = 0x0, vertree = 0x0}, 
  vtable = 0x0}

libqt-mt.so.3.3.4 is needed, so above is kept.

libpthread.so.0 defines pthread_mutex_init@@GLIBC_2.0

$25 = {root = {root = {next = 0x865fa24, 
      string = 0x876b230 "pthread_mutex_init@@GLIBC_2.0", hash = 329801547}, 
    type = bfd_link_hash_defined, u = {undef = {next = 0x0, abfd = 0x85be3a4, 
        weak = 0x2700}, def = {next = 0x0, section = 0x85be3a4, 
        value = 9984}, i = {next = 0x0, link = 0x85be3a4, 
        warning = 0x2700 <Address 0x2700 out of bounds>}, c = {next = 0x0, 
        p = 0x85be3a4, size = 9984}}}, indx = -1, dynindx = -1, got = {
    refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, plt = {refcount = 0, 
    offset = 0, glist = 0x0, plist = 0x0}, size = 0, type = 0, other = 0, 
  ref_regular = 0, def_regular = 0, ref_dynamic = 0, def_dynamic = 0, 
  ref_regular_nonweak = 0, dynamic_adjusted = 0, needs_copy = 0, 
  needs_plt = 0, non_elf = 0, hidden = 0, forced_local = 0, mark = 0, 
  non_got_ref = 0, dynamic_def = 0, dynamic_weak = 0, 
  pointer_equality_needed = 0, dynstr_index = 0, u = {weakdef = 0x0, 
    elf_hash_value = 0}, verinfo = {verdef = 0x85bcbf0, vertree = 0x85bcbf0}, 
  vtable = 0x0}

the linker creates an indirect symbol, pthread_mutex_init

(gdb) p *hi
$30 = {root = {root = {next = 0x8739a04, 
      string = 0x87720bc "pthread_mutex_init", hash = 268710567}, 
    type = bfd_link_hash_indirect, u = {undef = {next = 0x0, 
        abfd = 0x8772060, weak = 0x0}, def = {next = 0x0, 
        section = 0x8772060, value = 0}, i = {next = 0x0, link = 0x8772060, 
        warning = 0x0}, c = {next = 0x0, p = 0x8772060, size = 0}}}, 
  indx = -1, dynindx = -1, got = {refcount = 0, offset = 0, glist = 0x0, 
    plist = 0x0}, plt = {refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, 
  size = 0, type = 0, other = 0, ref_regular = 0, def_regular = 0, 
  ref_dynamic = 0, def_dynamic = 0, ref_regular_nonweak = 0, 
  dynamic_adjusted = 0, needs_copy = 0, needs_plt = 0, non_elf = 0, 
  hidden = 0, forced_local = 0, mark = 0, non_got_ref = 0, dynamic_def = 0, 
  dynamic_weak = 0, pointer_equality_needed = 0, dynstr_index = 0, u = {
    weakdef = 0x0, elf_hash_value = 0}, verinfo = {verdef = 0x0, 
    vertree = 0x0}, vtable = 0x0}
(gdb) p *hi->root.u.i.link
$31 = {root = {next = 0x865fa24, 
    string = 0x876b230 "pthread_mutex_init@@GLIBC_2.0", hash = 329801547}, 
  type = bfd_link_hash_defined, u = {undef = {next = 0x0, abfd = 0x85be3a4, 
      weak = 0x2700}, def = {next = 0x0, section = 0x85be3a4, value = 9984}, 
    i = {next = 0x0, link = 0x85be3a4, 
      warning = 0x2700 <Address 0x2700 out of bounds>}, c = {next = 0x0, 
      p = 0x85be3a4, size = 9984}}}

and also an indirection from the nondefault version,
address@hidden which was undefweak from libqt-mt.so.3.3.4

(gdb) p *h
$33 = {root = {next = 0x85d2380, 
    string = 0x85a9ea0 "address@hidden", hash = 421875337}, 
  type = bfd_link_hash_indirect, u = {undef = {next = 0x0, abfd = 0x8772060, 
      weak = 0x85890e8}, def = {next = 0x0, section = 0x8772060, 
      value = 140021992}, i = {next = 0x0, link = 0x8772060, 
      warning = 0x85890e8 "\002"}, c = {next = 0x0, p = 0x8772060, 
      size = 140021992}}}
(gdb) p *h->u.i.link
$34 = {root = {next = 0x865fa24, 
    string = 0x876b230 "pthread_mutex_init@@GLIBC_2.0", hash = 329801547}, 
  type = bfd_link_hash_defined, u = {undef = {next = 0x0, abfd = 0x85be3a4, 
      weak = 0x2700}, def = {next = 0x0, section = 0x85be3a4, value = 9984}, 
    i = {next = 0x0, link = 0x85be3a4, 
      warning = 0x2700 <Address 0x2700 out of bounds>}, c = {next = 0x0, 
      p = 0x85be3a4, size = 9984}}}

and this code:

            /* If the indirect symbol has been referenced, we need to
               push the reference down to the symbol we are
               referencing.  */
            if (h->type != bfd_link_hash_new)
              {
                row = UNDEF_ROW;
                cycle = TRUE;
              }

then results in u.undef.next pointing back at the syms

$36 = {root = {next = 0x85d2380, 
    string = 0x85a9ea0 "address@hidden", hash = 421875337}, 
  type = bfd_link_hash_indirect, u = {undef = {next = 0x865f858, 
      abfd = 0x8772060, weak = 0x85890e8}, def = {next = 0x865f858, 
      section = 0x8772060, value = 140021992}, i = {next = 0x865f858, 
      link = 0x8772060, warning = 0x85890e8 "\002"}, c = {next = 0x865f858, 
      p = 0x8772060, size = 140021992}}}

$37 = {root = {next = 0x865fa24, 
    string = 0x876b230 "pthread_mutex_init@@GLIBC_2.0", hash = 329801547}, 
  type = bfd_link_hash_defined, u = {undef = {next = 0x8772060, 
      abfd = 0x85be3a4, weak = 0x2700}, def = {next = 0x8772060, 
      section = 0x85be3a4, value = 9984}, i = {next = 0x8772060, 
      link = 0x85be3a4, warning = 0x2700 <Address 0x2700 out of bounds>}, 
    c = {next = 0x8772060, p = 0x85be3a4, size = 9984}}}

but libpthread.so.0 isn't needed, so the syms get set back to newly
created.  (shown below are what we have after my fix to elf_smash_syms
ie. root.u.undef.next cleared.)

1: *h = {root = {root = {next = 0x865fa24, 
      string = 0x876b230 "pthread_mutex_init@@GLIBC_2.0", hash = 329801547}, 
    type = bfd_link_hash_new, u = {undef = {next = 0x0, abfd = 0x8589310, 
        weak = 0x0}, def = {next = 0x0, section = 0x8589310, value = 0}, i = {
        next = 0x0, link = 0x8589310, warning = 0x0}, c = {next = 0x0, 
        p = 0x8589310, size = 0}}}, indx = -1, dynindx = -1, got = {
    refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, plt = {refcount = 0, 
    offset = 0, glist = 0x0, plist = 0x0}, size = 0, type = 0, other = 0, 
  ref_regular = 0, def_regular = 0, ref_dynamic = 0, def_dynamic = 0, 
  ref_regular_nonweak = 0, dynamic_adjusted = 0, needs_copy = 0, 
  needs_plt = 0, non_elf = 0, hidden = 0, forced_local = 0, mark = 0, 
  non_got_ref = 0, dynamic_def = 0, dynamic_weak = 0, 
  pointer_equality_needed = 0, dynstr_index = 0, u = {weakdef = 0x0, 
    elf_hash_value = 0}, verinfo = {verdef = 0x0, vertree = 0x0}, 
  vtable = 0x0}

1: *h = {root = {root = {next = 0x85d2380, 
      string = 0x85a9ea0 "address@hidden", hash = 421875337}, 
    type = bfd_link_hash_new, u = {undef = {next = 0x0, abfd = 0x8589310, 
        weak = 0x0}, def = {next = 0x0, section = 0x8589310, value = 0}, i = {
        next = 0x0, link = 0x8589310, warning = 0x0}, c = {next = 0x0, 
        p = 0x8589310, size = 0}}}, indx = -1, dynindx = -1, got = {
    refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, plt = {refcount = 0, 
    offset = 0, glist = 0x0, plist = 0x0}, size = 0, type = 0, other = 0, 
  ref_regular = 0, def_regular = 0, ref_dynamic = 0, def_dynamic = 0, 
  ref_regular_nonweak = 0, dynamic_adjusted = 0, needs_copy = 0, 
  needs_plt = 0, non_elf = 0, hidden = 0, forced_local = 0, mark = 0, 
  non_got_ref = 0, dynamic_def = 0, dynamic_weak = 0, 
  pointer_equality_needed = 0, dynstr_index = 0, u = {weakdef = 0x0, 
    elf_hash_value = 0}, verinfo = {verdef = 0x0, vertree = 0x0}, 
  vtable = 0x0}

then libX11.so.6.2 makes a reference to address@hidden
which results in

$40 = {root = {root = {next = 0x85d2380, 
      string = 0x85a9ea0 "address@hidden", hash = 421875337}, 
    type = bfd_link_hash_undefined, u = {undef = {next = 0x0, 
        abfd = 0x8589548, weak = 0x0}, def = {next = 0x0, 
        section = 0x8589548, value = 0}, i = {next = 0x0, link = 0x8589548, 
        warning = 0x0}, c = {next = 0x0, p = 0x8589548, size = 0}}}, 
  indx = -1, dynindx = -1, got = {refcount = 0, offset = 0, glist = 0x0, 
    plist = 0x0}, plt = {refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, 
  size = 0, type = 0, other = 0, ref_regular = 0, def_regular = 0, 
  ref_dynamic = 0, def_dynamic = 0, ref_regular_nonweak = 0, 
  dynamic_adjusted = 0, needs_copy = 0, needs_plt = 0, non_elf = 0, 
  hidden = 0, forced_local = 0, mark = 0, non_got_ref = 0, dynamic_def = 0, 
  dynamic_weak = 0, pointer_equality_needed = 0, dynstr_index = 0, u = {
    weakdef = 0x0, elf_hash_value = 0}, verinfo = {verdef = 0x0, 
    vertree = 0x0}, vtable = 0x0}

and putting the above sym on the undefs list.  So that explains how
undef.next can be set when adding symbols from an as-needed lib.


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=815

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]