Commit graph

465 commits

Author SHA1 Message Date
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
Roberto Rosmaninho
6274217c39
Add -output-mlir and prepare for MLIR emission (#3313) 2020-05-22 12:31:24 +02:00
Ernesto Castellotti
c40bbbc320
AVR: Add predefined version AVR and emit TLS globals as regular ones (#3420)
The AVR target on LLVM and AVR-GCC does not have support for TLS, so
it is necessary to emit global variables as NotThreadLocal.
2020-05-08 22:47:10 +02:00
Martin Kinkelin
ff36be2c01
Do not fallback to host for critical section size of unknown targets (#3389)
Instead, error out whenever requested by an expression-less
`synchronized` statement, including source LoC to track it down.

This is safer, especially since the previous initial warning may likely
be suppressed, and makes this host-agnostic.

Also suppress previous warnings about unknown `` and `none` OS, treating
these like `unknown`.
2020-03-30 21:26:51 +02:00
Martin Kinkelin
26678a1631 Support new CLI switches -verror-style and -HC, -HCd, -HCf 2020-02-27 01:54:28 +01:00
Martin Kinkelin
770383c3e7 Upgrade frontend & libs to early v2.091.0 (dlang/dmd@44112eb84b) 2020-02-22 00:33:49 +01:00
Martin Kinkelin
00a270e76f Add predefined versions WASI and CRuntime_WASI for triples like wasm32-unknown-wasi
Requires LLVM 8+.
2020-02-08 15:42:45 +01:00
Martin Kinkelin
bfde22d865 Properly disable GC without -lowmem
This is a cherry-pick from dlang/dmd#10752. Rainer has found out that
the compiler might crash with a segfault when aborting via exit() upon
some compile error, and that this seems to be related to GC worker
threads (so only an issue with recent host compilers), spawned because
of some module ctors bypassing `root/rmem.d` and using the GC directly,
like setting up an associative array in `imphint.d`.

He came up with a nice simple solution to this, making sure the GC
starts in disabled mode whenever it is initialized.
2020-02-05 22:06:22 +01:00
Martin Kinkelin
f22304abb0 Don't allocate front-end Strings on C++ heap
If the GC is enabled (-lowmem), it must know about those Array instances,
so that the GC-allocated array of pointers and referenced GC-allocated
strings are kept alive.
2020-02-05 22:06:22 +01:00
Fangrui Song
0a007a55f8
Fix StringRef conversion for LLVM 11 (777180a32b61070a10dd330b4f038bf24e916af1) (#3305) 2020-02-01 02:52:35 +01:00
Martin Kinkelin
97e0d978ee
Merge pull request #3288 from jacob-carlborg/ios
Add support for iOS, tvOS and watchOS
2020-01-28 22:55:50 +01:00
Martin Kinkelin
f1fb9d50fd Slightly revise iOS additions 2020-01-28 20:45:07 +01:00
Martin Kinkelin
78af39a5c7 Fix minor potential issues wrt. CLI parsing of -m32/-m64
Ignore it if the default triple (as opposed to the host) has the desired
bitness already. So only relevant if the default triple doesn't match
the host. I think that should render LDC-specific NO_ARCH_VARIANT in
dmd-testsuite's Makefile obsolete (if set, d_do_test won't add -m32/-m64
by default).

Also fix the config file section lookup in case both -m32 and -m64 are
specified.
2020-01-21 23:37:46 +01:00
Jacob Carlborg
b9c284537a Add predefined version identifiers for Apple platforms 2020-01-19 20:57:23 +01:00
Martin Kinkelin
7a6c536fe9 Merge remote-tracking branch 'origin/master' into merge-2090 2020-01-12 15:49:04 +01:00
Martin Kinkelin
f7a15a59c5
Support 2 leading dashes in manual CLI pre-parsing (#3275)
Fixes #3268 and related issues.
2020-01-12 13:31:22 +01:00
Martin Kinkelin
4ac7f0554b Adapt to frontend refactorings 2019-12-22 16:29:45 +01:00