Thomas Meyer schrieb:
Thomas Meyer schrieb:
Thomas Meyer schrieb:
Hello.
I try to build a cross compiler for this target: arm-uclinux-uclibc:
First the build fails because of a wrong config entry in config.gcc:
This should fix this:
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 033cc3d..378a92d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -691,7 +691,7 @@ arm*-*-linux*) # ARM GNU/Linux with ELF
tm_file="$tm_file arm/aout.h arm/arm.h"
;;
arm*-*-uclinux*) # ARM ucLinux
- tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h
arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h arm/uclinux-elf.h"
+ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h
arm/aout.h arm/arm.h arm/linux-gas.h arm/uclinux-elf.h"
tmake_file="arm/t-arm arm/t-arm-elf"
;;
arm*-*-ecos-elf)
Compile continues here but then i get this error likley while
building libgcc2 (clear_cache):
/home/thomas/source/buildgcc/./gcc/xgcc
-B/home/thomas/source/buildgcc/./gcc/ -B/usr/arm-uclinux-uclibc/bin/
-B/usr/arm-uclinux-uclibc/lib/ -isystem
/usr/arm-uclinux-uclibc/include -isystem
/usr/arm-uclinux-uclibc/sys-include -O2 -g -Os -DIN_GCC
-DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -isystem ./include
-Dinhibit_libc -fno-inline -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-Dinhibit_libc -I. -I. -I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/.
-I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include -mthumb -DL_clear_cache -c
../../gcc-4.1.1/gcc/libgcc2.c -o libgcc/thumb/_clear_cache.o
In file included from ./tm.h:13,
from ../../gcc-4.1.1/gcc/libgcc2.c:35:
../../gcc-4.1.1/gcc/config/arm/uclinux-elf.h:68:1: warning:
"LINK_GCC_C_SEQUENCE_SPEC" redefined
In file included from ./tm.h:8,
from ../../gcc-4.1.1/gcc/libgcc2.c:35:
../../gcc-4.1.1/gcc/config/arm/unknown-elf.h:97:1: warning: this is
the location of the previous definition
/tmp/ccnrn9Ag.s: Assembler messages:
/tmp/ccnrn9Ag.s:26: Error: invalid swi expression
/tmp/ccnrn9Ag.s:26: Error: value of 00000000009f0002 too large for
field of 2 bytes at 0000000000000002
make[3]: *** [libgcc/thumb/_clear_cache.o] Fehler 1
make[3]: Leaving directory `/home/thomas/source/buildgcc/gcc'
make[2]: *** [stmp-multilib] Fehler 2
make[2]: Leaving directory `/home/thomas/source/buildgcc/gcc'
make[1]: *** [all-gcc] Fehler 2
make[1]: Leaving directory `/home/thomas/source/buildgcc'
make: *** [all] Fehler 2
Any ideas?
Here is the created assembler code:
.code 16
.file "libgcc2.c"
.section .debug_abbrev,"",%progbits
.Ldebug_abbrev0:
.section .debug_info,"",%progbits
.Ldebug_info0:
.section .debug_line,"",%progbits
.Ldebug_line0:
.text
.Ltext0:
.align 2
.global __clear_cache
.code 16
.thumb_func
.type __clear_cache, %function
__clear_cache:
.LFB2:
.file 1 "../../gcc-4.1.1/gcc/libgcc2.c"
.loc 1 1814 0
.LVL0:
@ lr needed for prologue
.LBB2:
.loc 1 1816 0
mov r2, #0
.LVL1:
swi 0x9f0002 @ sys_cacheflush
.code 16
.LBE2:
.loc 1 1818 0
@ sp needed for prologue
bx lr
Rhe swi call seems to be ok for linux. I'm not sure why the xgcc
doesn't seem to like this instruction.
Ah! Now i understand: The binutils-as seems to be called from gcc,
this programs throws the original error:
./arm-uclinux-uclibc-as libgcc2.s
libgcc2.s: Assembler messages:
libgcc2.s:26: Error: invalid swi expression
libgcc2.s:26: Error: value of 00000000009f0002 too large for field of
2 bytes at 0000000000000002
So this is maybe an error in my binutils version, that is 2.17?
Ok. This is not an error in binutils as. The code is .code 16, so this
should run in thumb mode, which is obviuosly wrong (uclinux seems also
to use these system call vectors and runs in arm mode and not thumb
mode, doesn't it?!) so also define multilib_defaults like in linux-elf.h:
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 033cc3d..378a92d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -691,7 +691,7 @@ arm*-*-linux*) # ARM GNU/Linux with ELF
tm_file="$tm_file arm/aout.h arm/arm.h"
;;
arm*-*-uclinux*) # ARM ucLinux
- tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h
arm/arm.h arm/linux-gas.h arm/linux-elf.h arm/uclinux-elf.h"
+ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h
arm/arm.h arm/linux-gas.h arm/uclinux-elf.h"
tmake_file="arm/t-arm arm/t-arm-elf"
;;
arm*-*-ecos-elf)
diff --git a/gcc/config/arm/uclinux-elf.h b/gcc/config/arm/uclinux-elf.h
index 9f112cd..8c5fd7d 100644
--- a/gcc/config/arm/uclinux-elf.h
+++ b/gcc/config/arm/uclinux-elf.h
@@ -72,3 +72,7 @@
#ifdef HAVE_LD_AS_NEEDED
#define USE_LD_AS_NEEDED 1
#endif
+
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS \
+ { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
Please someone comment this!
With kind regards
Thomas