[arm-gnu] illegal instruction with arm linux 4.3.2 toolchain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[arm-gnu] illegal instruction with arm linux 4.3.2 toolchain



Hi,

i try desesperely  to use arm linux 4.3.2 toolchain on a target running with at9263 CPU and linux kernel 2.6.24
I have install the toochain on unbuntu 10.4 UC. the librairy needed has been copy on the target.
i compile the "hello" simple program

#include <stdio.h>

int main (void)
{
printf("Hello World!\n");
return 0;
}

 with the commands :

SYSROOT=/usr/local/sysroot

    /home/elie/Téléchargements/arm-2010q1/bin/arm-none-linux-gnueabi-gcc \
    -mcpu=arm926ej-s \
    -Wl,-rpath=$(SYSROOT)/lib:$(SYSROOT)/usr/lib \
    -Wl,--dynamic-linker=$(SYSROOT)/lib/ld-linux.so.3 \
    -v \
    -o hello hello.c

When i run the binary program "./hello" i get error : illegal instruction

The readelf -a hello  instruction give me the détail :

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:               0x838c
  Start of program headers:          52 (bytes into file)
  Start of section headers:          2152 (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:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         30
  Section header string table index: 27

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        00008134 000134 000013 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            00008148 000148 000020 00   A  0   0  4
  [ 3] .hash             HASH            00008168 000168 000034 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          0000819c 00019c 000080 10   A  5   1  4
  [ 5] .dynstr           STRTAB          0000821c 00021c 0000a7 00   A  0   0  1
  [ 6] .gnu.version      VERSYM          000082c4 0002c4 000010 02   A  4   0  2
  [ 7] .gnu.version_r    VERNEED         000082d4 0002d4 000040 00   A  5   2  4
  [ 8] .rel.dyn          REL             00008314 000314 000008 08   A  4   0  4
  [ 9] .rel.plt          REL             0000831c 00031c 000020 08   A  4  11  4
  [10] .init             PROGBITS        0000833c 00033c 00000c 00  AX  0   0  4
  [11] .plt              PROGBITS        00008348 000348 000044 04  AX  0   0  4
  [12] .text             PROGBITS        0000838c 00038c 00019c 00  AX  0   0  4
  [13] .fini             PROGBITS        00008528 000528 000008 00  AX  0   0  4
  [14] .rodata           PROGBITS        00008530 000530 000014 00   A  0   0  4
  [15] .ARM.extab        PROGBITS        00008544 000544 000018 00   A  0   0  4
  [16] .ARM.exidx        ARM_EXIDX       0000855c 00055c 000038 00  AL 12   0  4
  [17] .init_array       INIT_ARRAY      00010594 000594 000004 00  WA  0   0  4
  [18] .fini_array       FINI_ARRAY      00010598 000598 000004 00  WA  0   0  4
  [19] .jcr              PROGBITS        0001059c 00059c 000004 00  WA  0   0  4
  [20] .dynamic          DYNAMIC         000105a0 0005a0 0000f8 08  WA  5   0  4
  [21] .got              PROGBITS        00010698 000698 000020 04  WA  0   0  4
  [22] .data             PROGBITS        000106b8 0006b8 000008 00  WA  0   0  4
  [23] .bss              NOBITS          000106c0 0006c0 000004 00  WA  0   0  1
  [24] .ARM.attributes   ARM_ATTRIBUTES  00000000 0006c0 000032 00      0   0  1
  [25] .comment          PROGBITS        00000000 0006f2 00002b 00      0   0  1
  [26] .debug_frame      PROGBITS        00000000 000720 000044 00      0   0  4
  [27] .shstrtab         STRTAB          00000000 000764 000101 00      0   0  1
  [28] .symtab           SYMTAB          00000000 000d18 000670 10     29  79  4
  [29] .strtab           STRTAB          00000000 001388 000261 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x00055c 0x0000855c 0x0000855c 0x00038 0x00038 R   0x4
  PHDR           0x000034 0x00008034 0x00008034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x00008134 0x00008134 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.3]
  LOAD           0x000000 0x00008000 0x00008000 0x00594 0x00594 R E 0x8000
  LOAD           0x000594 0x00010594 0x00010594 0x0012c 0x00130 RW  0x8000
  DYNAMIC        0x0005a0 0x000105a0 0x000105a0 0x000f8 0x000f8 RW  0x4
  NOTE           0x000148 0x00008148 0x00008148 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     .ARM.exidx 
   01     
   02     .interp 
   03     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.extab .ARM.exidx 
   04     .init_array .fini_array .jcr .dynamic .got .data .bss 
   05     .dynamic 
   06     .note.ABI-tag 
   07     

