www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ARM targetting cross-toolchain with GDC

reply Dawid =?iso-8859-2?q?Ci=EA=BFarkiewicz?= <dpc ucore.info> writes:
Hi,



I've started some initial work to get a working GDC crosscompiler
targeting ARM platforms. Currently I'm able to compile the
toolchain and produce a working "Hello World!" binary that I'm
able to execute on my BeagleBoard developement platform with
ArchLinux installed. The generated assembly looks sane,
unfortunately the program hangs, but I'm able to debug it in gdb
and I see it loops somewhere at:

       2261    in
/home/dpc/lab/d-cross/test-tc-1/.build/src/gcc-4.6.2/libphobos/gc/gcx.d
       => 0x2f950 <_D2gc3gcx2GC6mallocMFkkPkZPv+648>:  str     r2,


I'm going to investigate this and possibly fix with time. Anyone
interested in getting this to work seamlessly is kindly requested
to join efforts and share the results.




There's a crosstool-ng tool that is a great way to assemble and
build (cross-)toolchains. I've added some hacks to integrate the
gdc repository and thus add a gdc support.

I've pushed the forked crosstools-ng here:

https://bitbucket.org/xdpcx/crosstool-ng-dlang/

(I prefer git, but original crosstools-ng is using hg, so I
sticked with it).

Grab that code and learn to how to use ct-ng.

Basically installing crosstool-ng it's just a metter of
downloading and doing:

       ./bootstrap
       ./configure
       make
       make install

(I use `./configure --prefix="$HOME/opt"` for home-local
configuration.)

This will give you `ct-ng` command that you can use in any
directory

      cd ~/my/toolchain/buildir
      mkdir src
      cp ~/config/that/i/prepared/for/you/config .config
      ct-ng menuconfig
      ct-ng build
      ls arm-none-linux-eabi

I attach the mentioned config.

Actually, as I don't know how to attach it I've put it here:
http://pastebin.ca/2121043

If anyone is interested I could upload the compiled binaries
somewhere, as the toolchain is static.

Regards,
Dawid Ciężarkiewicz
Feb 23 2012
next sibling parent reply Johannes Pfau <nospam example.com> writes:
Am Thu, 23 Feb 2012 15:25:59 +0000 (UTC)
schrieb Dawid Ci=C4=99=C5=BCarkiewicz <dpc ucore.info>:

 Hi,
=20

=20
 I've started some initial work to get a working GDC crosscompiler
 targeting ARM platforms. Currently I'm able to compile the
 toolchain and produce a working "Hello World!" binary that I'm
 able to execute on my BeagleBoard developement platform with
 ArchLinux installed. The generated assembly looks sane,
 unfortunately the program hangs, but I'm able to debug it in gdb
 and I see it loops somewhere at:
=20
        2261    in
 /home/dpc/lab/d-cross/test-tc-1/.build/src/gcc-4.6.2/libphobos/gc/gcx.d
        =3D> 0x2f950 <_D2gc3gcx2GC6mallocMFkkPkZPv+648>:  str     r2,

=20
 I'm going to investigate this and possibly fix with time. Anyone
 interested in getting this to work seamlessly is kindly requested
 to join efforts and share the results.
That's issue 120: https://bitbucket.org/goshawk/gdc/issue/120/fsection-anchors-broken-on-arm
=20

=20
 There's a crosstool-ng tool that is a great way to assemble and
 build (cross-)toolchains. I've added some hacks to integrate the
 gdc repository and thus add a gdc support.
=20
 I've pushed the forked crosstools-ng here:
=20
 https://bitbucket.org/xdpcx/crosstool-ng-dlang/
=20
 (I prefer git, but original crosstools-ng is using hg, so I
 sticked with it).
=20
 Grab that code and learn to how to use ct-ng.
=20
 Basically installing crosstool-ng it's just a metter of
 downloading and doing:
=20
        ./bootstrap
        ./configure
        make
        make install
=20
 (I use `./configure --prefix=3D"$HOME/opt"` for home-local
 configuration.)
=20
 This will give you `ct-ng` command that you can use in any
 directory
=20
       cd ~/my/toolchain/buildir
       mkdir src
       cp ~/config/that/i/prepared/for/you/config .config
       ct-ng menuconfig
       ct-ng build
       ls arm-none-linux-eabi
=20
 I attach the mentioned config.
=20
 Actually, as I don't know how to attach it I've put it here:
 http://pastebin.ca/2121043
