Programming & Tools/Android
[Android] not executable: magic 7F45
다크쌍피
2013. 5. 21. 16:40
안드로이드 커널에서 프로그램을 실행 하기 위해서 크로스 컴파일 시
not executable: magic 7F45
메시지가 출력 되고 프로그램을 실행 시킬 수 없을 때 컴파일 옵션을 확인 해봐야 한다.
컴파일 시 링크가 정상적으로 되지 않아서 실행 파일로 생성이 되지 않았을 것이다.
type이 EXEC (Executable file) 인지 확인해본다.
컴파일 후 elf 파일 헤더를 확인해 본다.
$ arm-none-linux-gnueabi-readelf --file-header --arch-specific XXXXXXfile
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: 0x8120 Start of program headers: 52 (bytes into file) Start of section headers: 554168 (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: 6 Size of section headers: 40 (bytes) Number of section headers: 28 Section header string table index: 25 Attribute Section: aeabi File Attributes Tag_CPU_name: "5TE" Tag_CPU_arch: v5TE 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 |