[llvm-bugs] [Bug 32603] New: [lld-link] Spourious duplicate symbol error

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 10 10:53:32 PDT 2017


            Bug ID: 32603
           Summary: [lld-link] Spourious duplicate symbol error
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: COFF
          Assignee: unassignedbugs at nondot.org
          Reporter: Alberto.Magni at microsoft.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18261
  --> https://bugs.llvm.org/attachment.cgi?id=18261&action=edit
Reproducer and possible fix.

We have noticed an inconsistency between the link.exe and lld-link.exe

Consider this example:

foo1.ll defines a function foo
foo2.ll defines a function foo
main.ll contains main that calls foo
foo1.ll is assembled into an object file and then into a library
foo2.ll is assembled into an object file

The following command currently fails:

lld-link.exe foo1.lib main.obj foo2.obj

The error is: duplicate symbol: foo

While the same invocation works with link.exe

This is because link processes all .obj files in input first and resorts to
.lib inputs only if there are unresolved symbols.
Since the symbol foo is found in the .obj the library is ignored and no error
is reported.

A reproducer for this bug is attached in the format of an LLVM test.
The same diff file contains a possible fix.

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/20170410/285e2c0c/attachment.html>

More information about the llvm-bugs mailing list