I hope the issues with old bfd aren't really a thing anymore.
The main reason is that the user might have set LLD as default
`/usr/bin/ld` symlink, and LDC not using it by default isn't
intuitive. And LLD can be significantly faster than gold.
* Add MSan compiler-rt library to LDC install and add it to linkerline for --fsanitize=memory
* MSan: Add support for `-fsanitize-memory-track-origins=`
* Copy LLVM's ThreadSanitizer (TSan) library to LDC's libraries like we do for ASan, and set the correct linker flags.
Requires at least LLVM 8 for executable TSan test cases and TSan execution is not supported on Windows.
LDC's concept is different lib dirs per target triple, so the extra
suffix isn't needed and only complicates matters.
The lib names are now streamlined across targets; they already were on
Windows.
In addition (and preferred over) the previous searched-for lib dir
(`<bin dir>/../lib<LIB_SUFFIX CMake var>`). [Incl. searching in some of
their subdirs, e.g., `clang/x.y.z/lib/<OS>`.]
I skipped that backwards-compatibility thingy for the builtins lib on
Windows (not crucial, only linked (if found) on Windows etc.).
And replace the default `-L-L<path>` LDC switches in the default config
accordingly.
The first advantage is for cross-compilation, where additional sections
should now mostly get away with overriding `lib-dirs` (and `rpath` if
need be) only; not just to specify the directory containing cross-
compiled druntime and Phobos, but also further dirs containing the C
libs. No need to override a whole `[post-]switches` array anymore just
to tweak the lib dirs.
The second advantage is that we can search these dirs for compiler-rt
libs instead of being limited to `<bin dir>/../lib<LIB_SUFFIX specified
in CMake command line>` or trying to guess distro-specific paths
=> easy-peasy for distros and users.
This isn't implemented yet.
To work around issue #2278 out-of-the-box. ld.bfd still doesn't work on
Ubuntu 18.04, and `update-alternatives --install /usr/bin/ld ld
/usr/bin/ld.gold 99` doesn't work anymore.
LLD 5.0.0+ would work too, but as there's a new lldCommon library for
LLD 6.0.0 (and no more lldConfig), simply require 6.0.0+ to keep the
CMake setup reasonably simple.
This should help find the compilerRT libs when LDC is installed in the system's usual dirs. With this change, the ASan and libFuzzer libs do not necessarily need to be copied as part of building LDC.