Commit graph

78 commits

Author SHA1 Message Date
Martin Kinkelin
694edca0ac Generalize rt.dso_windows to rt.dso, for Posix too
Addressing #3786.
2022-01-13 17:00:23 +01:00
Martin Kinkelin
e125411e98 Linux: Don't default to ld.gold linker
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.
2021-10-23 19:58:59 +02:00
Johan Engelen
a5025bf83e
Add MSan compiler-rt library to LDC install and add it to linkerline for --fsanitize=memory (#3751)
* Add MSan compiler-rt library to LDC install and add it to linkerline for --fsanitize=memory

* MSan: Add support for `-fsanitize-memory-track-origins=`
2021-06-07 00:29:18 +02:00
Martin Kinkelin
282ade3e31 If the LLVM is shared, add its lib dir to the hardcoded list used for library lookups
When looking up the LTO linker plugin and compiler-rt libraries.
2021-02-20 14:49:47 +01:00
Martin Kinkelin
fd3784001c -link-internally: Switch to LLD's new Mach-O port v2 with LLVM 12
AFAIK, the old port wasn't usable with LDC anyway, so eagerly switch
to the new one; the guys think it's mature enough to be the default
for `ld64.lld`:

https://lists.llvm.org/pipermail/llvm-dev/2021-January/147665.html
2021-02-12 07:54:41 +01:00
Martin Kinkelin
79b226973f Darwin: Remove libdl as default platform lib
It's apparently not required to link with dl{open,close} and e.g.
not set in CMAKE_DL_LIBS for Darwin targets.
2021-02-10 03:27:43 +01:00
Martin Kinkelin
4134289978 Musl: Use libunwind for druntime backtraces 2021-01-16 12:12:34 +01:00
Martin Kinkelin
0ae530f966 Merge upstream stable (dlang/dmd@ebd5e81dc9) 2021-01-06 23:34:36 +01:00
Martin Kinkelin
96b9cde428 Add support for LLVM 11
One major change is the removal of llvm::CallSite, which I've replaced
by llvm::CallBase*.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
18ed3efe4d Extend -platformlib to Posix targets 2020-08-14 17:55:35 +02:00
Johan Engelen
1ba4128cce
Copy LLVM's ThreadSanitizer (TSan) library to LDC's libraries like we do for ASan, and set the correct linker flags (#3522)
* 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.
2020-08-03 15:11:13 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
535160458d Fix naked DMD-style asm emission for non-Mac x86 Darwin targets 2020-06-26 20:07:19 +02:00
Martin Kinkelin
af1ed6d3e7 Android: Default to bfd linker for adjacent .tdata/.tbss sections
Hardcoded to simplify cross-compilation (no need to add `-linker=bfd` to
ldc2.conf).
2020-06-14 12:36:07 +02:00
Johan Engelen
1aa55f7879
Give user possibility to avoid passing -fuse-ld to cc with --linker=. (#3382) 2020-03-24 00:12:33 +01:00
Martin Kinkelin
2d86e49fba
Finalize support for LLVM 10 (#3323) 2020-02-14 17:53:40 +01:00
Fangrui Song
0a007a55f8
Fix StringRef conversion for LLVM 11 (777180a32b61070a10dd330b4f038bf24e916af1) (#3305) 2020-02-01 02:52:35 +01:00
Martin Kinkelin
ec1c37a5a4
Azure CI: Build LDC itself with full LTO, on Linux and Mac too (#3236) 2020-01-15 00:21:35 +01:00
myfreeweb
d13ae13308 Enable gc-sections on FreeBSD (#3106) 2019-08-24 14:19:04 +02:00
myfreeweb
73cf033dca Do not require gold plugin when linking with LLD (#3105)
LLD supports plugin-style flags, but the plugin itself might not exist.
2019-08-06 20:59:14 +02:00
Johan Engelen
a10988db83 Amend function name. 2019-01-19 21:41:33 +01:00
Johan Engelen
82dccbab23 CMake: from LLVM 7, also copy xray-basic, xray-fdr, and xray-profiling clang runtime libraries. 2019-01-17 01:22:17 +01:00
Johan Engelen
070fd639b4 Link with C++ stdlib when linking with XRay before LLVM 7. 2019-01-16 11:46:11 +01:00
Martin Kinkelin
c7b17368c3 Support external wasm-ld linker for WebAssembly targets
Overridable with `-linker`.
2018-12-23 17:26:12 +01:00
Joakim
8eee08b710 Android: don't use ld.gold by default yet. 2018-12-12 12:19:17 +05:30
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
b12f2eae8d Default to ld.gold on Linux in general, not just with -flto=thin 2018-10-15 22:36:47 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
aace02ae13 Work around LLD 7 segfault in wasm driver on Linux 2018-09-26 17:21:35 +02:00
Martin Kinkelin
281efb6655 Don't use OS/arch suffix for installed ldc-rt lib copies
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.
2018-09-03 19:28:44 +02:00
Martin Kinkelin
a29d5fd53e Use config file's lib-dirs when searching for compiler-rt libs
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.).
2018-07-25 01:49:10 +02:00
Martin Kinkelin
ac070a386d Config file: Add lib-dirs array
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.
2018-07-24 21:27:43 +02:00
Martin Kinkelin
27e4ac0304 Add -link-internally support for MinGW and WebAssembly targets 2018-07-09 20:25:32 +02:00
Johan Engelen
0c8c0e6a18 Fix build with LLVM trunk. (#2767) 2018-07-09 20:09:44 +02:00
Martin
9288418476 Default to gold linker for ThinLTO on Linux
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.
2018-05-12 16:38:55 +02:00
Martin
6812e0bcd4 Merge branch 'master' into merge-2.079
Conflicts:
	driver/cl_options.h
	driver/configfile.h
	ldc2.conf.in
	ldc2_phobos.conf.in
2018-04-22 14:31:31 +02:00
Martin
82a6ccd293 Refactor default libs linker stuff to driver/linker.cpp 2018-04-21 18:23:59 +02:00
Martin
71f3401b4e Set rpath with -enable-dynamic-compile too (shared ldc-jit lib) 2018-04-21 18:23:59 +02:00
Martin
891234bbe4 Only set rpath when linking against shared default libs 2018-04-21 18:23:59 +02:00
Martin
fcbf99d394 Integrate LLD 6.0.0+ for ELF and Mach-O targets
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.
2018-04-15 02:45:48 +02:00
David Nadlinger
68d3c64318
Merge pull request #2373 from kinke/musl
Add predefined version CRuntime_Musl
2018-01-31 00:05:47 +00:00
Johan Engelen
80fc2a2f08 PGO: switch to using compiler-rt profile library. (#2527)
Also makes sure that the PGO runtime is available when doing the PGO tests.
2018-01-30 20:36:58 +01:00
Martin
1b860e70d7 Merge branch 'master' into merge-2.078 2018-01-26 18:52:49 +01:00
Johan Engelen
1da088330d
Add basic clang-like support for XRay, through -fxray-instrument and -fxray-instruction-threshold=. (#2465)
Currently only fully working on Linux.
See https://llvm.org/docs/XRay.html
2018-01-23 22:06:05 +01:00
Johan Engelen
94c0d18d49
Extend search logic for finding compiler RT libs. (ASan and libFuzzer) (#2345)
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.
2018-01-22 21:47:19 +01:00
Martin
197e65efde Merge branch 'master' into merge-2.078
Conflicts:
	driver/main.cpp
	gen/cl_helpers.h
	gen/declarations.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
2018-01-20 11:20:17 +01:00
Johan Engelen
7f087f41a3
Merge pull request #2474 from JohanEngelen/irpgo
Add IR-based PGO
2018-01-18 22:18:59 +01:00
Johan Engelen
3f7bebfca4
Refactor search logic for finding compiler RT libs to not use global triple. (ASan and libFuzzer) (#2517) 2018-01-18 22:13:09 +01:00
Johan Engelen
3ec79179b4 PGO: refactor such that there can be IR-based and frontend-based PGO. 2018-01-15 23:59:14 +01:00
Martin Kinkelin
0bfd332915
Forward user-specified shared libs to linker (issue #2445) (#2485) 2018-01-13 00:03:17 +01:00