Integrating GDC with crosstools is nice. If you find the time, could you please add a page to the GDC wiki on how to setup/use crosstool-ng?
 If anyone is interested I could upload the compiled binaries
 somewhere, as the toolchain is static.
=20
 Regards,
 Dawid Ci=C4=99=C5=BCarkiewicz
Feb 23 2012
next sibling parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
On 23 February 2012 18:03, Johannes Pfau <nospam example.com> wrote:
 Am Thu, 23 Feb 2012 15:25:59 +0000 (UTC)
 schrieb Dawid Ci=C4=99=C5=BCarkiewicz <dpc ucore.info>:

 Hi,



 I've started some initial work to get a working GDC crosscompiler
 targeting ARM platforms. Currently I'm able to compile the
 toolchain and produce a working "Hello World!" binary that I'm
 able to execute on my BeagleBoard developement platform with
 ArchLinux installed. The generated assembly looks sane,
 unfortunately the program hangs, but I'm able to debug it in gdb
 and I see it loops somewhere at:

 =C2=A0 =C2=A0 =C2=A0 =C2=A02261 =C2=A0 =C2=A0in
 /home/dpc/lab/d-cross/test-tc-1/.build/src/gcc-4.6.2/libphobos/gc/gcx.d
 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D> 0x2f950 <_D2gc3gcx2GC6mallocMFkkPkZPv+64=
8>: =C2=A0str =C2=A0 =C2=A0 r2,


 I'm going to investigate this and possibly fix with time. Anyone
 interested in getting this to work seamlessly is kindly requested
 to join efforts and share the results.
That's issue 120: https://bitbucket.org/goshawk/gdc/issue/120/fsection-anchors-broken-on-ar=
m


 There's a crosstool-ng tool that is a great way to assemble and
 build (cross-)toolchains. I've added some hacks to integrate the
 gdc repository and thus add a gdc support.

 I've pushed the forked crosstools-ng here:

 https://bitbucket.org/xdpcx/crosstool-ng-dlang/

 (I prefer git, but original crosstools-ng is using hg, so I
 sticked with it).

 Grab that code and learn to how to use ct-ng.

 Basically installing crosstool-ng it's just a metter of
 downloading and doing:

 =C2=A0 =C2=A0 =C2=A0 =C2=A0./bootstrap
 =C2=A0 =C2=A0 =C2=A0 =C2=A0./configure
 =C2=A0 =C2=A0 =C2=A0 =C2=A0make
 =C2=A0 =C2=A0 =C2=A0 =C2=A0make install

 (I use `./configure --prefix=3D"$HOME/opt"` for home-local
 configuration.)

 This will give you `ct-ng` command that you can use in any
 directory

 =C2=A0 =C2=A0 =C2=A0 cd ~/my/toolchain/buildir
 =C2=A0 =C2=A0 =C2=A0 mkdir src
 =C2=A0 =C2=A0 =C2=A0 cp ~/config/that/i/prepared/for/you/config .config
 =C2=A0 =C2=A0 =C2=A0 ct-ng menuconfig
 =C2=A0 =C2=A0 =C2=A0 ct-ng build
 =C2=A0 =C2=A0 =C2=A0 ls arm-none-linux-eabi

 I attach the mentioned config.

 Actually, as I don't know how to attach it I've put it here:
 http://pastebin.ca/2121043
Integrating GDC with crosstools is nice. If you find the time, could you please add a page to the GDC wiki on how to setup/use crosstool-ng?
 If anyone is interested I could upload the compiled binaries
 somewhere, as the toolchain is static.

 Regards,
 Dawid Ci=C4=99=C5=BCarkiewicz
Does crosstools allow you to build a cross compiler for architecture X? --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0';
Feb 23 2012
next sibling parent Dawid =?iso-8859-2?q?Ci=EA=BFarkiewicz?= <dpc ucore.info> writes:
Dnia Thu, 23 Feb 2012 19:41:53 +0000, Iain Buclaw napisał(a):

 Does crosstools allow you to build a cross compiler for architecture X?
Yes, exactly. Canadian cross-compilers too. So other architectures could potenatially work, too. I don't have equipement to test them. -- Dawid Ciężarkiewicz
Feb 23 2012
prev sibling parent "Timofei Bolshakov" <tbolsh gmail.com> writes:
I was able to compile DGC to the Hello, World status for ARM
using crosstools-ng 1.18 eglibc. uclibc would not work, it lack
some of the functions in the library, context switching. There
are several places I cheat ( to get Hello, World! ). Please
advise:

../gcc-4.7.2/libphobos/libdruntime/core/sys/posix/ucontext.d:274:
Error: static assert  "Not implemented"

