MessiahAndrw and any others:
First:
You will need a gdc built against nothing that targets your architecture (build a cross compiler). You will need gcc 4.1.2 and gdc 0.24 for it to work without hassle. It will complain about D_OS_VERSYM, which you should define as any arbitrary string. Like this:
Code: Select all
const char* cygwin_d_os_versym = "MyOS";
MessiahAndrw, you have already accomplished this.
Second:
Then have no standard library when building your actual kernel. That is, build with these flags to gdc: (written as it would be in a makefile)
Code: Select all
DFLAGS = -nostdlib -nodefaultlibs -g -mcmodel=kernel
Third:
The thing about gdc...it expects the runtime calls to be there and all 'magic' to be accounted for. You will need:
- all of the typeinfo-ish stuff
- the runtime stubs and
- object.d (which is complete magic)
object.d and much of the runtime needs to be at the root of a include path. We were lazy, it is in the root of our source trunk.
In XOmB's code:
- object.d - place at root of include path
- builtins.d - you will need this, it allows gcc 'magic' for va_args. We don't use variadics in the kernel. Note: it looks for gcc/builtins.d in the include path.
- std - some of the internals of the runtime. Should also be rooted in the include path.
- runtime stubs - You know what... just use ours. BSD'd for your freedom. It can be anywhere, just has to be linked.
- invariant.d - just more D runtime bull, copy from us. Can be anywhere, simply needs linked.
Just link everything together!
Eventually, in userland, you may need va_args as part of your user runtime (or your kernel, to each their own), which is COMPLETE magic in gdc as well. You will need to have
std/stdarg.d, you can use the one from XOmB. The file, as you can see, has an empty implementation, yet, the compiler knows how to handle it automagically.
So... here is what you can do. Create a directory for your kernel runtime environment, add it to the include path (with the -I flag). Place all of the above in this directory and link all of them to your kernel's executable. You will have:
klibd
--object.d
--dstubs.d
--invariant.d
--
gcc
----builtins.d
--
std
----intrinsic.d
----stdarg.d
----
c
------stdarg.d
----
typeinfo
------ti_* (just steal from us!)
Will you be my guinea pig?
When and if you confirm this to be workable, we can produce a D bare bones to release to the public domain.