[llvm-bugs] [Bug 52070] New: Errors when linking multiple times in the same process through the API

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 4 16:40:38 PDT 2021


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

            Bug ID: 52070
           Summary: Errors when linking multiple times in the same process
                    through the API
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: MachO
          Assignee: unassignedbugs at nondot.org
          Reporter: dpldobrev at protonmail.com
                CC: gkm at fb.com, jezreel at gmail.com,
                    llvm-bugs at lists.llvm.org, smeenai at fb.com

Created attachment 25325
  --> https://bugs.llvm.org/attachment.cgi?id=25325&action=edit
A tarball created by --reproduce

I use LLD as a library:

lld::macho::link(args, false, outs(), errs());

with these arguments:

-flavor darwin -arch x86_64 -platform_version macos 10.12.0 10.12.0 -dylib
-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lc++ -lSystem
-rpath .

I call this function multiple times in the same process. The result is that I
get various linking errors for both system and local functions:

-flavor darwin : error : undefined symbol: _memcpy
-flavor darwin : error : undefined symbol:
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_

When I reduce the calls to just one, it passes with no errors.
It's possible that this bug is connected to state: it isn't reset after each
call because it's global.

It's important to know that this only happens in MachO and just the new one.
That is: COFF, MinGW, Linux and the old MachO work just fine.

-- 
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/20211004/d14b6d05/attachment.html>


More information about the llvm-bugs mailing list