Commit graph

37 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
cef4b3d6ef
Fix default cross-linker for MSVC targets on non-Windows hosts (#3282)
Fixes an annoyance reported in #3281, affecting non-LLD-enabled builds
as well as linker invocations involving LTO.
2020-01-16 11:56:54 +01:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
738f425344
MSVC: Add {oldnames,legacy_stdio_definitions}.lib to default C libs (#3036)
For -betterC convenience, as they are usually already pulled in by
druntime. Resolves #3035.
2019-03-21 21:01:03 +01:00
Martin Kinkelin
4fb4226d9a MSVC: Don't fold identical COMDATs if debuginfos are enabled 2018-11-03 20:32:02 +01:00
Martin Kinkelin
bdfc0f9b07 MSVC: Default to the internal 'toolchain' (-link-internally + MinGW-w64 libs) 2018-10-29 20:19:14 +01:00
Martin Kinkelin
7b7e0e927c MSVC: Prepare for MinGW-w64-based libs support
I got a std.stdio hello-world executable to work on Win64 using the
Visual C++ 2015 DLLs, with both MS linker and -link-internally, see
https://github.com/dlang/installer/pull/346.

It still requires a couple of extra command-line args, but will in the
end enable us to get rid of all external dependencies for building on
Windows (via -link-internally and the MinGW-w64-based import libs, which
will only add a few MB to the prebuilt packages).

The Visual C++ 2015 *runtime* will need to be installed when running
binaries linked against the MinGW libs.
2018-10-26 21:01:09 +02:00
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
0bd9a10234 Add LDC-specific support for __traits(getTargetInfo) 2018-10-20 16:19:46 +02:00
Martin Kinkelin
f206181577 MSVC: Default to lld-link.exe when linking with LTO 2018-08-19 21:19:48 +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
0e422af0c0
Fix corrupt prefix in integrated LLD's console output (#2781) 2018-07-18 11:38:18 +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
025c69cc65 Merge branch 'master' into merge-2.079
Conflicts:
	appveyor.yml
	driver/main.cpp
	runtime/druntime
	runtime/phobos
2018-04-15 18:46:39 +02:00
Martin
b032cfdf65 MSVC: Use absolute path to ldc_rt.builtins.lib
Otherwise linking only works if the directory is specified for the
linker, which may not be the case when disabling the config file via
`-conf=`.
2018-04-04 19:59:10 +02:00
Martin
f5f17bee6f Add support for LLD 6.0.0 2018-03-25 18:21:16 +02:00
Martin
842fb0264a Get rid of our profile-rt libs
Enabled by switching to the official compiler-rt lib on Windows too.
Move the profile.di module to druntime.
2018-02-03 14:56:30 +01:00
Martin
b7d12fe52f Windows: Add support for -fsanitize=address & link with builtins lib if found
The LLVM 5.0.1 ASan x64 lib doesn't work with VS 2017 v15.5.5; any
executable linked against it will hang at startup with the msg:
'ASan init calls itself!'

See https://github.com/google/sanitizers/issues/818.
2018-02-03 14:56:08 +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
3ec79179b4 PGO: refactor such that there can be IR-based and frontend-based PGO. 2018-01-15 23:59:14 +01:00
Martin Kinkelin
6b462b1018
Generalize defaultlibs cmdline help category to linking options (#2496) 2018-01-14 00:03:27 +01:00
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +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
Ivan
afae2f296b remove isRuntimeCompileEnabled() function 2017-10-15 23:24:36 +03: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
1d0ccf8e97 Use normal hyphen in linker.msvc.cpp. 2017-06-25 23:10:55 +02:00
Martin
383c2d3a59 Range-ify usages of front-end Arrays 2017-06-04 00:29:44 +02:00
Martin
9fd7fa2d90 Add experimental -link-internally switch to enable LLD opt-in
And infer CMake LDC_WITH_LLD automatically based on availability of LLVM
3.9+ with LLD headers & libs.
2017-05-29 22:45:32 +02:00
Martin
00d5f9b5b5 Integrate LLD for MSVC targets via experimental CMake option LDC_WITH_LLD
Results in a 7.5% bigger RelWithDebInfo ldc2.exe on Win64 with LLVM 3.9.1.

LLD is currently enforced when building with LDC_WITH_LLD=ON. And LLD
still doesn't support debuginfo (.pdb) generation for MSVC targets.
2017-05-27 21:21:31 +02:00
Martin
9c86ae9ad0 Refactor generation of GCC linker command line 2017-05-27 02:27:17 +02:00
Martin
cb0c27c3c5 Refactor MSVC link.exe driver into dedicated driver/linker-msvc.cpp 2017-05-26 23:57:21 +02:00