Hitchikers Guide to Porting Phobos / D Runtime to other architectures

Mike none at none.com
Mon Jan 6 16:01:47 PST 2014


On Monday, 6 January 2014 at 20:23:23 UTC, Dwhatever wrote:
> On Monday, 6 January 2014 at 17:52:44 UTC, Sean Kelly wrote:
>> On Monday, 6 January 2014 at 11:47:57 UTC, Dwhatever wrote:
> I'm using LDC and unfortunately the -mtriple=arm-eabi isn't 
> supported so I have to use -mtriple=arm-linux which 
> automatically sets the "Posix" version string. I can always try 
> to stub all the Posix calls in the library but what I think 
> would work is that you have a stubbed version when there isn't 
> any system name like Windows or Posix. For example.
>
> version (Windows)
> {
>   ...
> }
> else version (Posix)
> {
>   ...
> }
> else
> {
>   //Stubbed interface
> }

For LDC with an ARM backend, you only need to compile with 
-march= and/or -mcpu= if you wish to compile for bare-metal.

The version strings are listed here 
(http://dlang.org/version.html).  So if I understand your 
objective, you would only need...

else version(ARM_Thumb) // or version(ARM) if targeting Cortex-A 
and the like
{
    ...
}

And it may actually need to look more like...
version(X86)
{
     version(Windows)
     { }
     else version(Linux)
     { }
     else
     { }
}
else version(ARM_Thumb)
{
     ...
}

of course the hard part is filling in the (...).

What CPU/MCU are you targeting?  Are you building for bare-metal?





More information about the Digitalmars-d mailing list