Building an ARM cross compiler

Johannes Pfau spam at example.com
Thu Nov 18 07:19:55 PST 2010


Am 15.11.2010, 21:27 Uhr, schrieb Iain Buclaw <ibuclaw at ubuntu.com>:

> == Quote from Iain Buclaw (ibuclaw at ubuntu.com)'s article
>> There's a patch in Debian which addresses this. Last time I tried (a  
>> nice fella
>> allowed me to work via ssh'ing onto a sheevaplug) it mostly works, but  
>> you'll need
>> to use the gcstub sources, as the normal gc don't work (2.035~ish time  
>> this was I
>> think, so things may have improved since).
>> Regards
>
> First one fixes your linker errors. I'm not sure whether or not the  
> second is
> needed for GCC-4.4 (it was for GCC-4.3).
>
> --- a/src/gcc/config/arm/arm-c.c        2007-11-05 17:13:46.000000000  
> +0000
> +++ b/src/gcc/config/arm/arm-c.c        2010-08-29 11:42:36.503460693  
> +0100
> @@ -15,7 +15,7 @@
>  {
>    /* Tag_ABI_PCS_wchar_t.  */
>    asm_fprintf (asm_out_file, "\t.eabi_attribute 18, %d\n",
> -              (int)(TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT));
> +              (int)(WCHAR_TYPE_SIZE / BITS_PER_UNIT));
>  }
>
>
> --- a/src/gcc/d/d-gcc-includes.h        2010-08-19 12:30:20.000000000  
> +0100
> +++ b/src/gcc/d/d-gcc-includes.h        2010-08-23 10:44:15.709788361  
> +0100
> @@ -32,7 +32,11 @@
>
>  // hack needed to prevent inclusion of the generated insn-flags.h
>  // which defines some inline functions that use C prototypes....
> +// because some archs depend on this header for EH routines,
> +// only do this if EH_RETURN_HANDLER_RTX is already defined.
> +#ifdef EH_RETURN_HANDLER_RTX
>  #define GCC_INSN_FLAGS_H
> +#endif
>
>  // Conflicting definitions between stdio.h and libiberty.h over the  
> throw()
>  #define HAVE_DECL_ASPRINTF 1

Forget my last message, I tried to build an arm-elf cross compiler  
(because the archlinux gcc pakages did that). As arm-elf is bare metal ARM  
without the linux kernel, glibc and everything else the usual .configure  
make make install thing didn't work and therefore the original build  
script did some tricks to compile for arm-elf. I guess those tricks made  
the gdc setup fail.

I've now built my own bintutils and gcc for arm-none-linux-gnueabi and  
here things worked out better. I still had to apply the first patch, the  
compiler was built and it tried to compile phobos. That failed in math.d  
because of missing ARM support:
-------------------------------------------------------------------------------------------------------------------------
/var/abs/local/cross-arm-linux-gnueabi/cross-arm-none-linux-gnueabi-gdc2-hg/src/gcc-build/./gcc/gdc  
-B/var/abs/local/cross-arm-linux-gnueabi/cross-arm-none-linux-gnueabi-gdc2-hg/src/gcc-build/./gcc/  
-B/usr/arm-none-linux-gnueabi/bin/ -B/usr/arm-none-linux-gnueabi/lib/  
-isystem /usr/arm-none-linux-gnueabi/include -isystem  
/usr/arm-none-linux-gnueabi/sys-include -o std/math.o -Wall -g -frelease  
-O2 -fversion=GC_Use_Alloc_MMap -fversion=GC_Use_Stack_GLibC  
-fversion=GC_Use_Data_Fixed -nostdinc -pipe -I  
../../../gcc-4.4.5-build/libphobos -I ./arm-none-linux-gnueabi   
-fdeprecated -c ../../../gcc-4.4.5t-build/libphobos/std/math.d
../../../gcc-4.4.5-build/libphobos/std/math.d:2080: Error: undefined  
identifier INEXACT_MASK
../../../gcc-4.4.5-build/libphobos/std/math.d:2082: Error: undefined  
identifier UNDERFLOW_MASK
../../../gcc-4.4.5-build/libphobos/std/math.d:2084: Error: undefined  
identifier OVERFLOW_MASK
../../../gcc-4.4.5-build/libphobos/std/math.d:2086: Error: undefined  
identifier DIVBYZERO_MASK
../../../gcc-4.4.5-build/libphobos/std/math.d:2088: Error: undefined  
identifier INVALID_MASK
make[3]: *** [std/math.o] Fehler 1
make[3]: Leaving directory  
`/var/abs/local/cross-arm-linux-gnueabi/cross-arm-none-linux-gnueabi-gdc2-hg/src/gcc-build/arm-none-linux-gnueabi/libphobos'
make[2]: *** [all] Fehler 2
make[2]: Leaving directory  
`/var/abs/local/cross-arm-linux-gnueabi/cross-arm-none-linux-gnueabi-gdc2-hg/src/gcc-build/arm-none-linux-gnueabi/libphobos'
make[1]: *** [all-target-libphobos] Fehler 2
make[1]: Leaving directory  
`/var/abs/local/cross-arm-linux-gnueabi/cross-arm-none-linux-gnueabi-gdc2-hg/src/gcc-build'
-------------------------------------------------------------------------------------------------------------------------

I guess I have to find those values for ARM, but I fear there could be  
more ARM specific problems with phobos.
-- 
Johannes Pfau


More information about the D.gnu mailing list