[llvm-bugs] [Bug 26732] New: lld needs to provide _DYNAMIC symbol when creating a shared library

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 24 19:33:23 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26732

            Bug ID: 26732
           Summary: lld needs to provide _DYNAMIC symbol when creating a
                    shared library
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: emaste at freebsd.org
                CC: llvm-bugs at lists.llvm.org
            Blocks: 23214
    Classification: Unclassified

Created attachment 15943
  --> https://llvm.org/bugs/attachment.cgi?id=15943&action=edit
sample test case for _DYNAMIC symbol

The linker-provided _DYNAMIC symbol is required by FreeBSD's rtld to find its
own DYNAMIC segment.

Example showing how it is used, from FreeBSD's rtld.c, rtld_machdep.h:
---
/* Return the address of the .dynamic section in the dynamic linker. */
#define rtld_dynamic(obj) \
    ((const Elf_Dyn *)((obj)->relocbase + (Elf_Addr)&_DYNAMIC))

#define     RTLD_IS_DYNAMIC()       (&_DYNAMIC != NULL)

extern Elf_Dyn _DYNAMIC;
#pragma weak _DYNAMIC
...
    if (RTLD_IS_DYNAMIC()) {
        objtmp.dynamic = rtld_dynamic(&objtmp);
---

Attached is a test case sample that passes with ld.bfd.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160225/17ad4392/attachment.html>


More information about the llvm-bugs mailing list