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 文件是程序的全局符号.源文件和代码行号信息的唯一的文本表示方法,它可以在任何地方.任何时候使用,不需要有额外的程序进行支持 ...
随机推荐
- TowSum
- php 浏览记录功能
/** * 历史浏览记录 * $data array 浏览记录里作品的必要信息 */ private function _history($data){ if(!$data || !is_array( ...
- 12_jvm性能优化专题1——top命令和jstack联合定位
一:异常项目构建 1.通过while死循环构造异常常见: package com.huawei.jvm; import org.springframework.stereotype.Controlle ...
- git教程:版本退回
转载:版本回退 现在,你已经学会了修改文件,然后把修改提交到Git版本库,现在,再练习一次,修改readme.txt文件如下: Git is a distributed version control ...
- laravel 错误提示Fatal Error: Class 'Pheanstalk\Pheanstalk' not found
本地环境版本: composer -V Composer version -- ::10 php artisan -V Laravel Framework 5.6.39 错误提示: Fatal Err ...
- 《Java编程思想》读书笔记-赋值操作符
在最底层,Java中的数据是通过使用操作符来操作的.接下来我们逐一认识一些操作符. 怎么运用操作符 操作符接受一个或多个参数,并生成一个新值. 基本操作符 赋值操作符 符号:= 作用:取右边的值,把它 ...
- 前端工程化基础-vue
由浅入深支持更多功能 1.安装最新版本的node.js和NPM,并了解NPM基本用法. 2.创建一个目录demo.使用npm 初始化配置: npm init ,执行后会有一系列选项,可按回车快速确认 ...
- Spring Boot程序的执行流程
Spring Boot的执行流程如下图所示:(图片来源于网络) 上图为SpringBoot启动结构图,我们发现启动流程主要分为三个部分,第一部分进行SpringApplication的初始化模块,配置 ...
- 计算机原码、补码、反码与java移位运算符(<</>>/>>>)
一.机器值和真值 1.机器值 一个数在计算机中的二进制表示形式, 叫做这个数的机器数.机器数是带符号的,在计算机用一个数的最高位存放符号, 正数为0, 负数为1. 比如,十进制中的数 +3 ,计算机 ...
- C++中的基础特性:封装,继承,多态
抽象: 要将现实中的一个具体事务,变成C++中的一个类,例如将现实中的汽车变成代码中的car类.完成这个过程就需要 抽象 这一基本手段. 抽象是指 对具体问题(对象)进行分析概括,找出该类对象的公共性 ...