Re: compiled executable crashes with 'illegal instruction'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



27.12.2010 21:41, Vangelis Rokas kirjoitti:

I am trying cross compile GCC 4.5.2 for ARM ( Faraday FA526 arm processor, armv4)
> from Fedora Linux 14 using GCC 4.5.1

I use the following packages:
gmp-5.0.1
mpfr-3.0.0
mpc-0.8.2

.. and ...

binutils-2.21
newlib-1.18.0

The command lines to build the sources are:

I use configure invoked inside ./build directory to build Makefiles:
./../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --disable-multilib --enable-languages="c,c++" --with-newlib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs --without-headers --disable-shared --disable-libssp --disable-nls --disable-hardfloat --enable-threads=single --with-gnu-as --with-gnu-ld

where:
TARGET=arm-eabi
PREFIX=/usr/local/arm

after that I issue: make -j2
and then : make install

Compilation ends after 10-15 mins and the tree correctly placed under /usr/local/arm

for main.c:
#include<stdio.h>
void main(void) { printf("Hello World\n"); }

I can issue:
arm-eabi-gcc main.c -o t

When I try to run the above executable in ARM Linux enviroment,
it crashes with the message: 'Illegal instruction'.

What on earth has put you to think that 'arm-eabi' target is
the same target as 'arm-linux-gnueabi' ?  The first is only
a bare iron embedded target, the latter is GNU/Linux, a system
target !

Can you help to correctly build GCC ? What are the parameters that should give to
configure in order for GCC to be properly buld for ARM enviroment?

 .../configure --target=arm-linux-gnueabi ....

For other parameters please consult the current/earlier native
GCC. As default a cross GCC for a system target is "another
incarnation of the already existing native GCC", ie the egg that
exists before the becoming chicken or vice versa... As default
a cross GCC for an embedded target will be built from scratch,
there is no already existing native GCC and one cannot even create
such with the produced cross GCC !  In your 'arm-eabi' case there
are no native GCCs for it :(

So the build is quite alike with the build of a native GCC, the
prerequisites being existing binutils for the $target and existing
C library for the $target. For a native GCC these are in '/usr/bin',
'/usr/include', '/usr/lib' and '/lib', for a cross GCC in
'$prefix/$target/bin', '$sysroot/usr/include', '$sysroot/usr/lib'
and '$sysroot/lib'. The $sysroot is the place for the root filesystem
for the $target on the cross $host system and at least has the target
C library "as it is", copied from the existing target system. Should
be very simple...


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux