Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue #3795 - Fix LDC linked dynamically
with Phobos and DRuntime when built with GDMD. Prepend arguments starting with "-B" in D_LINKER_ARGS with "-Wl," when using GDMD. The latter is needed because the arguments reported by GDMD are what is passed to COLLECT2 while D_LINKER_ARGS are later passed to CXX. The problem with that is that without "-Wl," prefix the -Bstatic and -Bdynamic arguments before and after -lgphobos and -lgdruntime are dropped. And that is a problem because without these the produced LDC is linked dynamically to libgphobos and libgdruntime so these have to be available whereever LDC is used. Once libgphobos and libgdruntime are linked statically symbol conflicts for _d_allocmemory, _d_newclass, _d_newitemiT and _d_newitemT symbols were revealed which are fixed by checking if these symbols are marked as weak in libgdruntime.a and if not "-Wl,-allow-multiple-definition" link option is added to avoid link failure.
- Loading branch information