../gcc-4.7.2/libphobos/libdruntime/core/thread.d:3409: Error:
static assert  "Not implemented"

../gcc-4.7.2/libphobos/libdruntime/core/thread.d:4237: Error:
static assert  "Not implemented"

I simply commented static asserts - and I do not think it will
fly with any real multi threading program. All the places
consider context switching and assembly-level register
manipulation. Can somebody help me with that?
Apr 30 2013
prev sibling parent reply Dawid =?iso-8859-2?q?Ci=EA=BFarkiewicz?= <dpc ucore.info> writes:
Dnia Thu, 23 Feb 2012 19:03:46 +0100, Johannes Pfau napisał(a):
 That's issue 120:
 https://bitbucket.org/goshawk/gdc/issue/120/fsection-anchors-broken-on-
arm Thanks. Must try without -O2 now.
 Integrating GDC with crosstools is nice. If you find the time, could you
 please add a page to the GDC wiki on how to setup/use crosstool-ng?
Quick re-edition of my post is now here: https://bitbucket.org/goshawk/gdc/wiki/crosstool-ng I don't know if I should link the page anywhere. -- Dawid Ciężarkiewicz
Feb 23 2012
parent Andrew Wiley <wiley.andrew.j gmail.com> writes:
2012/2/23 Dawid Ci=EA=BFarkiewicz <dpc ucore.info>:
 Dnia Thu, 23 Feb 2012 19:03:46 +0100, Johannes Pfau napisa=B3(a):
 That's issue 120:
 https://bitbucket.org/goshawk/gdc/issue/120/fsection-anchors-broken-on-
arm Thanks. Must try without -O2 now.
-O2 is fine as long as you also use -fno-section-anchors.
Feb 23 2012
prev sibling parent reply "Timofei Bolshakov" <tbolsh gmail.com> writes:
Hi, Dawid!

On Thursday, 23 February 2012 at 15:25:59 UTC, Dawid 
Ciężarkiewicz wrote:
 Hi,



 I've started some initial work to get a working GDC 
 crosscompiler
 targeting ARM platforms. Currently I'm able to compile the
 toolchain and produce a working "Hello World!" binary that I'm
 able to execute on my BeagleBoard developement platform with
 ArchLinux installed. The generated assembly looks sane,
 unfortunately the program hangs, but I'm able to debug it in gdb
 and I see it loops somewhere at:

        2261    in
 /home/dpc/lab/d-cross/test-tc-1/.build/src/gcc-4.6.2/libphobos/gc/gcx.d
        => 0x2f950 <_D2gc3gcx2GC6mallocMFkkPkZPv+648>:  str     
 r2,


 I'm going to investigate this and possibly fix with time. Anyone
 interested in getting this to work seamlessly is kindly 
 requested
 to join efforts and share the results.




 There's a crosstool-ng tool that is a great way to assemble and
 build (cross-)toolchains. I've added some hacks to integrate the
 gdc repository and thus add a gdc support.

 I've pushed the forked crosstools-ng here:

 https://bitbucket.org/xdpcx/crosstool-ng-dlang/

 (I prefer git, but original crosstools-ng is using hg, so I
 sticked with it).

 Grab that code and learn to how to use ct-ng.

 Basically installing crosstool-ng it's just a metter of
 downloading and doing:

        ./bootstrap
        ./configure
        make
        make install

 (I use `./configure --prefix="$HOME/opt"` for home-local
 configuration.)

 This will give you `ct-ng` command that you can use in any
 directory

       cd ~/my/toolchain/buildir
       mkdir src
       cp ~/config/that/i/prepared/for/you/config .config
       ct-ng menuconfig
       ct-ng build
       ls arm-none-linux-eabi

 I attach the mentioned config.

 Actually, as I don't know how to attach it I've put it here:
 http://pastebin.ca/2121043
I tried to do that and build failed: [DEBUG] ==> Executing: 'sh' './gcc/d/setup-gcc.sh' [ALL ] This version of GCC (4.4) is not supported. do you have somewhere corrected code / config?
 If anyone is interested I could upload the compiled binaries
 somewhere, as the toolchain is static.
I will greatly appreciate that!
 Regards,
 Dawid Ciężarkiewicz
Apr 22 2013
next sibling parent reply "Timofei Bolshakoc" <tbolsh gmail.com> writes:
I was able to compile DGC to the Hello, World status for ARM 
using crosstools-ng 1.18 eglibc. uclibc would not work, it lack 
some of the functions in the library, context switching. There 
are several places I cheat ( to get Hello, World! ). Please 
advise:

../gcc-4.7.2/libphobos/libdruntime/core/sys/posix/ucontext.d:274: 
Error: static assert  "Not implemented"

../gcc-4.7.2/libphobos/libdruntime/core/thread.d:3409: Error: 
static assert  "Not implemented"

../gcc-4.7.2/libphobos/libdruntime/core/thread.d:4237: Error: 
static assert  "Not implemented"

I simply commented static asserts - and I do not think it will 
fly with any real multi threading program. All the places 
consider context switching and assembly-level register 
manipulation. Can somebody help me with that?
Apr 30 2013
parent reply Johannes Pfau <nospam example.com> writes:
Am Tue, 30 Apr 2013 22:40:32 +0200
schrieb "Timofei Bolshakoc" <tbolsh gmail.com>:

 I was able to compile DGC to the Hello, World status for ARM 
 using crosstools-ng 1.18 eglibc. uclibc would not work, it lack 
 some of the functions in the library, context switching. There 
 are several places I cheat ( to get Hello, World! ). Please 
 advise:
 
 ../gcc-4.7.2/libphobos/libdruntime/core/sys/posix/ucontext.d:274: 
 Error: static assert  "Not implemented"
Add this to ucontext.d: https://gist.github.com/jpf91/5502741 You probably also need this for core/sys/posix/sys/stat.d https://gist.github.com/jpf91/5502725
 
 I simply commented static asserts - and I do not think it will 
 fly with any real multi threading program. All the places 
 consider context switching and assembly-level register 
 manipulation. Can somebody help me with that?
The definition of ucontext_t should be enough. But this code is only for fibers real threads don't need this support code and should work fine without it. You probably also need the stat_t definition posted above to do any kind of IO.
May 02 2013
parent reply "Timofei Bolshakov" <tbolsh gmail.com> writes:
Thank you!
I will check that today. What to do about static asserts in 
thread.d?

On Thursday, 2 May 2013 at 14:54:44 UTC, Johannes Pfau wrote:
 Am Tue, 30 Apr 2013 22:40:32 +0200
 schrieb "Timofei Bolshakoc" <tbolsh gmail.com>:

 I was able to compile DGC to the Hello, World status for ARM 
 using crosstools-ng 1.18 eglibc. uclibc would not work, it 
 lack some of the functions in the library, context switching. 
 There are several places I cheat ( to get Hello, World! ). 
 Please advise:
 
 ../gcc-4.7.2/libphobos/libdruntime/core/sys/posix/ucontext.d:274: 
 Error: static assert  "Not implemented"
Add this to ucontext.d: https://gist.github.com/jpf91/5502741 You probably also need this for core/sys/posix/sys/stat.d https://gist.github.com/jpf91/5502725
 
 I simply commented static asserts - and I do not think it will 
 fly with any real multi threading program. All the places 
 consider context switching and assembly-level register 
 manipulation. Can somebody help me with that?
The definition of ucontext_t should be enough. But this code is only for fibers real threads don't need this support code and should work fine without it. You probably also need the stat_t definition posted above to do any kind of IO.
May 02 2013
parent reply Johannes Pfau <nospam example.com> writes:
Am Thu, 02 May 2013 18:54:28 +0200
schrieb "Timofei Bolshakov" <tbolsh gmail.com>:

 Thank you!
 I will check that today. What to do about static asserts in 
 thread.d?
Those should be fixed by the ucontext changes. The static if(__traits( compiles, ucontext_t )) code path will be used if we make ucontext_t available.
May 02 2013
next sibling parent "Timofei Bolshakov" <tbolsh gmail.com> writes:
On Thursday, 2 May 2013 at 17:28:47 UTC, Johannes Pfau wrote:
 Am Thu, 02 May 2013 18:54:28 +0200
 schrieb "Timofei Bolshakov" <tbolsh gmail.com>:

 Thank you!
 I will check that today. What to do about static asserts in 
 thread.d?
Those should be fixed by the ucontext changes. The static if(__traits( compiles, ucontext_t )) code path will be used if we make ucontext_t available.
Many thanks for your answer! I am using compiler for several weeks already - and today I've seen that I did not thank you. So, all what you have said works and works fine!
May 11 2013
prev sibling parent reply "Timofei Bolshakov" <tbolsh gmail.com> writes:
Hello!

