Big news
- Frontend, druntime and Phobos are at version 2.097.0. (#3741)
- LLVM for prebuilt packages bumped to v12.0.0, 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)
- 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 either-fvisibility=public
or-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. - 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)
Platform support
- Supports LLVM 6.0 - 12.0.
Bug fixes
- Fix debuginfo source file paths, e.g., including directories in exception stack traces. (#3687)
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.