www.digitalmars.com         C & C++   DMDScript  

D.gnu - D Cross Compiler

reply "Brendan Simon (eTRIX)" <brendan.simon etrix.com.au> writes:
Can GDC (or DMD) be built as a cross compiler ?? e.g. targeting ARM or
MIPS or PowerPC, etc ?? I'm presuming this should be no problem for GCC ??

My development/host platforms are OS X and Debian Linux. Are there any
prebuilt binaries for such cross-compilers ??

BTW, does GDC generate C++ code for GCC to compile, or does it directly
generate object code ?? I'm presuming the latter.

Can D be used in low-level drivers for Linux or other RTOS (e.g.
freertos) ??
Apr 12 2011
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2011-04-13 02:59, Brendan Simon (eTRIX) wrote:
 Can GDC (or DMD) be built as a cross compiler ?? e.g. targeting ARM or
 MIPS or PowerPC, etc ?? I'm presuming this should be no problem for GCC ??

Theoretically there shouldn't be a problem for GDC or LDC (D frontend with LLVM backend) to generate code for those platforms. But then you would also need to have the runtime ported to the given platform.
 My development/host platforms are OS X and Debian Linux. Are there any
 prebuilt binaries for such cross-compilers ??

On Mac OS X you should have cross compilers for PowerPC and ARM, both GCC and Clang/LLVM.
 BTW, does GDC generate C++ code for GCC to compile, or does it directly
 generate object code ?? I'm presuming the latter.

It generates object code directly.
 Can D be used in low-level drivers for Linux or other RTOS (e.g.
 freertos) ??

I guess so. You need to watch out for the runtime. I mean, D has a garbage collector and other stuff in the runtime that C doesn't -- /Jacob Carlborg
Apr 13 2011
prev sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
Hi Brendan,

For reference purposes, repeating what I've already said before elsewhere.

== Quote from Brendan Simon (eTRIX) (brendan.simon etrix.com.au)'s article
 Can GDC (or DMD) be built as a cross compiler ?? e.g. targeting ARM or
 MIPS or PowerPC, etc ?? I'm presuming this should be no problem for GCC ??

Yes, but first you'll need to setup a cross-compiler toolchain first. As as, ar, objdump, strip and other binutils don't come bundled with GCC (require a separate step to setup and install).
 My development/host platforms are OS X and Debian Linux. Are there any
 prebuilt binaries for such cross-compilers ??

Nope, I've only really tested ARM <-> i386 and MinGW <-> Linux cross compilers in the past.
 BTW, does GDC generate C++ code for GCC to compile, or does it directly
 generate object code ?? I'm presuming the latter.

Neither, it generates straight to the target platform's asm code. It is the job of the toolchain to compile to object code / link.
 Can D be used in low-level drivers for Linux or other RTOS (e.g.
 freertos) ??

D is not really suitable for a freestanding environment. Especially if you intend to use any non-POD features of the language (C++ has the same problem too). Regards Iain
Apr 13 2011