Building for ARM with LDC

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon Jul 14 09:17:09 PDT 2014


Hi Joe!

On Sunday, 13 July 2014 at 10:16:36 UTC, Joseph Rushton Wakeling 
wrote:
> I decided to start trying out the ARM embedded programming 
> ideas in Adam Ruppe's D Cookbook.  Speaking as a complete 
> newcomer to this area of programming, I was wondering: although 
> Adam advises using GDC in his tutorials, would it be possible 
> to use LDC instead -- and if so, what to use in place of the 
> calls to arm-gdcproject-linux-gnueabi-gdc, 
> arm-gdcproject-linux-gnueabi-as, 
> arm-gdcproject-linux-gnueabi-ld, and 
> arm-gdcproject-linux-gnueabi-objcopy ... ?
>
> I'm building LDC on top of llvm 3.4, so is the ARM support here 
> adequate in any case?

You can build LDC on an ARM system without problem. Most stuff 
works out of the box. Prominent exceptions are exception handling 
and some std.math stuff. Most annoying: there is a bug(?) in 
dso_ctor()/dso_dtor() which prevents compiling with -O0. If you 
use -O1 or higher everything works.

More likely you want to cross compile to ARM. The problem here is 
floating point support as ARM does not have a real (80-bit) 
floating point type. Currently, you can't change this without 
recompiling LDC. (Change real_t to double and use the double 
constants instead of the long double ones.) This is the reason 
why the binary distributions do not contain an ARM backend.

llvm 3.4 is ok for code generation. As far as I remember wrong 
relocations are generated for debug info of TLS variables.

Just give it a try. :-)

Regards,
Kai


More information about the digitalmars-d-ldc mailing list