Welcome, Guest
Username: Password: Remember me
CodeTyphon Cross-Build Development, discussions and problems
  • Page:
  • 1

TOPIC:

Win32 -> PowerPC(32) Linux: "Illegal instruction" 10 years 6 months ago #4494

  • Rain
  • Rain's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 69
  • Thank you received: 8
The ToolChain-Builder is great! Very easy to use.

But I run into a problem:
Cross Compilation Win32 -> PowerPC(32) Linux: "Illegal instruction" when generated executable is executed on Target Machine.

Cross Compilation Win32 -> PowerPC(32) Linux works so far, that an executable is created.
But the generated executable is faulty inside: "Illegal instruction" is printed when executed on the target machine.
The Dump also looks faulty/incomplete:
ELF Header

  Class:      ELF32
  Encoding:   Big endian
  ELFVersion: Current
  Type:       Executable file
  Machine:    PowerPC
  Version:    Current
  Entry:      0x100000a0
  Flags:      0x0

Section Headers:
[  Nr ] Type              Addr     Size     ES Flg Lk Inf Al Name
[    0] NULL              00000000 00000000 00     00 000 00                   
[    1] PROGBITS          10000094 00026464 00 AX  00 000 04 .text             
[    2] PROGBITS          100264f8 0000418b 00 A   00 000 04 .rodata           
[    3] PROGBITS          1002a684 00000000 00 A   00 000 04 .eh_frame         
[    4] PROGBITS          1003a684 00000886 00 WA  00 000 04 .data             
[    5] NOBITS            1003af0c 00001fcc 00 WA  00 000 04 .bss              
[    6] STRTAB            00000000 0000002e 00     00 000 01 .shstrtab         
Key to Flags: W (write), A (alloc), X (execute)


Segment headers:
[  Nr ] Type           VirtAddr PhysAddr FileSize Mem.Size Flags    Align
[    0] LOAD           10000000 10000000 0002a684 0002a684 RX       00010000 
[    1] LOAD           1003a684 1003a684 00000886 00002854 RW       00010000 
[    2] ? (0x6474e551) 00000000 00000000 00000000 00000000 RW       00000004 


Generated by ELFIO (C++ library for ELF file processing)
http://elfio.sourceforge.net/


A working ELF file from that machine would look like this:
ELF Header

  Class:      ELF32
  Encoding:   Big endian
  ELFVersion: Current
  Type:       Executable file
  Machine:    PowerPC
  Version:    Current
  Entry:      0x10004a18
  Flags:      0x0

Section Headers:
[  Nr ] Type              Addr     Size     ES Flg Lk Inf Al Name
[    0] NULL              00000000 00000000 00     00 000 00                   
[    1] PROGBITS          10000154 0000000d 00 A   00 000 01 .interp           
[    2] NOTE              10000170 00000020 00 A   00 000 10 .note.ABI-tag     
[    3] HASH              10000190 000008b8 04 A   04 000 04 .hash             
[    4] DYNSYM            10000a48 00001250 10 A   05 001 04 .dynsym           
[    5] STRTAB            10001c98 00001c34 00 A   00 000 01 .dynstr           
[    6] ? (0x6fffffff)    100038cc 0000024a 02 A   04 000 02 .gnu.version      
[    7] ? (0x6ffffffe)    10003b18 000000b0 00 A   05 003 04 .gnu.version_r    
[    8] RELA              10003bc8 00000210 0c A   04 000 04 .rela.dyn         
[    9] RELA              10003dd8 00000c18 0c A   04 01a 04 .rela.plt         
[   10] PROGBITS          100049f0 00000028 00 AX  00 000 04 .init             
[   11] PROGBITS          10004a18 0007f058 00 AX  00 000 04 .text             
[   12] PROGBITS          10083a70 00000020 00 AX  00 000 04 .fini             
[   13] PROGBITS          10083a90 0002b789 00 A   00 000 08 .rodata           
[   14] PROGBITS          100af21c 00000000 00 A   00 000 04 .sdata2           
[   15] PROGBITS          100af21c 0000298c 00 A   00 000 04 .eh_frame_hdr     
[   16] PROGBITS          100c2000 00000088 00 WA  00 000 04 .data             
[   17] PROGBITS          100c2088 0000bc70 00 A   00 000 04 .eh_frame         
[   18] PROGBITS          100cdcf8 00000014 00 WA  00 000 01 .got2             
[   19] DYNAMIC           100cdd0c 000000e0 08 WA  05 000 04 .dynamic          
[   20] PROGBITS          100cddec 00000090 00 WA  00 000 04 .ctors            
[   21] PROGBITS          100cde7c 00000008 00 WA  00 000 04 .dtors            
[   22] PROGBITS          100cde84 00000004 00 WA  00 000 04 .jcr              
[   23] PROGBITS          100cde88 00000014 04 WAX 00 000 04 .got              
[   24] PROGBITS          100cde9c 000000b0 00 WA  00 000 04 .sdata            
[   25] NOBITS            100cdf50 0000004a 00 WA  00 000 08 .sbss             
[   26] NOBITS            100cdf9c 00000c60 00 WAX 00 000 04 .plt              
[   27] NOBITS            100cec00 00000378 00 WA  00 000 10 .bss              
[   28] PROGBITS          00000000 00000306 00     00 000 01 .comment          
[   29] STRTAB            00000000 000000e9 00     00 000 01 .shstrtab         
Key to Flags: W (write), A (alloc), X (execute)


