• 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.
 
Structure
  • Archive member included to satisfy reference by file (symbol)
  • Allocating common symbols
  • Memory Configuration
  • Linker script and memory map
  • Cross Reference Table
 
Archive files
  • 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 structureserror 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.
 
Allocating common symbols
  • 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.
Memory Configuration 
  • The next section show the memory configuration.
  • This should be the same as in the Linker Command File.
 
Linker script and memory map
  • 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.
Cross Reference Table
  • 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的更多相关文章

  1. 对Link Map File的初步认识

    什么是Link Map File Link Map File中文直译为链接映射文件,它是在Xcode生成可执行文件的同时生成的链接信息文件,用于描述可执行文件的构造部分,包括了代码段和数据段的分布情况 ...

  2. make&&gcc/g++ 生成 map file

    map file 对于嵌入式开发是非常有用的,尤其是当你开发的module引起了 kernel panic 的时候. 仅写作Mark用 make: $vim makefile (add  " ...

  3. DNS map file in windows

    Edit "C:\WINDOWS\system32\drivers\etc\hosts", add the IP to DNS name mapping.

  4. auto make System.map to C header file

    #!/bin/bash # auto make System.map to C header file # 说明: # 该脚本主要是将Linux内核生成的System.map文件中的符号.地址存入结构 ...

  5. Python解析器源码加密系列之(二):一次使用标准c的FILE*访问内存块的尝试

    摘要:由于近期打算修改Python解释器以实现pyc文件的加密/解密,出于保密的要求,解密之后的数据只能放在内存中,不能写入到文件中.但是后续的解析pyc文件的代码又只能接受FILE*作为入参,所以就 ...

  6. JAVA实现File类中的遍历操作并输出内容

    package shb.java.testIo; import java.io.BufferedReader; import java.io.BufferedWriter; import java.i ...

  7. Delphi通过Map文件查找内存地址出错代码所在行

    一 什么是MAP文件 什么是 MAP 文件?简单地讲, MAP 文件是程序的全局符号.源文件和代码行号信息的唯一的文本表示方法,它可以在任何地方.任何时候使用,不需要有额外的程序进行支持.而且,这是唯 ...

  8. VS2005(vs2008,vs2010)使用map文件查找程序崩溃原因

    VS 2005使用map文件查找程序崩溃原因 一般程序崩溃可以通过debug,找到程序在那一行代码崩溃了,最近编一个多线程的程序,都不知道在那发生错误,多线程并发,又不好单行调试,终于找到一个比较好的 ...

  9. 问题-[Delphi]通过Map文件查找内存地址出错代码所在行

     一 什么是MAP文件       什么是 MAP 文件?简单地讲, MAP 文件是程序的全局符号.源文件和代码行号信息的唯一的文本表示方法,它可以在任何地方.任何时候使用,不需要有额外的程序进行支持 ...

随机推荐

  1. Toggle Slow Animations

    Toggle Slow Animations iOS Simulator has a feature that slows animations, you can toggle it either b ...

  2. docker ,docker与虚拟机的区别

    什么是Docker: 1.Docker 是一个开源项目,诞生于 2013 年初,最初是 dotCloud 公司内部的一个业余项目.它基于 Google 公司推出的 Go 语言实现. 项目后来加入了 L ...

  3. Spring Boot 框架的依赖管理

    Spring Boot为完成不同需求的Spring应用构建,提供了多种不同的依赖管理模板,每种模板均为一系列已完成的依赖的管理.例如在我们的入门程序中,需要构建web项目,我们只需添加spring-b ...

  4. JavaScript权威指南--数组Array

    什么是数组 数组是值的有序集合.每一个值叫做元素,每一个元素在数组中有一个位置,用数字表示,称为索引.js数组是无类型的.动态的,也可能是稀疏的.每个数组都有length属性.数组最大能容纳42949 ...

  5. HDU 6181:Two Paths(次短路)

    Two Paths Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 153428/153428 K (Java/Others) Total S ...

  6. jQuery登录界面的文本框焦点代码

    <script type="text/javascript"> $(function(){ $("#address").focus(function ...

  7. 简述rpm与yum命令的常见选项

    rpm是一个功能十分强大的软件包管理系统,它使得在Linux下安装.升级和删除软件包的工作变的容易.并且具有查询.验证软件包的功能. 1)安装选项 命令格式:rpm {-i|--install} [i ...

  8. linux安装mysql后root无法登录 sql 无法登录

    linux安装mysql后root无法登录 问题:[root@localhost mysql]# mysql -u root -pEnter password: ERROR 1045 (28000): ...

  9. 汇编实验2(又是作业emm)

    实验任务:学会使用debug 1.使用Debug,将程序段写入内存: 首先对0021:0000~0021:000F的内存赋值 这里我赋的值是 11 12 13 14 15 16 17 18 输入mov ...

  10. EBS 新建消息并且通过fnd_message提示

    前台 定义消息  系统管理员->系统管理->消息        文本中可使用 &变量名 指定变量 代码调用方式:     fnd_message.set_name('CUX', ' ...