Dynamic section at offset 0x5a0 contains 26 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000f (RPATH)                      Library rpath: [/lib:/usr/lib]
 0x0000000c (INIT)                       0x833c
 0x0000000d (FINI)                       0x8528
 0x00000019 (INIT_ARRAY)                 0x10594
 0x0000001b (INIT_ARRAYSZ)               4 (bytes)
 0x0000001a (FINI_ARRAY)                 0x10598
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x00000004 (HASH)                       0x8168
 0x00000005 (STRTAB)                     0x821c
 0x00000006 (SYMTAB)                     0x819c
 0x0000000a (STRSZ)                      167 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x10698
 0x00000002 (PLTRELSZ)                   32 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x831c
 0x00000011 (REL)                        0x8314
 0x00000012 (RELSZ)                      8 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x82d4
 0x6fffffff (VERNEEDNUM)                 2
 0x6ffffff0 (VERSYM)                     0x82c4
 0x00000000 (NULL)                       0x0

Relocation section '.rel.dyn' at offset 0x314 contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
000106b4  00000415 R_ARM_GLOB_DAT    00000000   __gmon_start__

Relocation section '.rel.plt' at offset 0x31c contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
000106a4  00000116 R_ARM_JUMP_SLOT   0000835c   abort
000106a8  00000216 R_ARM_JUMP_SLOT   00008368   __libc_start_main
000106ac  00000416 R_ARM_JUMP_SLOT   00000000   __gmon_start__
000106b0  00000616 R_ARM_JUMP_SLOT   00008380   puts

Unwind table index '.ARM.exidx' at offset 0x55c contains 7 entries:

0x838c <_start>: 0x1 [cantunwind]

0x83ec <__do_global_dtors_aux>: 0x80b0b0b0
  Compact model 0
  0xb0      finish
  0xb0      finish
  0xb0      finish

0x8408 <frame_dummy>: @0x8544
  Compact model 1
  0xb1 0x08 pop {r3}
  0x84 0x00 pop {r14}
  0xb0      finish
  0xb0      finish

0x8438 <main>: @0x8550
  Compact model 1
  0x9b      vsp = r11
  0x40      vsp = vsp - 4
  0x84 0x80 pop {r11, r14}
  0xb0      finish
  0xb0      finish

0x8458 <__libc_csu_fini>: 0x80b0b0b0
  Compact model 0
  0xb0      finish
  0xb0      finish
  0xb0      finish

0x845c <__libc_csu_init>: 0x80aeb0b0
  Compact model 0
  0xae      pop {r4, r5, r6, r7, r8, r9, r10r14}
  0xb0      finish
  0xb0      finish

0x8528 <_fini>: 0x1 [cantunwind]


Symbol table '.dynsym' contains 8 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000835c     0 FUNC    GLOBAL DEFAULT  UND abort@xxxxxxxxx (2)
     2: 00008368     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@xxxxxxxxx (2)
     3: 00000000     0 FUNC    GLOBAL DEFAULT  UND __aeabi_unwind_cpp_pr0@xxxxxxx (3)
     4: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
     5: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
     6: 00008380     0 FUNC    GLOBAL DEFAULT  UND puts@xxxxxxxxx (2)
     7: 00000000     0 FUNC    GLOBAL DEFAULT  UND __aeabi_unwind_cpp_pr1@xxxxxxx (3)

