MAP File
- A MAP file is an output of the Linker.
- gives information about the symbols, addresses, allocated memory in the generated ELF file.
- It is extremely useful when trying to understand and debug linker issues related to code size.
- Archive member included to satisfy reference by file (symbol)
- Allocating common symbols
- Memory Configuration
- Linker script and memory map
- Cross Reference Table
- An archive file is a file that is composed of one or more computer files along with metadata.
- Archive files are used to collect multiple data files together into a single file for easier portability and storage, or simply to compress files to use less storage space.
- Archive files often store directory structures, error detection and correction information, arbitrary comments, and sometimes use built-in encryption.
- This section details all of the members included from the various archive files in the system. This information is not especially useful, but lets you see all the system functions.
- This section shows the names and sizes of global symbols (ie global variables) that have been allocated in the program.
- This is a good place to check that all global variables have expected sizes.
- A common mistake can be to unknowingly allocate a large global variable that consumes a lot of memory space.
- The next section show the memory configuration.
- This should be the same as in the Linker Command File.
- START GROUP & ENDGROUP
- --start-group archives --end-group
- The specified archives are searched repeatedly until no new undefined references are created. Normally, an archive is searched only once in the order that it is specified on the command line.
- If a symbol in that archive is needed to resolve an undefined symbol referred to by an object in an archive that appears later on the command line, the linker would not be able to resolve that reference.
- By grouping the archives, they all be searched repeatedly until all possible references are resolved.
- Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives.
- Gives a wealth of information about where everything is mapped in the program.
- Each top level section, such as .text or .heap has both the starting address in the memory map as well as the size (in bytes) listed.
- Then each section is broken down into the individual object files and both the starting address and size is listed.
- Finally, each object file is broken down into the individual functions within the object file and the starting address for each function is listed.
- This allows you to understand which object files might contain large functions which are not necessary for your program execution.
- It can also give context when looking at pointer addresses within the program.
- MAP files are a great source of information when debugging your program.
- NOTE:
- .text This section contains only executable instructions.
- .sdata This section holds initialized short data that contribute to the program memory image.
- .sbss This section holds uninitialized short data that contribute to the program memory image. By definition, the system initializes the data with zeros when the program begins to run.
- .lit4 This section holds 4 byte read-only literals that contribute to the program memory image. Its purpose is to provide a list of unique 4-byte literals used by a program. Although this section has the SHF_WRITE attribute, it is not expected to be written. Placing this section in the data segment mandates the SHF_WRITE attribute.
- .lit8 This section holds 8 byte read-only literals that contribute to the program memory image. Its purpose is to provide a list of unique 8-byte literals used by a program. Although this section has the SHF_WRITE attribute, it is not expected to be written. Placing this section in the data segment mandates the SHF_WRITE attribute.
- .reginfo This section provides information on the program register usage to the system.
- .liblist This section contains information on each of the libraries used at static link.
- .conflict This section provides additional dynamic linking information about symbols in an executable file that conflict with symbols defined in the dynamic shared libraries with which the file is linked.
- .gptab This section contains a global pointer table. The global pointer table is described in "Global Data Area" in this chapter. The section is named .gptab.sbss,.gptab.sdata, gptab.bss,or .gptab.data depending on which data section the particular .gptab refers.
- .ucode This section name is reserved and the contents of this type of section are unspecified. The section contents can be ignored
- .comment This section holds version control information.
- .debug This section holds information for symbolic debugging. The contents are unspecified. All section names with the prefix .debug are reserved for future use.
- Function
- LOADADDR(section)
- Return the absolute LMA of the named section. This is normally the same as ADDR, but it may be different if the AT attribute is used in the output section definition
- ASSERT(exp, message)
- Ensure that exp is non-zero. If it is zero, then exit the linker with an error
- code, and print message.
- LOADADDR(section)
- The format of the table is intentionally simple, so that it may be easily processed by a script if necessary.
- The symbols are printed out, sorted by name. For each symbol, a list of file names is given. If the symbol is defined, the first file listed is the location of the definition. The remaining files contain references to the symbol.
- all symbol in this table, seems no use for us.
MAP File的更多相关文章
- 对Link Map File的初步认识
什么是Link Map File Link Map File中文直译为链接映射文件,它是在Xcode生成可执行文件的同时生成的链接信息文件,用于描述可执行文件的构造部分,包括了代码段和数据段的分布情况 ...
- make&&gcc/g++ 生成 map file
map file 对于嵌入式开发是非常有用的,尤其是当你开发的module引起了 kernel panic 的时候. 仅写作Mark用 make: $vim makefile (add " ...
- DNS map file in windows
Edit "C:\WINDOWS\system32\drivers\etc\hosts", add the IP to DNS name mapping.
- auto make System.map to C header file
#!/bin/bash # auto make System.map to C header file # 说明: # 该脚本主要是将Linux内核生成的System.map文件中的符号.地址存入结构 ...
- Python解析器源码加密系列之(二):一次使用标准c的FILE*访问内存块的尝试
摘要:由于近期打算修改Python解释器以实现pyc文件的加密/解密,出于保密的要求,解密之后的数据只能放在内存中,不能写入到文件中.但是后续的解析pyc文件的代码又只能接受FILE*作为入参,所以就 ...
- JAVA实现File类中的遍历操作并输出内容
package shb.java.testIo; import java.io.BufferedReader; import java.io.BufferedWriter; import java.i ...
- Delphi通过Map文件查找内存地址出错代码所在行
一 什么是MAP文件 什么是 MAP 文件?简单地讲, MAP 文件是程序的全局符号.源文件和代码行号信息的唯一的文本表示方法,它可以在任何地方.任何时候使用,不需要有额外的程序进行支持.而且,这是唯 ...
- VS2005(vs2008,vs2010)使用map文件查找程序崩溃原因
VS 2005使用map文件查找程序崩溃原因 一般程序崩溃可以通过debug,找到程序在那一行代码崩溃了,最近编一个多线程的程序,都不知道在那发生错误,多线程并发,又不好单行调试,终于找到一个比较好的 ...
- 问题-[Delphi]通过Map文件查找内存地址出错代码所在行
一 什么是MAP文件 什么是 MAP 文件?简单地讲, MAP 文件是程序的全局符号.源文件和代码行号信息的唯一的文本表示方法,它可以在任何地方.任何时候使用,不需要有额外的程序进行支持 ...
随机推荐
- Linux 驱动——Button驱动3(poll机制)
button_drv.c驱动文件: #include <linux/module.h>#include <linux/kernel.h>#include <linux/f ...
- java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
1.异常表现:我在jsp文件中有一个<form>表单,里面有一个<button>保存事件按钮.<button onclick="addOrUPdate()&q ...
- Go Lang
IDE: https://www.jetbrains.com/products.html?fromMenu#type=ide Study: http://www.runoob.com/go/go-en ...
- [转载]JS中 map, filter, some, every, forEach, for in, for of 用法总结
转载地址:http://codebay.cn/post/2110.html 1.map 有返回值,返回一个新的数组,每个元素为调用func的结果. let list = [1, 2, 3, 4, 5] ...
- MTK平台-抓取蓝牙log
一.MTKLOG抓取 .在拔号键盘输入暗码 *#*##*#* 进入工模EngineerMode .在 Log and Debugging -> MTKLogger 点击开始 .MTKLog存储路 ...
- 固态硬盘Ghost安装Windows 10无法引导的问题
机器配置如下: 电脑型号 技嘉 B360M POWER 台式电脑 操作系统 Windows 10 64位 ( DirectX 12 ) 处理器 英特尔 Core i7-8700 @ 3.20GHz 六 ...
- 《HTTP权威指南》读书笔记(二) :URL与资源
1.URL是什么 URL就是因特网资源的标准化名称.URL指向一条电子信息片段,告诉你它们位于何处,以及如何与之交互.通俗来说,就是浏览器寻找信息所需的资源位置. URI是一类更通用的资源标识符,UR ...
- Codeforces 977E:Cyclic Components(并查集)
题意 给出nnn个顶点和mmm条边,求这个图中环的个数 思路 利用并查集的性质,环上的顶点都在同一个集合中 在输入的时候记录下来每个顶点的度数,查找两个点相连,且度数均为222的点,如果这两个点的父节 ...
- nginx uwsgi django 配置
用django框架,uwsgi服务器作为动态服务器,nginx作为静态资源服务器 配置uWSGI,在项目目录下创建uwsgi.ini文件: [uwsgi] #使用nginx连接时使用 socket=1 ...
- 找出n之内的完全数, 并输出其因子
定义: 完全数:所有的真因子(即除了自身以外的约数)的和,恰好等于它本身.例如:第一个完全数是6,它有约数1.2.3.6,除去它本身6外,其余3个数相加,1+2+3=6.第二个完全数是28,它有约数1 ...