Tiny executables
David Nadlinger via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Fri Sep 19 01:07:38 PDT 2014
On 19 Sep 2014, at 6:45, Vladimir Panteleev via digitalmars-d-ldc wrote:
> 1. I couldn't find an equivalent to DMD's -betterC, to avoid
> generating ModuleInfos. I thought that -fdata-sections and
> -ffunction-sections would make it unnecessary, however LDC still
> generates a .ctors section, which linkers don't discard.
We are currently lacking something like that, unfortunately. It
definitely would be worth adding something along the lines of -betterC
(with a more descriptive name, that is).
There is pragma(LDC_no_moduleinfo) [1], though, which might still get
you a long ways.
> 2. How does one do incremental compilation and LTO with LDC? Clang has
> -emit-llvm, but ldc2.exe doesn't have such an option.
-output-ll/-output-bc. You currently need to do the LTO part by hand,
though (using opt and then llc to generate code).
> 3. Do I understand correctly that LDC uses COFF object files, however
> uses gcc/ld for linking? Meaning that MinGW uses COFF files on Windows
> as well?
OTOH, yes, MinGW also emits object files as COFF. If you are only
interested in Win64 you could also try to use the MSVC-based toolchain.
There are still some issues with it, but if you only need low-level
stuff anyway and thus do not care about bugs in e.g. exception handling,
it might work out just fine. Stripping unused sections actually works
with link.exe, in contrast to MinGW's COFF linker.
David
[1]
http://wiki.dlang.org/LDC-specific_language_changes#LDC_no_moduleinfo
More information about the digitalmars-d-ldc
mailing list