Commit graph

62 commits

Author SHA1 Message Date
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
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +01:00
Johan Engelen
03b990a7fa
Remove ldc.profile.getData(string) to remove profile-rt Phobos dependency (#2464)
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.
2017-12-27 20:38:49 +01:00
Ivan
33c6cbb807 Renaming 2017-11-09 21:29:32 +03:00
Ivan
ae4db7d3b3 Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-11-01 22:24:27 +03:00
kinke
aeaf35c42f
Add -linker command-line option (#2386)
To set the linker executable for MSVC targets (e.g., `lld-link`) or the
`-fuse-ld` arg for the gcc linking command-line for the other targets.
2017-10-28 01:21:24 +02:00
Martin
5d68cd1627 Add predefined version CRuntime_Musl 2017-10-27 13:33:01 +02:00
Ivan
afae2f296b remove isRuntimeCompileEnabled() function 2017-10-15 23:24:36 +03:00
Ivan
808f36b2d2 Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-10-01 17:02:50 +03:00
kinke
ae9d43c167 Use LLVM headers for shared codegen command-line options (#2148)
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.
2017-09-20 01:04:43 +02:00
Ivan
ccc87bdb9d opts::isRuntimeCompileEnabled() helper function 2017-09-06 21:20:49 +03:00
Ivan
a9f6875494 Do not use exteranl storage for enableRuntimeCompile flag 2017-09-05 21:23:39 +03:00
Ivan
42f283c221 D dynamic compilation support 2017-08-27 17:42:55 +03:00
Johan Engelen
4a820f1449 libFuzzer: support LLVM 6.0 compiler-rt fuzzer (#2285)
libFuzzer was moved to compiler-rt, and therefore its location and filename has changed.
Tested locally on OSX only.
2017-08-24 18:41:06 +02:00
kinke
3b2f6bccdb Don't use -m32/-m64 for external ARM assembler (#2264)
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.
2017-08-12 18:17:03 +02:00
Johan Engelen
80118cff25 Add hidden option to disable automatic linking with c++ stdlib 2017-07-26 22:04:48 +02:00
Johan Engelen
800dc5a97f Add automatic libFuzzer linking + fuzz test 2017-07-26 22:04:48 +02:00