我编译并链接了我的程序,我得到了一个ELF32小端的格式,它是这样构建的:
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: 0x11029000
Start of program headers: 52 (bytes into file)
Start of section headers: 6804 (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: 1
Size of section headers: 40 (bytes)
Number of section headers: 16
Section header string table index: 13
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 11029000 001000 000414 00 AX 0 0 4
[ 2] .ARM.attributes ARM_ATTRIBUTES 00000000 001414 000030 00 0 0 1
[ 3] .comment PROGBITS 00000000 001444 00002a 01 MS 0 0 1
[ 4] .debug_abbrev PROGBITS 00000000 00146e 0000d8 00 0 0 1
[ 5] .debug_info PROGBITS 00000000 001546 00013c 00 0 0 1
[ 6] .debug_line PROGBITS 00000000 001682 00012f 00 0 0 1
[ 7] .debug_loc PROGBITS 00000000 0017b1 00005f 00 0 0 1
[ 8] .debug_pubnames PROGBITS 00000000 001810 000034 00 0 0 1
[ 9] .debug_aranges PROGBITS 00000000 001844 000020 00 0 0 1
[10] .debug_ranges PROGBITS 00000000 001864 000078 00 0 0 1
[11] .debug_str PROGBITS 00000000 0018dc 0000bf 01 MS 0 0 1
[12] .debug_frame PROGBITS 00000000 00199c 000048 00 0 0 4
[13] .shstrtab STRTAB 00000000 0019e4 0000b0 00 0 0 1
[14] .symtab SYMTAB 00000000 001d14 000450 10 15 55 4
[15] .strtab STRTAB 00000000 002164 000244 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), 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
LOAD 0x000000 0x11028000 0x11028000 0x01414 0x01414 R E 0x8000
Section to Segment mapping:
Segment Sections...
00 .text
There is no dynamic section in this file.
There are no relocations in this file.
There are no unwind sections in this file.
Symbol table '.symtab' contains 69 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 11029000 0 SECTION LOCAL DEFAULT 1
2: 00000000 0 SECTION LOCAL DEFAULT 2
3: 00000000 0 SECTION LOCAL DEFAULT 3
4: 00000000 0 SECTION LOCAL DEFAULT 4
5: 00000000 0 SECTION LOCAL DEFAULT 5
6: 00000000 0 SECTION LOCAL DEFAULT 6
7: 00000000 0 SECTION LOCAL DEFAULT 7
8: 00000000 0 SECTION LOCAL DEFAULT 8
9: 00000000 0 SECTION LOCAL DEFAULT 9
10: 00000000 0 SECTION LOCAL DEFAULT 10
11: 00000000 0 SECTION LOCAL DEFAULT 11
12: 00000000 0 SECTION LOCAL DEFAULT 12
13: 00000010 0 NOTYPE LOCAL DEFAULT ABS MODE_USR
14: 00000011 0 NOTYPE LOCAL DEFAULT ABS MODE_FIQ
15: 00000012 0 NOTYPE LOCAL DEFAULT ABS MODE_IRQ
16: 00000013 0 NOTYPE LOCAL DEFAULT ABS MODE_SVC
17: 000000d3 0 NOTYPE LOCAL DEFAULT ABS MODE_SVC_NI
18: 00000017 0 NOTYPE LOCAL DEFAULT ABS MODE_ABORT
19: 0000001b 0 NOTYPE LOCAL DEFAULT ABS MODE_UNDEF
20: 0000001f 0 NOTYPE LOCAL DEFAULT ABS MODE_SYSTEM
21: 0000001f 0 NOTYPE LOCAL DEFAULT ABS MODE_BITS
22: 00000080 0 NOTYPE LOCAL DEFAULT ABS I_MASK
23: 00000040 0 NOTYPE LOCAL DEFAULT ABS F_MASK
24: 000000c0 0 NOTYPE LOCAL DEFAULT ABS IF_MASK
25: 1201c000 0 NOTYPE LOCAL DEFAULT ABS BROM_MMU_BASE_ADDR
26: ffffeffa 0 NOTYPE LOCAL DEFAULT ABS MMU_DISABLE_MASK
27: 00001005 0 NOTYPE LOCAL DEFAULT ABS MMU_ENABLE_MASK
28: 00000080 0 NOTYPE LOCAL DEFAULT ABS FIQ_STACK_SIZE
29: 00000100 0 NOTYPE LOCAL DEFAULT ABS IRQ_STACK_SIZE
30: 00000020 0 NOTYPE LOCAL DEFAULT ABS ABORT_STACK_SIZE
31: 00000020 0 NOTYPE LOCAL DEFAULT ABS UNDEF_STACK_SIZE
32: 00000040 0 NOTYPE LOCAL DEFAULT ABS SYSTEM_STACK_SIZE
33: 11029000 0 NOTYPE LOCAL DEFAULT 1 $a
34: 11029080 0 NOTYPE LOCAL DEFAULT 1 arm926ejs_reset_handler
35: 11029004 0 NOTYPE LOCAL DEFAULT 1 $d
36: 1102901c 0 NOTYPE LOCAL DEFAULT 1 image_type
37: 11029020 0 NOTYPE LOCAL DEFAULT 1 sizeOfPermanentCode
38: 1102902c 0 NOTYPE LOCAL DEFAULT 1 bootparameter
39: 11029080 0 NOTYPE LOCAL DEFAULT 1 $a
40: 110290e8 0 NOTYPE LOCAL DEFAULT 1 inVirtMem
41: 1102915c 0 NOTYPE LOCAL DEFAULT 1 clearzi
42: 11029170 0 NOTYPE LOCAL DEFAULT 1 clearzi_exit
43: 11029170 0 NOTYPE LOCAL DEFAULT 1 load_entry
44: 1102918c 0 NOTYPE LOCAL DEFAULT 1 inval
45: 11029180 0 NOTYPE LOCAL DEFAULT 1 flushonly
46: 11029198 0 NOTYPE LOCAL DEFAULT 1 $d
47: 00000000 0 FILE LOCAL DEFAULT ABS cgu_fractional_divider.c
48: 110291b4 0 NOTYPE LOCAL DEFAULT 1 $a
49: 11029300 0 NOTYPE LOCAL DEFAULT 1 $d
50: 1102930c 0 NOTYPE LOCAL DEFAULT 1 $a
51: 110293d4 0 NOTYPE LOCAL DEFAULT 1 $d
52: 110293d8 0 NOTYPE LOCAL DEFAULT 1 $a
53: 11029410 0 NOTYPE LOCAL DEFAULT 1 $d
54: 00000010 0 NOTYPE LOCAL DEFAULT 12 $d
55: 11029414 0 NOTYPE GLOBAL DEFAULT 1 __gnu_bssend
56: 11029414 0 NOTYPE GLOBAL DEFAULT 1 __gnu_bssstart
57: 11029414 0 NOTYPE GLOBAL DEFAULT ABS __exidx_end
58: 00000600 0 NOTYPE GLOBAL DEFAULT ABS __image_size
59: 11029000 0 NOTYPE GLOBAL DEFAULT 1 __exidx_start
60: 11029000 0 NOTYPE GLOBAL DEFAULT 1 arm926ejs_reset
61: 11029000 0 NOTYPE GLOBAL DEFAULT 1 __start
62: 11029000 0 NOTYPE GLOBAL DEFAULT 1 __gnu_textstart
63: 1102930c 204 FUNC GLOBAL DEFAULT 1 adc_cgu
64: 11029178 0 NOTYPE GLOBAL DEFAULT 1 dcache_flush
65: 110291b4 344 FUNC GLOBAL DEFAULT 1 c_entry
66: 110293d8 60 FUNC GLOBAL DEFAULT 1 delay
67: 00000000 0 NOTYPE GLOBAL DEFAULT UND ea3131_init
68: 00000000 0 NOTYPE GLOBAL DEFAULT ABS __EH_FRAME_BEGIN__
No version information found in this file.
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_align_needed: 8-byte
Tag_ABI_enum_size: small
Tag_DIV_use: Not allowed
然后我必须使用下面的命令将我的格式更改为二进制。这就是我所听到的。但有人能告诉我ELF32格式的哪些部分确切地执行了参数“--strip-all”删除以及二进制格式如何与ELF32格式不同?
arm-none-eabi-objcopy -I elf32-littlearm -O binary --strip-all --verbose foo1 foo2
我在上面提到了我的ELF32格式细节,你可以(如果可能的话)为被移除的部分上色。
非常感谢你。
答案 0 :(得分:-1)
binary是纯数据,elf是一些描述如何使用这些数据的通用格式的数据。 精灵得到了魔法,部分,一些桌子等。 二进制只是数据本身/