Can the runtime be disabled in GDC?

Iain Buclaw ibuclaw at gdcproject.org
Sun Dec 1 02:17:23 PST 2013


On Dec 1, 2013 8:25 AM, "Mike" <none at none.com> wrote:
>
> I finally got a GDC cross-compiler compiled, and I'm currently trying to
test it.  My simple "hello world" program does not use any D runtime
features, and I was able to compile it with LDC -noruntime -nodefaultlib.
>
> However, when I try to use GDC, I get...
>
> "cannot find source code for runtime library file 'object.d'"
>
> Are there similar options in GDC to disable the D runtime, or will I have
to write stubs?
>
> And, does GDC have any D-specific options?
>

You will require at least an object.d file to provide stubs - minilibd
sbould be sufficient IIRC.

There is -nodefaultlibs, or -nostdlib (which bypasses libgcc also).
However, the compiler may generate calls to memcmp, memset, memcpy and
memmove.  So these should be provided for if you are not linking against
some sort of libc.

If you are linking against libc, and just don't want phobos, then there is
-nophoboslib.  This will also omit linking to druntime as currently there
are bundled as one library.

You also have -nostartfiles if you wish to also provide for the
crtstart.o/crtend.o startup files.

Currently there is no way to interface with dmd's -betterC switch. So if
you don't want moduleinfo tidbits to be written, then you'll have to patch
the compiler (d-lang.cc: d_init_options) - I can of course get this in as
soon as possible .  I'm not sure of ldc's -noruntime switch, but I am going
to assume its functionality and say there is no equivalent in gdc.  What
would be nice though is a warning on any operations that cause implicit
allocation/external calls.

Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20131201/a78a5d9d/attachment.html>


More information about the D.gnu mailing list