I was trying to compile the latest version of GDC for ARM and 
meet multiple problems with static asserts. Do you know if ARM 
fixes exists?
Aug 06 2013
parent reply Johannes Pfau <nospam example.com> writes:
Am Tue, 06 Aug 2013 23:28:51 +0200
schrieb "Timofei Bolshakov" <tbolsh gmail.com>:

 Hello!
 
 I was trying to compile the latest version of GDC for ARM and 
 meet multiple problems with static asserts. Do you know if ARM 
 fixes exists?
Sorry for the late answer. I'm currently working on ARM support but it'll take a little bit longer than I first thought. Anyway, you can get the latest updates here: https://github.com/jpf91/GDC/tree/arm A small warning: The branch will get rebased occasionally. GCC-4.7 support will have to wait some more time though. In case you want to build a cross-compiler with ct-ng: The recent hg snapshots of crosstool-NG support GCC-4.8.
Aug 22 2013
parent reply "ilya-stromberg" <ilya-stromberg-2009 yandex.ru> writes:
On Thursday, 22 August 2013 at 15:15:37 UTC, Johannes Pfau wrote:
 Am Tue, 06 Aug 2013 23:28:51 +0200
 schrieb "Timofei Bolshakov" <tbolsh gmail.com>:

 I was trying to compile the latest version of GDC for ARM and 
 meet multiple problems with static asserts. Do you know if ARM 
 fixes exists?
Sorry for the late answer. I'm currently working on ARM support but it'll take a little bit longer than I first thought.
Do you have any plans for Android support?
Aug 24 2013
parent reply Johannes Pfau <nospam example.com> writes:
Am Sat, 24 Aug 2013 19:18:42 +0200
schrieb "ilya-stromberg" <ilya-stromberg-2009 yandex.ru>:

 On Thursday, 22 August 2013 at 15:15:37 UTC, Johannes Pfau wrote:
 Am Tue, 06 Aug 2013 23:28:51 +0200
 schrieb "Timofei Bolshakov" <tbolsh gmail.com>:

 I was trying to compile the latest version of GDC for ARM and 
 meet multiple problems with static asserts. Do you know if ARM 
 fixes exists?
Sorry for the late answer. I'm currently working on ARM support but it'll take a little bit longer than I first thought.
Do you have any plans for Android support?
Not until the 'usual' Linux/GlibC combination works well on ARM. Android has it's own C library, Bionic. Druntime has only been tested on glibc on Posix systems so it's some work to port it. And Android also needs solid shared library support (A D shared library needs to be loaded by a Java app).
Aug 24 2013
next sibling parent reply "ilya-stromberg" <ilya-stromberg-2009 yandex.ru> writes:
On Saturday, 24 August 2013 at 18:00:05 UTC, Johannes Pfau wrote:
 Am Sat, 24 Aug 2013 19:18:42 +0200
 schrieb "ilya-stromberg" <ilya-stromberg-2009 yandex.ru>:
 Do you have any plans for Android support?
Not until the 'usual' Linux/GlibC combination works well on ARM.
I understood. How are you close to finish the work? Do you have any working examples, for example "Hello ARM"?
Aug 25 2013
parent Johannes Pfau <nospam example.com> writes:
Am Sun, 25 Aug 2013 15:55:59 +0200
schrieb "ilya-stromberg" <ilya-stromberg-2009 yandex.ru>:

 On Saturday, 24 August 2013 at 18:00:05 UTC, Johannes Pfau wrote:
 Am Sat, 24 Aug 2013 19:18:42 +0200
 schrieb "ilya-stromberg" <ilya-stromberg-2009 yandex.ru>:
 Do you have any plans for Android support?
Not until the 'usual' Linux/GlibC combination works well on ARM.
I understood. How are you close to finish the work? Do you have any working examples, for example "Hello ARM"?
import std.stdio; version(ARM) { void main() { writeln("Hello ARM"); } } We're actually past the Hello-World stage. The test suite passes 100% with optimization disabled. There is one codegen bug with optimizations which really needs to be solved but those things are hard to track down. Druntime unit tests pass, phobos has ~10 failing unit tests.
Aug 25 2013
prev sibling parent reply "David Nadlinger" <code klickverbot.at> writes:
On Saturday, 24 August 2013 at 18:00:05 UTC, Johannes Pfau wrote:
 Not until the 'usual' Linux/GlibC combination works well on ARM.
 Android has it's own C library, Bionic. Druntime has only been 
 tested
 on glibc on Posix systems so it's some work to port it. And 
 Android
 also needs solid shared library support (A D shared library 
 needs to be
 loaded by a Java app).
