On Tuesday, 8 July 2014 at 17:54:48 UTC, David Nadlinger wrote:
Hi all,
I am excited to share news about two changes that recently made
their way into the development version of LDC, changes that
might be interesting for many of you Linux users out there.
The first is that LDC now supports linker-level dead code
elimination on Linux. If you happen to be familiar with the
-f{function,data}-sections/--gc-sections options of the GNU
toolchain, their equivalent is now enabled by default. For a
set of small-ish programs that make use of different parts of
Phobos, I've seen executable size improvements of close to 4x
(!) in my tests. However, as --gc-sections is known to
occasionally cause trouble with third-party code that relies on
specific linker behavior, this optimization can be disabled
with a new LDC switch, -disable-linker-strip-dead.
And secondly, proper support for building druntime/Phobos as
shared libraries and loading D shared objects dynamically has
now arrived in LDC! As you might be aware, Martin Nowak has
spent a considerable amount of effort on adding runtime loading
capabilities to DMD and druntime during the last year or so.
LDC now offers the same level of functionality, to a good part
based on Martin's solid work. To build a copy of LDC with
druntime/Phobos as a shared library, which is also required for
proper runtime loading, simply pass -DBUILD_SHARED_LIBS=ON to
CMake. Oh, and for now this is Linux-only too, sorry.
Even though I am currently not aware of any remaining issues,
there are likely a few rough edges still. To be able to
confidently ship these features as part of the next release,
we'd very much appreciate early feedback. Just grab LDC from
Git master and let us know how things went over on
digitalmars.D.ldc. If you run into a specific bug, you can also
directly open a ticket at
https://github.com/ldc-developers/ldc/issues.
Cheers,
David
Those are probably best news from D world I have heard in last
few months! Has anyone tried that on largish projects? Using GDC
with --gc-sections has resulted in broken binaries sometimes but
most likely it was the same ModuleInfo issue. Wonder how reliable
it is in LDC.