Segment headers:
[  Nr ] Type           VirtAddr PhysAddr FileSize Mem.Size Flags    Align
[    0] PHDR           10000034 10000034 00000120 00000120 RX       00000004 
[    1] INTERP         10000154 10000154 0000000d 0000000d R        00000001 
[    2] LOAD           10000000 10000000 000b1ba8 000b1ba8 RX       00010000 
[    3] LOAD           100c2000 100c2000 0000bf4c 0000cf78 RWX      00010000 
[    4] DYNAMIC        100cdd0c 100cdd0c 000000e0 000000e0 RW       00000004 
[    5] NOTE           10000170 10000170 00000020 00000020 R        00000010 
[    6] ? (0x6474e550) 100af21c 100af21c 0000298c 0000298c R        00000004 
[    7] ? (0x6474e551) 00000000 00000000 00000000 00000000 RWX      00000004 

Symbol table (.dynsym)
[  Nr ] Value    Size     Type    Bind      Sect Name
[    0] 00000000 00000000 NOTYPE  LOCAL        0   
[    1] 100cdfe4 000000c0 FUNC    GLOBAL       0 __cxa_end_catch 
[    2] 100cdfec 00000198 FUNC    GLOBAL       0 _ZNSirsERt 
..............
[  291] 00000000 00000000 NOTYPE  WEAK         0 __gmon_start__ 
[  292] 100ce7ec 000000d8 FUNC    GLOBAL       0 strcpy 

Dynamic section (.dynamic)
[  Nr ] Tag              Name/Value
[    0] NEEDED           libstdc++.so.6                   
[    1] NEEDED           libm.so.6                        
[    2] NEEDED           libgcc_s_nof.so.1                
[    3] NEEDED           libc.so.6                        
[    4] INIT             00000000100049f0 
[    5] FINI             0000000010083a70 
[    6] HASH             0000000010000190 
[    7] STRTAB           0000000010001c98 
[    8] SYMTAB           0000000010000a48 
[    9] STRSZ            0000000000001c34 
[   10] SYMENT           0000000000000010 
[   11] DEBUG            0000000000000000 
[   12] PLTGOT           00000000100cdf9c 
[   13] PLTRELSZ         0000000000000c18 
[   14] PLTREL           0000000000000007 
[   15] JMPREL           0000000010003dd8 
[   16] RELA             0000000010003bc8 
[   17] RELASZ           0000000000000e28 
[   18] RELAENT          000000000000000c 
[   19] ? (0x6ffffffe)   0000000010003b18 
[   20] ? (0x6fffffff)   0000000000000003 
[   21] ? (0x6ffffff0)   00000000100038cc 
[   22] NULL             0000000000000000 

Note section (.note.ABI-tag)
    No Type     Name
  [ 0] 00000001 GNU


Generated by ELFIO (C++ library for ELF file processing)
http://elfio.sourceforge.net/

So something did happen to the toolchain ?
Or FPC was untested for a while with PowerPCs(32)?

The test program was reduced to the simplest form, still "Illegal instruction":
program project1;

begin
  writeln('Hello together');
end.

So the question is: Who has an idea, what can be done to create a valid ELF image ?

Please Log in or Create an account to join the conversation.

  • Page:
  • 1