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.
Remove ldc.profile.getData(string) to remove profile-rt Phobos dependency.
Now only the templated code in ldc.profile depends on Phobos, so it's possible to link with profile_rt without requiring Phobos.
I.e., llvm/CodeGen/CommandFlags.h which in turn includes
llvm/MC/MCTargetOptionsCommandFlags.h.
This gets rid of a few duplicates on our side and includes about 35
(depending on LLVM version) new command-line options. LLVM provides a
helper function to set up the TargetOptions according to (most of) these
options.
Newer LLVM versions may add new options and we'll automatically inherit
them, including setting up the TargetOptions accordingly.
I did my best (TM) to remove a few unused/undesirable options and hide all
remaining new ones except for `-fp-contract`. The lists will need to be
tweaked from time to time.
And merge the two out-of-sync copies for adding gcc target flags. The flag
was omitted for gcc as linker already, but not for gcc as external assembler.