[llvm-bugs] [Bug 34057] New: LLD inserts global symbols into dynamic symbol table for executable

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 3 14:53:24 PDT 2017


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

            Bug ID: 34057
           Summary: LLD inserts global symbols into dynamic symbol table
                    for executable
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: smeenai at fb.com
                CC: compnerd at compnerd.org, grimar at accesssoftek.com,
                    llvm-bugs at lists.llvm.org, rafael.espindola at gmail.com,
                    ruiu at google.com

% cat f.c
void f() {}
void g() {}

% cat f.list
{ f; }

% cat f.script
{ global: f; g; };

% clang -c f.c
% ld.bfd --dynamic-list f.list --version-script f.script -o f f.o
/lib64/libc.so
% nm -D f
0000000000400230 T f

% ld.lld --dynamic-list f.list --version-script f.script -o f f.o
% nm -D f
0000000000201000 T f
0000000000201010 T g

(the /lib64/libc.so link for ld.bfd is needed because BFD and gold require an
executable to link against at least one so to get a dynamic symbol table,
whereas lld doesn't; the so being linked against isn't important. LLD doesn't
require this, which is another behavior difference; I don't know if that's
worth changing.)

BFD (and gold) only place symbols in the dynamic list in the dynamic symbol
table; LLD places any symbol marked as global in the dynamic symbol table. This
appears to be a consequence of LLD conflating the handling for dynamic lists
and version scripts (PR34053 is another consequence); it also complains about
having a duplicate symbol 'f' in version script, which doesn't seem right
either.

-- 
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/20170803/847fa90b/attachment.html>


More information about the llvm-bugs mailing list