Jump to page: 1 2
Thread overview
iphone + D, getting closer!
Nov 12, 2012
Dan Olson
Nov 12, 2012
Jacob Carlborg
Nov 12, 2012
Dan Olson
Nov 12, 2012
Jacob Carlborg
Nov 12, 2012
Johannes Pfau
Nov 12, 2012
Timo Sintonen
Nov 12, 2012
Dan Olson
Nov 12, 2012
Dan Olson
Nov 16, 2012
Dan Olson
Nov 12, 2012
Iain Buclaw
Nov 13, 2012
Bernard Helyer
Nov 13, 2012
Iain Buclaw
Nov 13, 2012
Dan Olson
Nov 13, 2012
Jacob Carlborg
Nov 16, 2012
Jacob Carlborg
November 12, 2012
Ok, D is not there yet, but I managed to build a crippled gcc-4.8 (with D) targeting arm-apple-darwin and I can compile simple C functions to .o files and link them into an iphone app.  And run it on my iphone.  The D and C++ compilers built, but I have probably a potpourri of issues since I gave 4.8 a arm-darwin target by selectively copying apple's 4.2 changes for arm-darwin.  gcc-4.8 was configured to use tools (as, ld) in the apple iphone SDK.

The biggest hassle is that apple's version of arm as is different than binutils as.  So I am learning what it wants for debug and pseudo op differences.

Even a simple D module with just a extern(C) function depends on something in druntime, so I have to get part of that to build first.

-- 
dano
November 12, 2012
On 2012-11-12 02:38, Dan Olson wrote:
> Ok, D is not there yet, but I managed to build a crippled gcc-4.8 (with
> D) targeting arm-apple-darwin and I can compile simple C functions to .o
> files and link them into an iphone app.  And run it on my iphone.  The D
> and C++ compilers built, but I have probably a potpourri of issues since
> I gave 4.8 a arm-darwin target by selectively copying apple's 4.2
> changes for arm-darwin.  gcc-4.8 was configured to use tools (as, ld) in
> the apple iphone SDK.
>
> The biggest hassle is that apple's version of arm as is different than
> binutils as.  So I am learning what it wants for debug and pseudo op
> differences.
>
> Even a simple D module with just a extern(C) function depends on
> something in druntime, so I have to get part of that to build first.

Cool, I'm really looking forward to this. How did it go with the simulator?

-- 
/Jacob Carlborg
November 12, 2012
Am Sun, 11 Nov 2012 17:38:08 -0800
schrieb Dan Olson <zans.is.for.cans@yahoo.com>:

> Ok, D is not there yet, but I managed to build a crippled gcc-4.8 (with D) targeting arm-apple-darwin and I can compile simple C functions to .o files and link them into an iphone app.  And run it on my iphone.  The D and C++ compilers built, but I have probably a potpourri of issues since I gave 4.8 a arm-darwin target by selectively copying apple's 4.2 changes for arm-darwin.  gcc-4.8 was configured to use tools (as, ld) in the apple iphone SDK.
> 
> The biggest hassle is that apple's version of arm as is different than binutils as.  So I am learning what it wants for debug and pseudo op differences.
> 
> Even a simple D module with just a extern(C) function depends on something in druntime, so I have to get part of that to build first.
> 

_Dmodule_ref?
You can just declare it as extern(C) __gshared void* _Dmodule_ref; (But
IIRC you have to compile with -nophoboslib to make it work)
It's used by the runtime/compiler to setup the ModuleInfos but you
don't have to initialize it, it just needs to be declared.
November 12, 2012
On Monday, 12 November 2012 at 08:31:32 UTC, Johannes Pfau wrote:
> Am Sun, 11 Nov 2012 17:38:08 -0800
> schrieb Dan Olson <zans.is.for.cans@yahoo.com>:
>
>
>> 
>> Even a simple D module with just a extern(C) function depends on
>> something in druntime, so I have to get part of that to build first.
>> 
>
> _Dmodule_ref?
> You can just declare it as extern(C) __gshared void* _Dmodule_ref; (But
> IIRC you have to compile with -nophoboslib to make it work)
> It's used by the runtime/compiler to setup the ModuleInfos but you
> don't have to initialize it, it just needs to be declared.

