[llvm-bugs] [Bug 48548] New: LLD as a library doesn't reset its global states across calls
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 17 12:08:20 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48548
Bug ID: 48548
Summary: LLD as a library doesn't reset its global states
across calls
Product: lld
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedbugs at nondot.org
Reporter: dpldobrev at protonmail.com
CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com
lld is explicitly documented as invokable as a library at https://lld.llvm.org/
:
"You can embed LLD in your program to eliminate dependencies on external
linkers. All you have to do is to construct object files and command line
arguments just like you would do to invoke an external linker and then call the
linker’s main function, lld::elf::link, from your code."
However, LLD uses a global state which isn't reset across invocations. The
problem is detailed in more detail at
https://github.com/ziglang/zig/issues/3825 . I guess the reporter meant items
such as
https://github.com/llvm/llvm-project/blob/main/lld/MachO/Driver.cpp#L695 or
https://github.com/llvm/llvm-project/blob/main/lld/MachO/Driver.cpp#L777 . The
latter example is especially showing because I have to call the contents of
InitLLVM() myself as I compile before linking so LLD as a library should be
smart not to call it a second time.
--
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/20201217/caf4a5b8/attachment.html>
More information about the llvm-bugs
mailing list