bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/23499] New: Incorrect code in bfd_elf_record_link_assignment


From: hjl.tools at gmail dot com
Subject: [Bug ld/23499] New: Incorrect code in bfd_elf_record_link_assignment
Date: Thu, 09 Aug 2018 14:46:05 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23499

            Bug ID: 23499
           Summary: Incorrect code in bfd_elf_record_link_assignment
           Product: binutils
           Version: 2.32 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

bfd_elf_record_link_assignment has

  /* If this symbol is not being provided by the linker script, and it is
     currently defined by a dynamic object, but not by a regular object,
     then clear out any version information because the symbol will not be
     associated with the dynamic object any more.  */
  if (!provide
      && h->def_dynamic
      && !h->def_regular)
    h->verinfo.verdef = NULL;

which is only called from gld${EMULATION_NAME}_find_exp_assignment in elf32.em:



  bfd_boolean provide = FALSE;

  switch (exp->type.node_class)
    {
    case etree_provide:
    case etree_provided:
      provide = TRUE;
      /* Fallthru */
    case etree_assign:
      /* We call record_link_assignment even if the symbol is defined.
         This is because if it is defined by a dynamic object, we
         actually want to use the value defined by the linker script,
         not the value from the dynamic object (because we are setting
         symbols like etext).  If the symbol is defined by a regular
         object, then, as it happens, calling record_link_assignment
         will do no harm.  */
      if (strcmp (exp->assign.dst, ".") != 0)
        {
          if (!bfd_elf_record_link_assignment (link_info.output_bfd,
                                               &link_info,
                                               exp->assign.dst, provide,
                                               exp->assign.hidden))
            einfo (_("%F%P: failed to record assignment to %s: %E\n"),
                   exp->assign.dst);
        }

When linker defines a symbol with etree_assign, provide is FALSE and
h->verinfo.verdef isn't cleared.  When h->verinfo.verdef isn't NULL, we
associate a linker defined symbol, which was previously defined in a
dynamic object, with the version information from the dynamic object.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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