(Changes since 1.27.0-beta2 are marked with (new).)
Big news
- Frontend, druntime and Phobos are at version 2.097.1-beta1+. (#3741, #3770, #3771, #3790) (new)
- LLVM for prebuilt packages bumped to v12.0.1, and Linux base image to Ubuntu 18.04. Unfortunately, the dynamic-compile (JIT) functionality is lost this way - it needs some more work to adapt to a newer LLVM API. (#3701, #3789) (new)
- Prebuilt packages now bundle reggae, a meta build tool to generate ninja/make build files for dub projects (and more). Building large projects with many dependencies can be significantly sped-up via parallelization and dependency tracking for incremental builds. (#3739)
Basic usage, in a dub project dir (containing adub.{sdl,json}
file):reggae -b ninja|make --dc=ldc2 # only needed the first time or when adding source files ninja|make [-j<N>]
- Greatly improved DLL support on Windows, making it almost as easy as on Posix:
-fvisibility=public
now also affects Windows, exporting all defined symbols as on Posix, without explicitexport
visibility. Compiling a DLL with-shared
now defaults to-fvisibility=public
for consistency with Posix. (#3703)- This paved the way for druntime and Phobos DLLs, now bundled with prebuilt Windows packages and linkable via
-link-defaultlib-shared
(default with-shared
, consistent with Posix targets). Previous hacks to partially accomodate for multiple, statically linked druntimes and Phobos in a single process (GC proxy etc.) aren't required any longer. With-link-defaultlib-shared
, LDC now defaults to-mscrtlib=msvcrt
, linking against the shared MSVC runtime. (ldc-developers/druntime#197, #3704, ldc-developers/druntime#198) - Limitation: TLS variables cannot be accessed directly across DLL boundaries. This can be worked around with an accessor function, e.g., ldc-developers/druntime@5d3e21a35d.
- Non-TLS
extern(D)
global variables not defined in a root module aredllimport
ed (with-fvisibility=public
, or - restricted to druntime/Phobos symbols - with-link-defaultlib-shared
). Compiling all modules of a DLL at once thus avoids linker warnings about 'importing locally defined symbol'. When linking a DLL against a static library, the static library may likely need to be compiled with-fvisibility=public
to make its globals importable from the DLL. There's a new-dllimport
option for explicit control. (#3763) - Caveat: symbols aren't uniqued across the whole process, so can be defined in multiple DLLs/executables, each with their own address, so you cannot rely on TypeInfos, instantiated symbols and functions to have the same address for the whole process.
- When linking manually (not via LDC), binaries linked against druntime DLL need to include new
lib\dso_windows.obj
. - To restore the previous behavior of
-shared
, add-fvisibility=hidden -link-defaultlib-shared=false
.
- Windows: ANSI color codes can now be enforced for redirected stderr via
-enable-color
. (#3744) - Prebuilt Linux and Mac packages now use the mimalloc allocator, significantly increasing compiler performance in some cases. (#3758, #3759)
- The prebuilt macOS x64 package now bundles shared druntime/Phobos libs for iOS too. (#3764)
- Possibly more performant shared Phobos library by compiling to a single object file with implicit cross-module inlining. (#3757)
- New
-cov-increment
option for more performant coverage count execution. (#3724) -fsanitize=memory
: Bundle according LLVM compiler-rt library and add new-fsanitize-memory-track-origins
option. (#3751)- New LDC-specific language addition:
__traits(initSymbol, <aggregate type>)
with semantics equivalent toTypeInfo.initializer()
, but circumventing theTypeInfo
indirection and thus e.g. also usable for-betterC
code. (#3774, ldc-developers/druntime#201) (new)
Platform support
- Supports LLVM 6.0 - 12.0.
Bug fixes
- Fix debuginfo source file paths, e.g., including directories in exception stack traces. (#3687)
- Fix potentially corrupt context pointers for nested functions with
-linkonce-templates
. (#3690, #3766) - Predefine version
CppRuntime_Gcc
for musl targets. (#3769) - RVO: In-place construct
<temporary>.__ctor(<args>)
. (#3778, #3779) (new) -linkonce-templates
: Make sure special struct TypeInfo members are semantically analyzed before emitting theTypeInfo
. (#3783) (new)
Known issues
- When building LDC, old LDC 0.17.*/ltsmaster host compilers miscompile LDC ≥ 1.21, leading to potential segfaults of the built LDC. Ltsmaster can still be used to bootstrap a first compiler and then let that compiler compile itself. (#3354)
- Buggy older
ld.bfd
linker versions may wrongly strip out required symbols, e.g., ModuleInfos (so that e.g. no module ctors/dtors are run). LDC defaults told.gold
on Linux. - LDC does not zero the padding area of a
real
variable. This may lead to wrong results if the padding area is also considered. See #770. Does not apply toreal
members inside structs etc.