Module initialization code seems to use _Dmodule_ref to make some kind of linked list of module constructors even when we do not have any. I disabled module stuff from d-glue.cc:2828. The only unresolved reference I get now is __aeabi_unwind_cpp_pr1, which is found in libgcc.a. This library may not be searched by default in cross compilers, but has to be given separately.

 In arm compiler it should be checked in gcc sources that the right library for the target processor is generated (Cortex libraries for example are not generated by default) The file is in one in gcc-source/gcc/config/arm/t-* . If the library is there it has to be checked that the linker finds the right one. Command gcc -print-libgcc-file-name tells the library name and gcc -print-multi-lib tells the available libraries

I have now a minimum libdruntime library for arm-eabi. If there are any other unresolved symbols, please let us know.

November 12, 2012
Jacob Carlborg <doob@me.com> writes:
>
> Cool, I'm really looking forward to this. How did it go with the simulator?

D for the iphone simulator worked without changes to gcc-4.8 src since it targets i686 darwin fine.  To get it to work it was more of finding the right config recipe.  I did have to use my druntme changes for osx. For the simulator, I built an i686-apple-darwin target and had it use the iphone simulator sdk + as, ld toolchain.

To run D code in the iphone sim, the D code is compiled to .o files on the command line then added to an xcode project along with libgphobos2.a and libgcc_eh.a.  I give my D code an extern(C) entry point so I can kick it off.

-- 
dano
November 12, 2012
Johannes Pfau <nospam@example.com> writes:
>
> _Dmodule_ref?
> You can just declare it as extern(C) __gshared void* _Dmodule_ref; (But
> IIRC you have to compile with -nophoboslib to make it work)
> It's used by the runtime/compiler to setup the ModuleInfos but you
> don't have to initialize it, it just needs to be declared.

I might try that.  It will give me a warm+fuzy before I get all of libgdruntime built.  It would just be a simple "Hello D" to the console using puts().

My main task now is creating a arm-*-darwin target for libgcc.  Last time I worked on gcc for a custom toolchain, libgcc was configured as part of gcc.
November 12, 2012
Dan Olson <zans.is.for.cans@yahoo.com> writes:

> Johannes Pfau <nospam@example.com> writes:
>>
>> _Dmodule_ref?
>> You can just declare it as extern(C) __gshared void* _Dmodule_ref; (But
>> IIRC you have to compile with -nophoboslib to make it work)
>> It's used by the runtime/compiler to setup the ModuleInfos but you
>> don't have to initialize it, it just needs to be declared.
>
> I might try that.  It will give me a warm+fuzy before I get all of libgdruntime built.  It would just be a simple "Hello D" to the console using puts().

Ok, that gave me an arm object file with simple D code.  I linked in to an iphone app.  When I run, module init code get called (yeah) but soon tries a move from an bad address.  Probably my own doing with my port of arm-darwin.  I'll look through Timo post, see if it is related.  Later this week I will compare my toolchain's D assembler output with a D arm-eabi chain, see what's up.
November 12, 2012
On 2012-11-12 16:28, Dan Olson wrote:

> D for the iphone simulator worked without changes to gcc-4.8 src since
> it targets i686 darwin fine.  To get it to work it was more of finding
> the right config recipe.  I did have to use my druntme changes for osx.
> For the simulator, I built an i686-apple-darwin target and had it use
> the iphone simulator sdk + as, ld toolchain.
>
> To run D code in the iphone sim, the D code is compiled to .o files on
> the command line then added to an xcode project along with libgphobos2.a
> and libgcc_eh.a.  I give my D code an extern(C) entry point so I can
> kick it off.

Sounds like a great start :)

-- 
/Jacob Carlborg
November 12, 2012
On 12 November 2012 01:38, Dan Olson <zans.is.for.cans@yahoo.com> wrote:
> Ok, D is not there yet, but I managed to build a crippled gcc-4.8 (with D) targeting arm-apple-darwin and I can compile simple C functions to .o files and link them into an iphone app.  And run it on my iphone.  The D and C++ compilers built, but I have probably a potpourri of issues since I gave 4.8 a arm-darwin target by selectively copying apple's 4.2 changes for arm-darwin.  gcc-4.8 was configured to use tools (as, ld) in the apple iphone SDK.
>
> The biggest hassle is that apple's version of arm as is different than binutils as.  So I am learning what it wants for debug and pseudo op differences.
>
> Even a simple D module with just a extern(C) function depends on something in druntime, so I have to get part of that to build first.
>
> --
> dano

Doesn't Apple forbid any language except Objective-C ?  Or is that a misguided fallacy of mine? (Objective D, anyone? :-)


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
November 13, 2012
On Monday, 12 November 2012 at 23:45:37 UTC, Iain Buclaw wrote:
(Objective D, anyone? :-)


Too far man. D:

« First   ‹ Prev
1 2