[Lldb-commits] [PATCH] D26188: [RFC] Solve linking inconsistency, proposal one

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 1 09:31:45 PDT 2016


labath added a comment.

In https://reviews.llvm.org/D26188#584710, @zturner wrote:

> On Windows if you have a DLL (.so) that links against a .lib (.a), and an EXE links against both the DLL and the .lib, then both the DLL and the EXE will each get their own private copy of the symbols in the lib, and the linker won't try to merge them.
>
> Do I understand correctly that this is not the case on Linux?  If you have this:
>
>   foo
>     |__ lib.a
>     |__ slib.so
>         |__  lib.a
>
>
> That lib.a is mapped at one location, and all the constructors are invoked twice?
>
> If I understand correctly, then it sounds like you can do whatever you want to fix this, and just disable all of this machinery on Windows since it appears unnecessary.


Basically true. It's not that the lib will be mapped only once, but all reference to the each of the symbols from that library will be resolved so that they all point to exactly one copy (as required by the c++ spec). If you try to prevent that, funny things can happen, and that may well depend on the linker then. FWIW, the machinery is already disabled on windows.


https://reviews.llvm.org/D26188





More information about the lldb-commits mailing list