I have referred to the output of "readelf -h target.bin" (target.bin runs on target machine) for the configuration of cross-compiler. I assumed readelf output of a binary program compiled by a cross-compiler should be same as that of target.bin.
In the following case, however, two programs that have different "readelf" outputs from each other could successfully run on target machine. Morever, another program that have similar readelf outputs to the outputs of target.bin is not executable on target machine. It seems like that readelf outputs are not important for the configuration of cross compiler. Then... which things should I refer to for the correct configuration of cross compiler for the target machine?
Example:
readelf -h target.bin (target.bin is binary program running on Target machine) outputs:
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: MIPS R3000
Version: 0x1
Entry point address: 0x403570
Start of program headers: 52 (bytes into file)
Start of section headers: 114040 (bytes into file)
Flags: 0x5, noreorder, cpic, mips1
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 23
Section header string table index: 22
readelf -h myfail_target.bin (compiled by me), which is not executable on target machine, outputs:
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: MIPS R3000
Version: 0x1
Entry point address: 0x400170
Start of program headers: 52 (bytes into file)
Start of section headers: 16444 (bytes into file)
Flags: 0x1007, noreorder, pic, cpic, o32, mips1
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
readelf -h mysuccess_target.bin (compiled by me), which is executable on target machine, outputs:
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: MIPS R3000
Version: 0x1
Entry point address: 0x400140
Start of program headers: 52 (bytes into file)
Start of section headers: 28572 (bytes into file)
Flags: 0x50001007, noreorder, pic, cpic, o32, mips32
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: 20
Section header string table index: 17
Any comments would be appreciated.