Symbol table '.symtab' contains 103 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00008134     0 SECTION LOCAL  DEFAULT    1 
     2: 00008148     0 SECTION LOCAL  DEFAULT    2 
     3: 00008168     0 SECTION LOCAL  DEFAULT    3 
     4: 0000819c     0 SECTION LOCAL  DEFAULT    4 
     5: 0000821c     0 SECTION LOCAL  DEFAULT    5 
     6: 000082c4     0 SECTION LOCAL  DEFAULT    6 
     7: 000082d4     0 SECTION LOCAL  DEFAULT    7 
     8: 00008314     0 SECTION LOCAL  DEFAULT    8 
     9: 0000831c     0 SECTION LOCAL  DEFAULT    9 
    10: 0000833c     0 SECTION LOCAL  DEFAULT   10 
    11: 00008348     0 SECTION LOCAL  DEFAULT   11 
    12: 0000838c     0 SECTION LOCAL  DEFAULT   12 
    13: 00008528     0 SECTION LOCAL  DEFAULT   13 
    14: 00008530     0 SECTION LOCAL  DEFAULT   14 
    15: 00008544     0 SECTION LOCAL  DEFAULT   15 
    16: 0000855c     0 SECTION LOCAL  DEFAULT   16 
    17: 00010594     0 SECTION LOCAL  DEFAULT   17 
    18: 00010598     0 SECTION LOCAL  DEFAULT   18 
    19: 0001059c     0 SECTION LOCAL  DEFAULT   19 
    20: 000105a0     0 SECTION LOCAL  DEFAULT   20 
    21: 00010698     0 SECTION LOCAL  DEFAULT   21 
    22: 000106b8     0 SECTION LOCAL  DEFAULT   22 
    23: 000106c0     0 SECTION LOCAL  DEFAULT   23 
    24: 00000000     0 SECTION LOCAL  DEFAULT   24 
    25: 00000000     0 SECTION LOCAL  DEFAULT   25 
    26: 00000000     0 SECTION LOCAL  DEFAULT   26 
    27: 000083c8     0 NOTYPE  LOCAL  DEFAULT   12 $a
    28: 000083c8     0 FUNC    LOCAL  DEFAULT   12 call_gmon_start
    29: 000083e4     0 NOTYPE  LOCAL  DEFAULT   12 $d
    30: 0000833c     0 NOTYPE  LOCAL  DEFAULT   10 $a
    31: 00008528     0 NOTYPE  LOCAL  DEFAULT   13 $a
    32: 00008148     0 NOTYPE  LOCAL  DEFAULT    2 $d
    33: 0000838c     0 NOTYPE  LOCAL  DEFAULT   12 $a
    34: 0000855c     0 NOTYPE  LOCAL  DEFAULT   16 $d
    35: 000083bc     0 NOTYPE  LOCAL  DEFAULT   12 $d
    36: 00000000     0 FILE    LOCAL  DEFAULT  ABS init.c
    37: 00008530     0 NOTYPE  LOCAL  DEFAULT   14 $d
    38: 000106b8     0 NOTYPE  LOCAL  DEFAULT   22 $d
    39: 00008344     0 NOTYPE  LOCAL  DEFAULT   10 $a
    40: 0000852c     0 NOTYPE  LOCAL  DEFAULT   13 $a
    41: 00000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    42: 0001059c     0 OBJECT  LOCAL  DEFAULT   19 __JCR_LIST__
    43: 000106bc     0 NOTYPE  LOCAL  DEFAULT   22 $d
    44: 000083ec     0 NOTYPE  LOCAL  DEFAULT   12 $a
    45: 000083ec     0 FUNC    LOCAL  DEFAULT   12 __do_global_dtors_aux
    46: 00008404     0 NOTYPE  LOCAL  DEFAULT   12 $d
    47: 000106c0     1 OBJECT  LOCAL  DEFAULT   23 completed.6102
    48: 00008564     0 NOTYPE  LOCAL  DEFAULT   16 $d
    49: 00010598     0 NOTYPE  LOCAL  DEFAULT   18 $d
    50: 00010598     0 OBJECT  LOCAL  DEFAULT   18 __do_global_dtors_aux_fin
    51: 00008408     0 NOTYPE  LOCAL  DEFAULT   12 $a
    52: 00008408     0 FUNC    LOCAL  DEFAULT   12 frame_dummy
    53: 00008430     0 NOTYPE  LOCAL  DEFAULT   12 $d
    54: 00008544     0 NOTYPE  LOCAL  DEFAULT   15 $d
    55: 00010594     0 NOTYPE  LOCAL  DEFAULT   17 $d
    56: 00010594     0 OBJECT  LOCAL  DEFAULT   17 __frame_dummy_init_array_
    57: 000106c0     0 NOTYPE  LOCAL  DEFAULT   23 $d
    58: 00000000     0 FILE    LOCAL  DEFAULT  ABS hello.c
    59: 00008534     0 NOTYPE  LOCAL  DEFAULT   14 $d
    60: 00008438     0 NOTYPE  LOCAL  DEFAULT   12 $a
    61: 00008454     0 NOTYPE  LOCAL  DEFAULT   12 $d
    62: 00008550     0 NOTYPE  LOCAL  DEFAULT   15 $d
    63: 00008574     0 NOTYPE  LOCAL  DEFAULT   16 $d
    64: 00000000     0 FILE    LOCAL  DEFAULT  ABS elf-init.c
    65: 00008458     0 NOTYPE  LOCAL  DEFAULT   12 $a
    66: 0000857c     0 NOTYPE  LOCAL  DEFAULT   16 $d
    67: 0000851c     0 NOTYPE  LOCAL  DEFAULT   12 $d
    68: 00000010     0 NOTYPE  LOCAL  DEFAULT   26 $d
    69: 00000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    70: 0001059c     0 NOTYPE  LOCAL  DEFAULT   19 $d
    71: 0001059c     0 OBJECT  LOCAL  DEFAULT   19 __JCR_END__
    72: 00010698     0 OBJECT  LOCAL  HIDDEN   21 _GLOBAL_OFFSET_TABLE_
    73: 00010598     0 NOTYPE  LOCAL  HIDDEN   17 __init_array_end
    74: 00010594     0 NOTYPE  LOCAL  HIDDEN   17 __init_array_start
    75: 000105a0     0 OBJECT  LOCAL  HIDDEN   20 _DYNAMIC
    76: 00008348     0 NOTYPE  LOCAL  DEFAULT   11 $a
    77: 00008358     0 NOTYPE  LOCAL  DEFAULT   11 $d
    78: 0000835c     0 NOTYPE  LOCAL  DEFAULT   11 $a
    79: 000106b8     0 NOTYPE  WEAK   DEFAULT   22 data_start
    80: 0000835c     0 FUNC    GLOBAL DEFAULT  UND abort@@GLIBC_2.4
    81: 00008458     4 FUNC    GLOBAL DEFAULT   12 __libc_csu_fini
    82: 0000838c     0 FUNC    GLOBAL DEFAULT   12 _start
    83: 00008368     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@@GLIBC_
    84: 00000000     0 FUNC    GLOBAL DEFAULT  UND __aeabi_unwind_cpp_pr0@@G
    85: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
    86: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
    87: 00008528     0 FUNC    GLOBAL DEFAULT   13 _fini
    88: 00008530     4 OBJECT  GLOBAL DEFAULT   14 _IO_stdin_used
    89: 000106b8     0 NOTYPE  GLOBAL DEFAULT   22 __data_start
    90: 000106c0     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start__
    91: 000106bc     0 OBJECT  GLOBAL HIDDEN   22 __dso_handle
    92: 000106c4     0 NOTYPE  GLOBAL DEFAULT  ABS __end__
    93: 0000845c   204 FUNC    GLOBAL DEFAULT   12 __libc_csu_init
    94: 000106c4     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_end__
    95: 000106c0     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start
    96: 000106c4     0 NOTYPE  GLOBAL DEFAULT  ABS _bss_end__
    97: 00008380     0 FUNC    GLOBAL DEFAULT  UND puts@@GLIBC_2.4
    98: 000106c4     0 NOTYPE  GLOBAL DEFAULT  ABS _end
    99: 000106c0     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
   100: 00000000     0 FUNC    GLOBAL DEFAULT  UND __aeabi_unwind_cpp_pr1@@G
   101: 00008438    32 FUNC    GLOBAL DEFAULT   12 main
   102: 0000833c     0 FUNC    GLOBAL DEFAULT   10 _init

