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: unassignedb...@nondot.org
          Reporter: dpldob...@protonmail.com
                CC: llvm-bugs@lists.llvm.org, smithp...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to