LDC with ARM backend
Claude via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 20 06:09:25 PDT 2016
I think my cross-compile LDC is fine.
I tried to build this D program:
/// loire.d
int main()
{
return 42;
}
However, the run-time is not (neither is phobos), most of the
linker issues come from the druntime. So...
I wrote my own druntime. Here's the code:
/// dummyruntime.d
// from rt/sections_elf_shared.d, probably don't need it right
now...
extern(C) void _d_dso_registry(void* data)
{
}
// from rt/dmain2.d, just call my D main(), ignore args...
private alias extern(C) int function(char[][] args) MainFunc;
extern (C) int _d_run_main(int argc, char **argv, MainFunc
mainFunc)
{
return mainFunc(null);
}
I built everything:
# Compilation
./bin/ldc2 -mtriple=arm-none-linux-gnueabi -c loire.d
./bin/ldc2 -mtriple=arm-none-linux-gnueabi -c dummyruntime.d
# Link
/opt/arm-2009q1/bin/arm-none-linux-gnueabi-gcc loire.o
dummyruntime.o -o loire
And I ran it successfully on my ARM target:
$> loire
$> echo $?
42
So now I know I have a proper LDC cross-compiler! :)
I'm jut missing a proper druntime and phobos for GNU/Linux ARM.
More information about the Digitalmars-d-learn
mailing list