当前位置:网站首页>[compilation and assembly link] coff file and structure description
[compilation and assembly link] coff file and structure description
2022-06-13 05:54:00 【Python's path to becoming a God】
If you don't know how to program feasible files before reading this article, you can take a look at my article :
【 Compile assembly link 】C++ Code file to executable process
It only takes one or two eyes to roar ~~
List of articles
COFF The document states
coff The file is essentially the file generated by the code in the compilation stage .
- stay windows On the system , To be exact, use visual studio Generation time , Will produce obj file , It is generally stored in the same level of code
Release or DebugUnder the table of contents ; - stay linux Upper use gcc When compiling , The generated is out file .
So let's take a look at COFF The official definition of the document :
COFF—— Common object file format (Common Object File Format), Is a very popular object file format ( Be careful : It is not said here that it is “ The goal is ” file , It is for and the target file generated by the compiler (.o/.obj) To distinguish , Because this format is not only used for target files , The library files 、 Executable files are often in this format ). Use vs The generated object file (*.obj) This is the format . Other compilers , Such as GCC(GNU Compiler Collection)、ICL(Intel C/C++ Compiler)、VectorC, Target files in this format are also used . not only C/C++, Many other languages also use object files in this format
The object file of unified format brings great convenience to mixed language programming .
Of course , This is not the only object file format . Other common formats are
OMF- Object model file(Object Module File) as well as ELF- Executable and connection file format (Executable and Linking Format).OMF It's a large group IT Giant in n A format developed in , stay Windows Very common on the platform . What everyone likes Borland The target file used by the company now is in this format .MS and Intel stay n The same format was used years ago , Now they all switch to the opposite side , use COFF Format .ELF Format in non - Windows Used more on the platform , stay Windows I haven't seen the platform .
COFF File structure
COFF There is a total of 8 Species data , As shown in the following table , The paragraph header and paragraph data can have multiple sections . By default ,COFF File contains 3 Segments :.text: Usually contains executable code ;.data: Usually contains initialized data ;.bss: Usually reserve space for uninitialized data .
among , The file header ~ The line number entry table is closely related to the loading file .
| COFF File structure | explain | describe | Example |
|---|---|---|---|
| File header | The file header | For preservation COFF Basic information of the document , Such as document identification , The position of each table, etc , As shown on the right | ![]() |
| Optional Header | Optional head | Similar to header , It's also used to save information , It mainly saves the information not described in the file header . | |
| Section Header | Paragraph header | Used to describe paragraph information , Each paragraph has a paragraph header to describe , The number of paragraphs will be indicated in the header . | ![]() |
| Section Header n | |||
| Section Data | Paragraph data | Paragraph data is usually COFF The largest data segment in the file , The real data of each paragraph is saved in this location , You can see the relevant information in the description at the beginning of the paragraph . | ![]() |
| Relocation Directives | Relocation table | This table usually exists only in the target file , He used to describe COFF Relocation information of symbols in the file . | |
| Line Numbers | Line number table | ||
| Symbol Table | The symbol table | For preservation COFF Information of all symbols used in the file , Link multiple COFF When you file , This table helps us reposition symbols . It is also used when debugging programs . | About Windows COFF Understanding of symbol table - Orange cub - Blog Garden |
| String Table | String table | Save string . Used to save some strings whose number of characters exceeds the maximum number of name arrays in the symbol table and de segment header . |
In this paper, the reference
- coff File analysis _zzljn The column _coff File parsing
- Miao Jun , Ni Qizhi , MIAOJun, etc. . COFF Implementation and application of file analysis extractor [J]. Modern electronic technology , 2009, 32(2):4.
- COFF File format _redleaves The column _coff
Thank you for sharing your knowledge , A good man must be rewarded !!!
边栏推荐
- Misunderstanding of tongweb due to ease of use
- OpenGL馬賽克(八)
- Concurrent programming -- what is threading?
- How MySQL optimizes the use of joint index ABC
- MySQL performs an inner join on query. The query result is incorrect because the associated fields have different field types.
- 18 flowable task manualtask and receivetask
- About the solution of pychart that cannot be opened by double clicking
- The SQL file of mysql8.0 was imported into version 5.5. There was a pit
- Leetcode- minimum number of operations to make array elements equal - simple
- Byte buddy print execution time and method link tracking
猜你喜欢

What happens when the MySQL union index ABC encounters a "comparison operator"?

arrayList && linkedList

One of PowerShell optimizations: prompt beautification

Mongodb multi field aggregation group by
![[China & some provinces and cities] JSON file for offline map visualization](/img/ea/0c552e1e133f693b9902c54c2e09c8.jpg)
[China & some provinces and cities] JSON file for offline map visualization

C calls the API and parses the returned JSON string

Config server configuration center of Nacos series

2 first experience of drools

Misunderstanding of tongweb due to ease of use

The reason why the process cannot be shut down after a spark job is executed and the solution
随机推荐
Mongodb multi field aggregation group by
Concurrent programming -- what is threading?
ffmpeg 下载后缀为.m3u8的视频文件
Leetcode- reverse vowels in string - simple
About the solution of pychart that cannot be opened by double clicking
16 the usertask of a flowable task includes task assignment, multi person countersignature, and dynamic forms
AUTOSAR实战教程pdf版
Sentinel series introduction to service flow restriction
Basic application of sentinel series
软件测试——接口常见问题汇总
9. Errorstartevent and errorboundaryevent of error events
Leetcode- minimum number of operations to make array elements equal - simple
Leetcode- keyboard line - simple
Top slide immersive dialog
2020 personal annual summary
MySQL installation in Linux Environment
MongoDB 多字段聚合Group by
No assessment summary
NVIDIA Jetson Nano/Xavier NX 扩容教程
Randomly fetch data from the list

![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-DgC9rEzc-1645848852703)(Untitled/image-20220226114915546.png)]](/img/c3/016cd1ec9f12f546fca56cf9275843.jpg)
