Commit graph

66 commits

Author SHA1 Message Date
Martin Kinkelin
6aabae4f99
Windows: Avoid accidentally using GNU link.exe for linking (#4718)
This happens in an environment where MSVC was set up first (so env
var VSINSTALLDIR defined), and later prepending a dir such as
`C:\Program Files\Git\usr\bin` to PATH, so that the first link.exe
on PATH isn't the Microsoft one.
2024-08-07 21:25:23 +02:00
Harry Gillanders
b29edc8d6b
Handle already-set-up MSVC environments targeting AArch64/ARM. (#4625) 2024-04-23 12:23:43 +02:00
Martin Kinkelin
3a6f2cae33
Make compiler inject appropriate -target option when linking Mach-O binaries (#4589) 2024-03-25 00:25:32 +01:00
Martin Kinkelin
75c4ef8adb
Windows: Don't split CC into command + arguments separated by spaces (#4590) 2024-03-02 07:33:40 +00:00
Andrei Horodniceanu
d7f87811f6
support CC envvar to be in the form "command args..." (#4582)
In case CC is set try to split it by spaces into a command and
arguments. This is the same behaviour as in dmd.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2024-02-24 16:46:35 +01:00
Martin Kinkelin
a053480010 Misc. merge fixes (C++) 2023-11-06 00:33:57 +01:00
liushuyu
a49db8e5d3
Add initial support for LoongArch64 (#4500) 2023-10-05 12:36:01 +02:00
Martin Kinkelin
a2c63b6fea [slightly revise] 2023-08-25 16:39:13 +02:00
Andreas Schwab
cb33ca6ddc Default to rv64gc for hosted riscv64 target
Also select the correct ABI by default matching the enabled features
(double, float or no floating point).

Fixes #4375
2023-08-24 15:38:38 +02:00
Martin Kinkelin
483b23595a Windows: Cache some more MSVC environment stuff 2023-06-09 20:27:39 +02:00
Martin Kinkelin
04bcdc4d06 Set up MSVC environment for C preprocessing on Windows 2023-06-09 15:33:20 +02:00
Martin Kinkelin
5b137768a0 Run C preprocessor 2023-06-07 12:06:25 +02:00
Zachary Yedidia
7f2498b6cd
Allow RISC-V ABI to be configured by mabi (#4322) 2023-02-14 21:46:10 +00:00
Martin Kinkelin
ac4aa4dc43
Fix #4317 - 64-bit RISC-V cc flags wrongly applying to 32-bit RISC-V too (#4318) 2023-02-10 04:08:48 +01:00
Ast-x64
40ec6da71f RISCV64: Initial support
This adds support for riscv64gc with default LP64D ABI.
2022-06-28 22:37:21 +08:00
Martin Kinkelin
3b81505534
Don't silently ignore invalid external tool specifications (#3841)
To prevent bad experiences like
https://forum.dlang.org/post/tjsbfalkosmrebhjfmah@forum.dlang.org.
2021-10-06 17:12:58 +02:00
Martin Kinkelin
1f063d4ae9 Refactor response file stuff shared by ldmd and ldc
By hiding the common functionality behind args::executeAndWait().

Also make sure to properly escape quoted args in response files.
2020-08-09 01:11:46 +02:00
Martin Kinkelin
5194181b66 Windows hosts: Fix linker cmdline length limitation via response files
Fixes #3535 and an issue for ldmd2 wrt. unquoted args containing spaces
in response files for ldc2 (uncovered during manual tests). Also create
the temporary response files in the temp directory, not in the current
working dir.
2020-08-08 01:47:52 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
84ef937416
Switch to a white list of archs wrt. -m32/-m64 in cc cmdlines (#3460)
According to the gcc 10.1 cmdline docs.
2020-06-11 13:35:17 +02:00
Martin Kinkelin
e436cb0aad Don't skip MSVC setup in a preset environment if the target arch doesn't match
This doesn't work for VS 2015, but 2017 and 2019. For VS 2015, I haven't
found a suitable env var, and I don't want to parse LIB and/or PATH to
guess the target architecture (LDC_VSDIR_FORCE can still be used).
2020-05-01 01:57:20 +02:00
Martin Kinkelin
18406bcc06 Adopt DMD's MSVC toolchain detection
This reduces the overhead for auto-detecting and setting up an MSVC
toolchain from a very rough 1 second to about 8 milliseconds on my box.
Enabling the auto-detection by default (and so preferring MSVC over the
'internal' toolchain if there's a Visual C++ installation) is now
possible, fixing issues like #3402.

The MSVC setup now consists of the bare minimum - prepending 3
directories to the LIB env var and 1-2 directories to PATH.
2020-04-30 21:45:56 +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
3b831968f8 Windows: Only modify & restore *changed* env variables during MSVC setup
Primarily not to spam -v output.
2020-02-26 22:55:59 +01:00
Martin Kinkelin
bab3021f8b Windows: Fix (potential?) console font change during MSVC env setup 2020-02-26 17:05:31 +01:00
Martin Kinkelin
36ebcbafe0 Windows: Support special LDC_VSDIR_FORCE env variable to enforce MSVC env setup
As alternative to clearing VSINSTALLDIR if run in a pre-set environment,
or as alternative to setting LDC_VSDIR to some non-existing dummy dir to
prefer auto-detection and setup of the MSVC toolchain over using the
internal toolchain.
2020-02-26 02:43:23 +01:00
Martin Kinkelin
c8194626d8 Windows: Do not leak MSVC-environment-setup into -run child processes 2020-02-26 00:28:17 +01:00
Martin Kinkelin
639d8bcfb1 Minimally revise -gcc cmdline help 2019-11-17 15:20:34 +01:00
Martin Kinkelin
6e4c389a82 CLI: Unhide -gcc, list under linking options, and revise description
As it's an important option for cross-linking to Posix. It doesn't just
affect linking, but external assembling is probably very exotic
(-no-integrated-as).
2019-10-27 00:12:13 +02:00
Martin Kinkelin
e58316a603 POSIX: Default to cc for linking, not gcc (or clang for FreeBSD 10+) 2019-10-27 00:12:13 +02:00
Martin Kinkelin
ae23a47cdb Tweak usage of LLVM Unicode conversion functions 2019-08-08 22:38:38 +02:00
Martin Kinkelin
42619762e9 Windows: Read environment variables as UTF-8
And use the wide API for pure is-env-variable-set checks too, as the
first call to a narrow env API function would lead to the C runtime
preparing and maintaining both narrow and wide environments.
2019-08-08 22:38:38 +02:00
Martin Kinkelin
64d91629cf Use wide WinAPI functions
There might be more occurrences.
2019-08-08 22:38:38 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +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
0e422af0c0
Fix corrupt prefix in integrated LLD's console output (#2781) 2018-07-18 11:38:18 +02:00
Johan Engelen
0c8c0e6a18 Fix build with LLVM trunk. (#2767) 2018-07-09 20:09:44 +02:00
Martin
df4f854dd5 Upgrade to D v2.079.0-beta.1 2018-02-20 02:04:41 +01:00
Martin Kinkelin
6b462b1018
Generalize defaultlibs cmdline help category to linking options (#2496) 2018-01-14 00:03:27 +01: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
d7f68dbeb3 Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
2017-10-01 18:28:44 +02:00
Johan Engelen
bc9ead927c Fix LLVM 6.0 compilation.
See https://reviews.llvm.org/D37563
2017-09-18 11:16:23 +01:00
Martin
923e30ec50 Merge branch 'master' into merge-2.075 2017-08-21 01:23:18 +02:00
Martin
acfa2dfb1c [MSVC] CMake: Prepare for LLVM 5.0
Some LLVM libs were missing from the linker flags for current LLVM 5.0.
It was only during troubleshooting that I noticed the MSVC special case in
FindLLVM.cmake. Getting rid of it entirely made the issues disappear. I
checked llvm-config.exe, and it's returning appropriate switches for the
MS toolchain, no need for special processing.

This apparently also leads to LLVM_CXXFLAGS being used for the first time
when building with MSVC. These include /W4, a level further up from
CMake's default /W3, so I disabled a few more frequent warnings.

I also had to link in a lib from Microsoft's Debug Info Access SDK
manually. As the VS command prompt unfortunately doesn't even include the
DIA SDK dir in the LIBPATH environment variable, I even had to specify a
full path, relying on the `VSINSTALLDIR` environment variable.
2017-08-17 23:49:37 +02:00
Martin
b085be1404 Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
	runtime/phobos
2017-08-12 18:21:21 +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
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +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
ec1a54aade Move static lib generation from driver/linker.cpp to driver/archiver.cpp 2017-05-26 21:55:25 +02:00