Histogram for bucket list length (total of 3 buckets):
 Length  Number     % of total  Coverage
      0  0          (  0.0%)
      1  0          (  0.0%)      0.0%
      2  2          ( 66.7%)     57.1%
      3  1          ( 33.3%)    100.0%

Version symbols section '.gnu.version' contains 8 entries:
 Addr: 00000000000082c4  Offset: 0x0002c4  Link: 4 (.dynsym)
  000:   0 (*local*)       2 (GLIBC_2.4)     2 (GLIBC_2.4)     3 (GCC_3.5)    
  004:   0 (*local*)       0 (*local*)       2 (GLIBC_2.4)     3 (GCC_3.5)    

Version needs section '.gnu.version_r' contains 2 entries:
 Addr: 0x00000000000082d4  Offset: 0x0002d4  Link: 5 (.dynstr)
  000000: Version: 1  File: libgcc_s.so.1  Cnt: 1
  0x0010:   Name: GCC_3.5  Flags: none  Version: 3
  0x0020: Version: 1  File: libc.so.6  Cnt: 1
  0x0030:   Name: GLIBC_2.4  Flags: none  Version: 2

Notes at offset 0x00000148 with length 0x00000020:
  Owner         Data size       Description
  GNU           0x00000010      NT_GNU_ABI_TAG (ABI version tag)
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "ARM926EJ-S"
  Tag_CPU_arch: v5TEJ
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align8_needed: Yes
  Tag_ABI_align8_preserved: Yes, except leaf SP
  Tag_ABI_enum_size: int
  Tag_unknown_44: 1 (0x1)

Please could some one help me to fix this problem

Thanks