Same for the LDC side of things, by the way. While we are at it: Did you have a look at how to support TLS with Bionic yet? A while back, I had a hard time trying to find any material on the issue yet, but from what I read, it didn't seem to be supported back then. I guess GDC could get away using GCC's emutls, though (apart from the problems this poses for the GC). David
Aug 25 2013
parent reply Johannes Pfau <nospam example.com> writes:
Am Sun, 25 Aug 2013 17:11:42 +0200
schrieb "David Nadlinger" <code klickverbot.at>:

 On Saturday, 24 August 2013 at 18:00:05 UTC, Johannes Pfau wrote:
 Not until the 'usual' Linux/GlibC combination works well on ARM.
 Android has it's own C library, Bionic. Druntime has only been 
 tested
 on glibc on Posix systems so it's some work to port it. And 
 Android
 also needs solid shared library support (A D shared library 
 needs to be
 loaded by a Java app).
Same for the LDC side of things, by the way. While we are at it: Did you have a look at how to support TLS with Bionic yet? A while back, I had a hard time trying to find any material on the issue yet, but from what I read, it didn't seem to be supported back then. I guess GDC could get away using GCC's emutls, though (apart from the problems this poses for the GC). David
Not really. It wasn't supported in Bionic at all when I last looked into it. At some point I thought about just implementing TLS in bionic and trying to get it into Android. Probably a little to advanced for me but we could basically copy the code from freebsd. The problem with this is that it will take some more years till a recent bionic is available on most Android devices. emutls can work for gdc but we have no good solution to integrate this with the GC yet. At least it'll never be really fast (The problem is that emutls doesn't use contiguous memory. Every variable could be malloced at a random address)
Aug 25 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-08-25 20:46, Johannes Pfau wrote:

 Not really. It wasn't supported in Bionic at all when I last looked
 into it. At some point I thought about just implementing TLS in bionic
 and trying to get it into Android. Probably a little to advanced for me
 but we could basically copy the code from freebsd.
Isn't it possible to implement it in the runtime? Basically doing what the dynamic linker would do. Although I don't know if enough API is exposed for this. It would not support all TLS models but at least one. -- /Jacob Carlborg
Aug 26 2013
parent Johannes Pfau <nospam example.com> writes:
Am Mon, 26 Aug 2013 09:04:31 +0200
schrieb Jacob Carlborg <doob me.com>:

 On 2013-08-25 20:46, Johannes Pfau wrote:
 
 Not really. It wasn't supported in Bionic at all when I last looked
 into it. At some point I thought about just implementing TLS in
 bionic and trying to get it into Android. Probably a little to
 advanced for me but we could basically copy the code from freebsd.
Isn't it possible to implement it in the runtime? Basically doing what the dynamic linker would do. Although I don't know if enough API is exposed for this. It would not support all TLS models but at least one.
Maybe, I haven't had a detailed look at that.
Aug 26 2013
prev sibling parent reply "Andrey" <vangelisforever yandex.ru> writes:
On Monday, 22 April 2013 at 17:22:50 UTC, Timofei Bolshakov wrote:
 Hi, Dawid!

 On Thursday, 23 February 2012 at 15:25:59 UTC, Dawid 
 Ciężarkiewicz wrote:
 Hi,



 I've started some initial work to get a working GDC 
 crosscompiler
 targeting ARM platforms. Currently I'm able to compile the
 toolchain and produce a working "Hello World!" binary that I'm
 able to execute on my BeagleBoard developement platform with
 ArchLinux installed. The generated assembly looks sane,
 unfortunately the program hangs, but I'm able to debug it in 
 gdb
 and I see it loops somewhere at:

       2261    in
 /home/dpc/lab/d-cross/test-tc-1/.build/src/gcc-4.6.2/libphobos/gc/gcx.d
       => 0x2f950 <_D2gc3gcx2GC6mallocMFkkPkZPv+648>:  str     
 r2,


 I'm going to investigate this and possibly fix with time. 
 Anyone
 interested in getting this to work seamlessly is kindly 
 requested
 to join efforts and share the results.




 There's a crosstool-ng tool that is a great way to assemble and
 build (cross-)toolchains. I've added some hacks to integrate 
 the
 gdc repository and thus add a gdc support.

 I've pushed the forked crosstools-ng here:

 https://bitbucket.org/xdpcx/crosstool-ng-dlang/

 (I prefer git, but original crosstools-ng is using hg, so I
 sticked with it).

 Grab that code and learn to how to use ct-ng.

 Basically installing crosstool-ng it's just a metter of
 downloading and doing:

       ./bootstrap
       ./configure
       make
       make install

 (I use `./configure --prefix="$HOME/opt"` for home-local
 configuration.)

 This will give you `ct-ng` command that you can use in any
 directory

      cd ~/my/toolchain/buildir
      mkdir src
      cp ~/config/that/i/prepared/for/you/config .config
      ct-ng menuconfig
      ct-ng build
      ls arm-none-linux-eabi

 I attach the mentioned config.

 Actually, as I don't know how to attach it I've put it here:
 http://pastebin.ca/2121043
I tried to do that and build failed: [DEBUG] ==> Executing: 'sh' './gcc/d/setup-gcc.sh' [ALL ] This version of GCC (4.4) is not supported. do you have somewhere corrected code / config?
 If anyone is interested I could upload the compiled binaries
 somewhere, as the toolchain is static.
I will greatly appreciate that!

I have the same trouble. And I don't know how resolve it.. I tried to change config "/$HOME/opt/lib/ct-ng.hg+../config/cc/gcc.in" by added gcc 4.7.0 support, but this way compile has another errors: [INFO ] Installing C library [INFO ] Installing C library: done in 441.77s (at 17:52) [INFO ] ================================================================= [INFO ] Installing final compiler [WARN ] Building d language(s) is not yet supported. Will try... [ERROR] configure: error: [ERROR] [ERROR] >> [ERROR] >> Build failed in step 'Installing final compiler' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions 172] [ERROR] >> called from: do_cc_backend[scripts/build/cc/gcc.sh 753] [ERROR] >> called from: do_cc[scripts/build/cc/gcc.sh 525] [ERROR] >> called from: main[scripts/crosstool-NG.sh 597] [ERROR] >>
Jun 13 2013
parent reply Johannes Pfau <nospam example.com> writes:
Am Thu, 13 Jun 2013 16:28:19 +0200
schrieb "Andrey" <vangelisforever yandex.ru>:

 
 I have the same trouble.
 And I don't know how resolve it..
If you want to build a cross compiler targeting ARM/Linux follow these instructions: http://gdcproject.org/wiki/Cross%20Compiler/crosstool-NG This way you don't need to patch crosstool-NG and you can use the latest crosstool-NG release. Make sure to use gcc-4.7 (gcc-4.8 will work as well as soon as crosstool-NG supports it). I don't have a ready to use config though.
Jun 13 2013
parent reply "Andrey" <vangelisforever yandex.ru> writes:
On Thursday, 13 June 2013 at 16:00:34 UTC, Johannes Pfau wrote:
 Am Thu, 13 Jun 2013 16:28:19 +0200
 schrieb "Andrey" <vangelisforever yandex.ru>:

 
 I have the same trouble.
 And I don't know how resolve it..
If you want to build a cross compiler targeting ARM/Linux follow these instructions: http://gdcproject.org/wiki/Cross%20Compiler/crosstool-NG This way you don't need to patch crosstool-NG and you can use the latest crosstool-NG release. Make sure to use gcc-4.7 (gcc-4.8 will work as well as soon as crosstool-NG supports it). I don't have a ready to use config though.
Thank you for answer. The compilation of GDC for ARMv5TE has been done without any errors, and now I can't find native ARM libphobos to make my small ARM test. What shall I do? Сould you help me? Thanks.
Jun 13 2013
parent reply Johannes Pfau <nospam example.com> writes:
Am Thu, 13 Jun 2013 22:19:10 +0200
schrieb "Andrey" <vangelisforever yandex.ru>:

 On Thursday, 13 June 2013 at 16:00:34 UTC, Johannes Pfau wrote:
 Am Thu, 13 Jun 2013 16:28:19 +0200
 schrieb "Andrey" <vangelisforever yandex.ru>:

=20
 I have the same trouble.
 And I don't know how resolve it..
If you want to build a cross compiler targeting ARM/Linux=20 follow these instructions: http://gdcproject.org/wiki/Cross%20Compiler/crosstool-NG This way you don't need to patch crosstool-NG and you can use=20 the latest crosstool-NG release. Make sure to use gcc-4.7 (gcc-4.8=20 will work as well as soon as crosstool-NG supports it). I don't have a ready to use config though.
Thank you for answer. =20 The compilation of GDC for ARMv5TE has been done without any=20 errors, and now I can't find native ARM libphobos to make my=20 small ARM test. What shall I do? =D0=A1ould you help me? =20 Thanks.
The linked howto explicitly disables phobos and druntime. To build phobos and druntime do not use the "--disable-libphobos" switch as said in the howto. However libphobos currently doesn't build for ARM, this patch is needed: https://github.com/D-Programming-Language/druntime/pull/521 Once it's accepted into upstream I'll backport it to gdc but this might take some time. You could of course apply these changes by yourself, then remove the --disable-libphobos switch and you should get a basically working phobos.
Jun 15 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Saturday, 15 June 2013 at 19:15:51 UTC, Johannes Pfau wrote:
 However libphobos currently doesn't build for ARM, this patch is
 needed:
I independently did pretty much the same thing earlier today to build an arm cross compiler and got a working druntime (two more minor changes too, making a const object.toString and toHash was required to link, not sure why though) working ...except for one thing: throwing exceptions just ends the program with "Aborted". It is possible I still did something wrong, since I built the druntime piece by piece after the fact instead of with crosstool-ng, but have you experienced this before?
Jun 15 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
nvm, I figured it out. I didn't pass the right ABI version when 
building runtime, so my fault.

This is pretty exciting though, D is working and it wasn't really 
*that* much effort!
Jun 15 2013
next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 16 June 2013 01:05, Adam D. Ruppe <destructionator gmail.com> wrote:
 nvm, I figured it out. I didn't pass the right ABI version when building
 runtime, so my fault.

 This is pretty exciting though, D is working and it wasn't really *that*
 much effort!
It's been a few years in the making. And there are still one or two things that need to be pushed upstream to the D front end. The last few months has been hugely beneficial for being architecture agnostic code generation. So every problem you encounter when targeting a new platform would hopefully be in relation to the druntime C interface, which if you have patches for please send my way. ;) -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Jun 15 2013
prev sibling next sibling parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
On 16 June 2013 02:13, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 On 16 June 2013 01:05, Adam D. Ruppe <destructionator gmail.com> wrote:
 nvm, I figured it out. I didn't pass the right ABI version when building
 runtime, so my fault.

 This is pretty exciting though, D is working and it wasn't really *that*
 much effort!
It's been a few years in the making. And there are still one or two things that need to be pushed upstream to the D front end. The last few months has been hugely beneficial for being architecture agnostic code generation. So every problem you encounter when targeting a new platform would hopefully be in relation to the druntime C interface, which if you have patches for please send my way. ;)
I would also invite you to run the test suite as well ( make check-d ) and post all failed and unresolved tests as new bugs, where possible providing minimal test cases that trigger the issue. Thanks -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Jun 15 2013
parent Johannes Pfau <nospam example.com> writes:
Am Sun, 16 Jun 2013 02:15:18 +0100
schrieb Iain Buclaw <ibuclaw ubuntu.com>:

 On 16 June 2013 02:13, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 On 16 June 2013 01:05, Adam D. Ruppe <destructionator gmail.com>
 wrote:
 nvm, I figured it out. I didn't pass the right ABI version when
 building runtime, so my fault.

 This is pretty exciting though, D is working and it wasn't really
 *that* much effort!
It's been a few years in the making. And there are still one or two things that need to be pushed upstream to the D front end. The last few months has been hugely beneficial for being architecture agnostic code generation. So every problem you encounter when targeting a new platform would hopefully be in relation to the druntime C interface, which if you have patches for please send my way. ;)
I would also invite you to run the test suite as well ( make check-d ) and post all failed and unresolved tests as new bugs, where possible providing minimal test cases that trigger the issue. Thanks -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
I incidentally did that this weekend. Using a commit before the 2.063 merge I only get these failures: FAIL: runnable/arrayop.d execution test http://bugzilla.gdcproject.org/show_bug.cgi?id=8 FAIL: runnable/opover2.d execution test http://bugzilla.gdcproject.org/show_bug.cgi?id=10 FAIL: runnable/template1.d execution test FAIL: runnable/test4.d execution test (common 32 bit bug?)
Jun 16 2013
prev sibling parent Johannes Pfau <nospam example.com> writes:
Am Sun, 16 Jun 2013 02:05:15 +0200
schrieb "Adam D. Ruppe" <destructionator gmail.com>:

 nvm, I figured it out. I didn't pass the right ABI version when 
 building runtime, so my fault.
 
 This is pretty exciting though, D is working and it wasn't really 
 *that* much effort!
The compiler is in good shape. I ran the testsuite this weekend (it takes some time on a slow raspberry pi...). We have only 4 failing tests and one of those tests fails on all 32 bit targets. Then there are some unresolved tests which all come down to missing asm code in the testsuite or floating point precision differences. However, the phobos unittests don't even build on ARM :-)
Jun 16 2013