compiled executable crashes with 'illegal instruction'

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

 



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

which compiles the program without problem:
arm-eabi-readelf -h t

gives:
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x80ac
  Start of program headers:          52 (bytes into file)
  Start of section headers:          193676 (bytes into file)
  Flags:                             0x5000002, has entry point, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         3
  Size of section headers:           40 (bytes)
  Number of section headers:         27
  Section header string table index: 24

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

As you can see OS/ABI is UNIX (System V) and not ARM as it is when I run
readelf on another binary from a native ARM linux enviroment, which gives:

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            ARM
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0xe744
  Start of program headers:          52 (bytes into file)
  Start of section headers:          436088 (bytes into file)
  Flags:                             0x202, has entry point, GNU EABI, software FP
  Size of this header:              52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         5
  Size of section headers:           40 (bytes)
  Number of section headers:         21
  Section header string table index: 20

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?

thank you in advance,
Evangelos Rokas

 		 	   		  



[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