Commit graph

481 commits

Author SHA1 Message Date
Nicholas Wilson
906037988f
Move abi*.* to abi/ (#4192) 2022-09-21 13:16:04 +00:00
Nicholas Wilson
6b38ad0eff
Move gen/cl_helpers.* to driver/ (#4191) 2022-09-21 19:36:24 +08:00
Nicholas Wilson
1951db6d1d
Deprecate -check-printf-calls (#4183) 2022-09-18 10:25:43 +08:00
Nicholas Wilson
39727641d5
fix Optional deprecation in LLVM16 (#4177) 2022-09-16 16:16:51 +08:00
Martin Kinkelin
c555700c9d Predefine new version D_Invariants 2022-04-27 01:23:53 +02:00
Martin Kinkelin
b7b8e59043 Upgrade frontend & libs to v2.100.0-beta.1+ (dlang/dmd@c0cff59c79) 2022-04-26 23:01:13 +02:00
Martin Kinkelin
bdef01e7cc Raise min LLVM version to 9.0 2022-04-25 23:11:48 +02:00
Martin Kinkelin
603e773278
Merge pull request #3946 from drahosj/master
Added support for newlib
2022-04-07 22:54:44 +02:00
Martin Kinkelin
264776a3c9 [more liberal uclibc/newlib environment matching/patching]
To make e.g. `-mtriple=armv7-none-newlibeabi` work, where
`newlibeabi` was previously apparently treated as OS component
before normalization.
2022-04-07 04:53:50 +02:00
Martin Kinkelin
224217b193 [refactor fixup{UClibc,Newlib}Env] 2022-04-07 03:51:01 +02:00
Martin Kinkelin
143d7b3171 Fix compile & link errors against LLVM 14 2022-03-30 13:51:18 +02:00
Jake Drahos
543b218c88 Strip newlib without first parsing triple
Avoids issues where an environment won't be recognized
as the environment component when the specified as a less-than-full
quadruple.
2022-03-16 15:44:33 -05:00
Jake Drahos
7e01c62ef9 Added support for newlib
Similar to fixupUClibcEnv, fixupNewlibEnv checks for "newlib" within
the environment of the triple, sets a global flag, then removes [-]newlib
from the triple. This preserves "eabi" if present in the triple, and allows
both arm-unknown-none-eabi-newlib and arm-unknown-none-newlib to
work.
2022-03-16 14:02:49 -05:00
Martin Kinkelin
1e7fe83a0c Support *.{i,c} files as -run arguments too 2022-03-11 20:45:41 +01:00
Martin Kinkelin
4cbaebd965
Make -linkonce-templates less aggressive by default & add -linkonce-templates-aggressive (#3924)
Make -linkonce-templates *not* tamper with the general template
emission algorithm anymore (so on top of default non-allinst or
-allinst modes), and keep those tweaks as experimental
-linkonce-templates-aggressive.

Compiling the druntime/Phobos unittests is only marginally slowed
down compared to the more aggressive variant (~1.5% for debug,
~2.5% for release). It does show some rough 10% increase in required
memory, but that's in line with non-linkonce-templates.

The more aggressive variant has the advantage of skipping
needsCodegen() and potentially codegen'ing less symbols. The problem
is that if an instantiated symbol isn't explicitly referenced, for
instance a CRT ctor, it might not be codegen'd at all.
2022-03-01 00:10:34 +01:00
Martin Kinkelin
fa9897fb18 Sync with dmd/mars.d 2022-02-18 22:04:07 +01:00
Martin Kinkelin
a9877cb2b7 Remove orphaned dmd/root/root.h
This file isn't part of the upstream frontend anymore.
2022-02-17 02:14:48 +01:00
Martin Kinkelin
18d819cd83 Don't allocate frontend Arrays and OutBuffers on the C++ heap
That's just begging for trouble with -lowmem, as they contain roots to
(potentially GC-managed) D arrays.

After a rather superficial grep-check for `new ` in the *.{cpp,h} files,
these should be about all occurrences of frontend stuff previously
allocated on the C++ heap.
2021-09-17 03:49:28 +02:00
Martin Kinkelin
64d79ef753 Write JSON file with -Xi without -X/-Xf
Fixes dmd-testsuite's compilable/jsonNoOutFile.d.
2021-09-09 01:54:40 +02:00
Martin Kinkelin
e126c86b41 Adapt to global.params.useDIP1000 refactoring 2021-09-07 16:51:19 +02:00
Martin Kinkelin
d38c576919
Merge pull request #3808 from JohanEngelen/gh3802
Fix issue #3802 - Fix size_t size for 32bit ABI on 64bit architectures.
2021-08-14 20:44:10 +02:00
Martin Kinkelin
ec5fd799b9 Predefine version D_X32 for 64-bit targets with 32-bit pointer size 2021-08-14 18:52:23 +02:00
Johan Engelen
c517ce9d12
Improve ftime-trace implementation. (#3797)
* Improve ftime-trace implementation.
- Rewrite ftime-trace to our own implementatation instead of using LLVM's time trace code. The disadvantage is that this removes LLVM's work from the trace (optimization), but has the large benefit of being able to tailor the tracing output to our needs.
- Add memory tracing to ftime-trace (not possible with LLVM's implementation)
- Do not output the sum for each "category"/named string. This causes the LLVM output to be _very_ long, because we put more information in each time segment name. Tooling that processes the time trace output can do this summing itself (i.e. Tracy), and makes the time trace much more pleasant to view in trace viewers.
- Use MonoTime, move timescale calculation to output stage, 'measurement' stage uses ticks as unit
- Fix crash on `ldc2 -ftime-trace` without files passed.
2021-08-14 14:11:22 +02:00
Mathias LANG
926db58d5c
Driver: Use CppRuntime_Gcc by default with Musl (#3769)
While CppRuntime should ideally be moved out of the compiler,
it is currently reserved by the compiler and can't be defined
in user code. The most used Musl platform is Alpine Linux,
which doesn't have an alternative for CppRuntime_Clang,
so just define it to use Gcc for now.
2021-06-21 05:07:17 +00:00
Martin Kinkelin
a8475bec8a Add -dllimport CLI option for explicitly controlling implicit dllimports 2021-06-15 00:15:19 +02:00
Martin Kinkelin
9865e459d1 Windows: Make implicit dllimport more selective
* Newly require `-link-defaultlib-shared` for implicit dllimport.
  E.g., this enables to compile druntime DLL with `-fvisibility=public`
  for pure exports and no (local) imports (such as builtin TypeInfos).
* `-link-defaultlib-shared` alone now only implicitly imports symbols
  from druntime/Phobos.
  This simplifies building complex DLLs linked against a bunch of
  static libs (dub only supports static lib dependencies!); the static
  libs don't need to be compiled with `-fvisibility=public` anymore
  (if the DLL itself isn't either), `-link-defaultlib-shared` is
  sufficient.
  This is mainly useful for existing DLLs with explicit exports, to make
  them link against *shared* druntime/Phobos and so end up with a single
  druntime/Phobos for the whole process.
2021-06-14 17:47:32 +02:00
Martin Kinkelin
2ffe09ddbc Merge upstream stable (dlang/dmd@2adf6ff4f6) 2021-05-31 02:44:42 +02:00
Martin Kinkelin
331ca177d6 Fix upstream regression wrt. mutual init dependency of Type and Target
`Type._init()` depends on `Target.isLP64`, and `Target._init()` depends
on `Type.{twchar,tdchar}`. `Type` is initialized before `Target`.

Previously, `isLP64` was in `global.params`, which are initialized very
early.
2021-05-29 00:19:22 +02:00
Martin Kinkelin
1e00f63045 Adapt to upstream global.params.* -> target.* shuffling 2021-05-29 00:19:22 +02:00
Martin Kinkelin
bfa3cead08 Upgrade frontend & libs to early v2.097.0 (dlang/dmd@cb0457daf3) 2021-05-29 00:19:22 +02:00
Martin Kinkelin
ee0d5fbe3c Windows: Default to dllexport with -shared, and enforce dllimport with -link-defaultlib-shared 2021-05-03 20:54:57 +02:00
Martin Kinkelin
879c8ba465 Upgrade frontend & libs to v2.096.0-beta.1+ (dlang/dmd@0c2d8bd2ab) 2021-02-28 17:40:11 +01:00
Martin Kinkelin
d8bc064cfb Add support for LLVM 12 2021-02-12 07:54:41 +01:00
Martin Kinkelin
8d71c8624a
-cleanup-obj: Put object files into temporary directory by default (#3660)
To prevent conflicts for concurrent LDC processes in the same
working dir, resolving #3643.

Re-use this for the temporary object files of -run by enforcing
-cleanup-obj in that case. Additionally enforcing -oq prevents
conflicting filenames in that dir and allows to get rid of previous
Module.makeObjectFilenameUnique().
2021-02-11 00:08:47 +01:00
Martin Kinkelin
29b4355f26 Merge upstream stable (dlang/dmd@d8668e1afa)
Requiring some adaptations for enhanced emitMakeDeps functionality.
2021-02-08 21:23:59 +01:00
Martin Kinkelin
4134289978 Musl: Use libunwind for druntime backtraces 2021-01-16 12:12:34 +01:00
Martin Kinkelin
2172c605b4 Add support for -makedeps[=<filename>]
And streamline implicit -singleobj with DMD, also enforcing it when
compiling a *single* module *and* specifying the -of name.
[-makedeps currently depends on -singleobj.]
2021-01-07 15:55:00 +01:00
Martin Kinkelin
fe5a1776ac Merge remote-tracking branch 'origin/master' into merge-2.095 2021-01-06 23:58:20 +01:00
Martin Kinkelin
0ae530f966 Merge upstream stable (dlang/dmd@ebd5e81dc9) 2021-01-06 23:34:36 +01:00
Johan Engelen
29245c8255
Add --ftime-trace functionality. (#3624)
This uses LLVM's TimeProfiler functionality, such that LLVM's work is traced in the same profile (optimization and machine code gen).
Functionality is meant to be identical to Clang and LLD's --ftime-trace.
2020-12-28 17:05:04 +01:00
Martin Kinkelin
1ca4b9332b FreeBSD targets: Predefine version FreeBSD_<major>
As newly required for druntime.
2020-11-27 18:53:11 +01:00
Martin Kinkelin
c155e3c141
Merge pull request #3600 from kinke/linkonce2
Extend -linkonce-templates by matching template emission scheme
2020-11-27 02:45:14 +01:00
Martin Kinkelin
145ce40b11 Extend -linkonce-templates by matching template emission scheme
I.e., *define* templated symbols in each referencing compilation unit
when using discardable linkonce_odr linkage, analogous to C++.

This makes each compilation unit self-sufficient wrt. templated symbols,
which also means increased opportunity for inlining and less need for
LTO. There should be no more undefined symbol issues caused by buggy
template culling.

The biggest advantage is that the optimizer can discard unused
linkonce_odr symbols early instead of optimizing and forwarding to the
assembler. So this is especially useful with -O to decrease compilation
times and can at least in some scenarios greatly outweigh the
(potentially very much) higher number of symbols defined by the glue
layer.

Libraries compiled with -linkonce-templates can generally not be linked
against dependent code compiled without -linkonce-templates; the other
way around works.
2020-11-13 02:41:11 +01:00
Martin Kinkelin
6343bf08a8
Predefine version FreeStanding when targeting bare-metal (#3608)
Resolves #3607.
2020-11-07 15:10:42 +08:00
Martin Kinkelin
baca172439
Fix LTO with -link-internally for MSVC targets (#3604)
Fixes #2657 by deferring the llvm_shutdown() call.

This allows to remove bundled lld-link.exe for the prebuilt Windows
packages.
2020-11-01 19:11:11 +01:00
Martin Kinkelin
47b25ca6ab Add support for -cov=ctfe
Incl. making sure `-cov=N ... -cov[=ctfe]` doesn't reset the required
percentage to 0.

Use a dummy *bool* option for a better help output (displaying `--cov`,
not `--cov=<value>`).
2020-09-23 20:57:06 +02:00
Martin Kinkelin
f202c851ae Upgrade frontend & libs to v2.094.0-beta.1 2020-09-22 00:06:19 +02:00
Martin Kinkelin
877ce6fe4c
Add -gdwarf CLI option to emit DWARF debuginfos for MSVC targets (#3533)
Analogous to clang.
2020-08-11 10:30:31 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Hiroki Noda
0f1257fbca Remove RISCV_LLVM_DEV 2020-06-05 18:09:24 +09:00