x86平台下,目标文件(.obj)的COFF文件结构,后面再来详细介绍
Microsoft (R) COFF/PE Dumper Version 14.31.31106.2
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file SimpleSection.obj
File Type: COFF OBJECT
FILE HEADER VALUES
14C machine (x86)
6 number of sections
63140677 time date stamp Sun Sep 4 09:59:19 2022
260 file pointer to symbol table
17 number of symbols
0 size of optional header
0 characteristics
SECTION HEADER #1
.drectve name
0 physical address
0 virtual address
18 size of raw data
104 file pointer to raw data (00000104 to 0000011B)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
100A00 flags
Info
Remove
1 byte align
RAW DATA #1
00000000: 20 20 20 2F 44 45 46 41 55 4C 54 4C 49 42 3A 22 /DEFAULTLIB:"
00000010: 4C 49 42 43 4D 54 22 20 LIBCMT"
Linker Directives
-----------------
/DEFAULTLIB:LIBCMT
SECTION HEADER #2
.debug$S name
0 physical address
0 virtual address
88 size of raw data
11C file pointer to raw data (0000011C to 000001A3)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42100040 flags
Initialized Data
Discardable
1 byte align
Read Only
RAW DATA #2
00000000: 04 00 00 00 F1 00 00 00 7A 00 00 00 3C 00 01 11 ....?..z...<...
00000010: 00 00 00 00 43 3A 5C 55 73 65 72 73 5C 41 64 6D ....C:\Users\Adm
00000020: 69 6E 69 73 74 72 61 74 6F 72 5C 44 65 73 6B 74 inistrator\Deskt
00000030: 6F 70 5C 54 65 73 74 5C 53 69 6D 70 6C 65 53 65 op\Test\SimpleSe
00000040: 63 74 69 6F 6E 2E 6F 62 6A 00 3A 00 3C 11 00 22 ction.obj.:.<.."
00000050: 00 00 07 00 13 00 1F 00 82 79 02 00 13 00 1F 00 .........y......
00000060: 82 79 02 00 4D 69 63 72 6F 73 6F 66 74 20 28 52 .y..Microsoft (R
00000070: 29 20 4F 70 74 69 6D 69 7A 69 6E 67 20 43 6F 6D ) Optimizing Com
00000080: 70 69 6C 65 72 00 00 00 piler...
SECTION HEADER #3
.data name
0 physical address
0 virtual address
C size of raw data
1A4 file pointer to raw data (000001A4 to 000001AF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0300040 flags
Initialized Data
4 byte align
Read Write
RAW DATA #3
00000000: 54 00 00 00 25 64 0A 00 55 00 00 00 T...%d..U...
SECTION HEADER #4
.text$mn name
0 physical address
0 virtual address
4E size of raw data
1B0 file pointer to raw data (000001B0 to 000001FD)
1FE file pointer to relocation table
0 file pointer to line numbers
5 number of relocations
0 number of line numbers
60500020 flags
Code
16 byte align
Execute Read
RAW DATA #4
00000000: 55 8B EC 8B 45 08 50 68 00 00 00 00 E8 00 00 00 U.?E.Ph....?..
00000010: 00 83 C4 08 5D C3 CC CC CC CC CC CC CC CC CC CC ..?]锰烫烫烫烫?
00000020: 55 8B EC 83 EC 08 C7 45 FC 01 00 00 00 A1 00 00 U.??荅?...?.
00000030: 00 00 03 05 00 00 00 00 03 45 FC 03 45 F8 50 E8 .........E?E鳳?
00000040: 00 00 00 00 83 C4 04 8B 45 FC 8B E5 5D C3 .....?.E?錧?
RELOCATIONS #4
Symbol Symbol
Offset Type Applied To Index Name
-------- ---------------- ----------------- -------- ------
00000008 DIR32 00000000 10 $SG6925
0000000D REL32 00000000 D _printf
0000002E DIR32 00000000 11 ?static_var@?1??main@@9@9 (`main'::`2'::static_var)
00000034 DIR32 00000000 14 ?static_var2@?1??main@@9@9 (`main'::`2'::static_var2)
00000040 REL32 00000000 E _func1
SECTION HEADER #5
.bss name
0 physical address
0 virtual address
4 size of raw data
0 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0300080 flags
Uninitialized Data
4 byte align
Read Write
SECTION HEADER #6
.chks64 name
0 physical address
0 virtual address
30 size of raw data
230 file pointer to raw data (00000230 to 0000025F)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
A00 flags
Info
Remove
(no align specified)
RAW DATA #6
00000000: 27 88 7E BB A5 BD F8 78 13 3C FB 1D FA 3A B5 C7 '.~互进x.<??登
00000010: 54 E7 F0 7A A1 2E 3E 48 23 4C C9 8E F0 57 16 F7 T琊z?>H#L?餡.?
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
COFF SYMBOL TABLE
000 01047982 ABS notype Static | @comp.id
001 80010191 ABS notype Static | @feat.00
002 00000002 ABS notype Static | @vol.md
003 00000000 SECT1 notype Static | .drectve
Section length 18, #relocs 0, #linenums 0, checksum 0
005 00000000 SECT2 notype Static | .debug$S
Section length 88, #relocs 0, #linenums 0, checksum 0
007 00000000 SECT3 notype Static | .data
Section length C, #relocs 0, #linenums 0, checksum AC5AB941
009 00000000 SECT3 notype External | _global_init_var
00A 00000004 UNDEF notype External | _global_uninit_var
00B 00000000 SECT4 notype Static | .text$mn
Section length 4E, #relocs 5, #linenums 0, checksum CC61DB94
00D 00000000 UNDEF notype () External | _printf
00E 00000000 SECT4 notype () External | _func1
00F 00000020 SECT4 notype () External | _main
010 00000004 SECT3 notype Static | $SG6925
011 00000008 SECT3 notype Static | ?static_var@?1??main@@9@9 (`main'::`2'::static_var)
012 00000000 SECT5 notype Static | .bss
Section length 4, #relocs 0, #linenums 0, checksum 0
014 00000000 SECT5 notype Static | ?static_var2@?1??main@@9@9 (`main'::`2'::static_var2)
015 00000000 SECT6 notype Static | .chks64
Section length 30, #relocs 0, #linenums 0, checksum 0
String Table Size = 0x5D bytes
Summary
4 .bss
30 .chks64
C .data
88 .debug$S
18 .drectve
4E .text$mn