System.map是一个特定内核的内核符号表。它是你当前运行的内核的System.map的链接。

内核符号表是怎么创建的呢? System.map是由“nm vmlinux”产生并且不相关的符号被滤出。对于本文中的例子,编译内核时,System.map创建在/usr/src/linux-2.4/System.map。像下面这样:

nm /boot/vmlinux-2.4.7-10 > System.map

下面几行来自/usr/src/linux-2.4/Makefile:

nm vmlinux | grep -v ‘(compiled)|(.o$$)|( [aUw] )|(..ng$$)|(LASH[RL]DI)’ | sort > System.map

然后复制到/boot:

cp /usr/src/linux/System.map /boot/System.map-2.4.7-10

在进行程序设计时,会命名一些变量名或函数名之类的符号。Linux内核是一个很复杂的代码块,有许许多多的全局符号。

Linux内核不使用符号名,而是通过变量或函数的地址来识别变量或函数名。比如不是使用size_t BytesRead这样的符号,而是像c0343f20这样引用这个变量。

对于使用计算机的人来说,更喜欢使用那些像size_t BytesRead这样的名字,而不喜欢像c0343f20这样的名字。内核主要是用c写的,所以编译器/连接器允许我们编码时使用符号名,当内核运行时使用地址。

然而,在有的情况下,我们需要知道符号的地址,或者需要知道地址对应的符号。这由符号表来完成,符号表是所有符号连同它们的地址的列表。Linux 符号表使用到2个文件:

/proc/ksyms

System.map

/proc/ksyms是一个“proc file”,在内核引导时创建。实际上,它并不真正的是一个文件,它只不过是内核数据的表示,却给人们是一个磁盘文件的假象,这从它的文件大小是0可以看 出来。然而,System.map是存在于你的文件系统上的实际文件。当你编译一个新内核时,各个符号名的地址要发生变化,你的老的System.map 具有的是错误的符号信息。每次内核编译时产生一个新的System.map,你应当用新的System.map来取代老的System.map。

虽然内核本身并不真正使用System.map,但其它程序比如klogd, lsof和ps等软件需要一个正确的System.map。如果你使用错误的或没有System.map,klogd的输出将是不可靠的,这对于排除程序 故障会带来困难。没有System.map,你可能会面临一些令人烦恼的提示信息。

另外少数驱动需要System.map来解析符号,没有为你当前运行的特定内核创建的System.map它们就不能正常工作。

Linux的内核日志守护进程klogd为了执行名称-地址解析,klogd需要使用System.map。System.map应当放在使用它的 软 件能够找到它的地方。执行:man klogd可知,如果没有将System.map作为一个变量的位置给klogd,那么它将按照下面的顺序,在三个地方查找System.map:

/boot/System.map

/System.map

/usr/src/linux/System.map

System.map也有版本信息,klogd能够智能地查找正确的映象(map)文件。

System.map内部符号定义:

这些代表符号类型. 小写代表本地符号,大写代表外部符号.


The symbol's value is absolute, and will not be changed by further linking.


The symbol is in the uninitialized data section (known as BSS).


The symbol is common. Common symbols are uninitialized data. When linking, multiple common symbols may appear with the same name. If the symbol is defined anywhere, the common symbols are treated as undefined references. For more details on common symbols, see the discussion of -warn-common in Linker options.


The symbol is in the initialized data section.


The symbol is in an initialized data section for small objects. Some object file formats permit more efficient access to small data objects, such as a global int variable as opposed to a large global array.


The symbol is an indirect reference to another symbol. This is a GNU extension to the a.out object file format which is rarely used.


The symbol is a debugging symbol.


The symbol is in a read only data section.


The symbol is in an uninitialized data section for small objects.


The symbol is in the text (code) section.


The symbol is undefined.


The symbol is a weak object. When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error. When a weak undefined symbol is linked and the symbol is not defined, the value of the weak symbol becomes zero with no error.


The symbol is a weak symbol that has not been specifically tagged as a weak object symbol. When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error. When a weak undefined symbol is linked and the symbol is not defined, the value of the weak symbol becomes zero with no error.


The symbol is a stabs symbol in an a.out object file. In this case, the next values printed are the stabs other field, the stabs desc field, and the stab type. Stabs symbols are used to hold debugging information. For more information, see Stabs.


The symbol type is unknown, or object file format specific.

 转自:http://blog.chinaunix.net/uid-17188120-id-2820834.html
 
用nm查看详细信息。

System.map的更多相关文章

  1. System.map文件【转】

    转自:http://blog.csdn.net/david104/article/details/7194185 当运行GNU链接器gld(ld)时若使用了"-M"选项,或者使用n ...

  2. auto make System.map to C header file

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

  3. System.map详解

    system.map内容格式为:线性地址类型符号 具体内容如下: 00100000 A phys_startup_32 c0100000 T startup_32 c0100000 A _text   ...

  4. System.map文件的作用

    有关System.map文件的信息好象很缺乏.其实它一点也不神秘,并且在整个事情当中它并不象看上去那么得重要.但是由于缺乏必要的文档说明,使其显得比较神秘.它就象耳垂,我们每个人都有,但却不知道是干什 ...

  5. 内核编译之vmlinuz vmlinux system.map initrd

    一.vmlinuz  vmlinuz是可引导的.压缩的内核.“vm”代表“Virtual Memory”.Linux 支持虚拟内存,不像老的操作系统比如DOS有640KB内存的限制.Linux能够使用 ...

  6. System.map文件的作用解析

    有关System.map文件的信息好象很缺乏.其实它一点也不神秘,并且在整个事情当中它并不象看上去那么得重要.但是由于缺乏必要的文档说明,使其显得比较神秘.它就象耳垂,我们每个人都有,但却不知道是干什 ...

  7. Linux System.map文件【转】

    转自:http://blog.csdn.net/ysbj123/article/details/51233618 当运行GNU链接器gld(ld)时若使用了"-M"选项,或者使用n ...

  8. nyoj 991 Registration system (map)

    Registration system 时间限制:1000 ms  |  内存限制:65535 KB 难度:2   描述 A new e-mail service "Berlandesk&q ...

  9. Operating System Memory Management、Page Fault Exception、Cache Replacement Strategy Learning、LRU Algorithm

    目录 . 引言 . 页表 . 结构化内存管理 . 物理内存的管理 . SLAB分配器 . 处理器高速缓存和TLB控制 . 内存管理的概念 . 内存覆盖与内存交换 . 内存连续分配管理方式 . 内存非连 ...

随机推荐

  1. CoreData数据库升级

    如果IOS App 使用到CoreData,并且在上一个版本上有数据库更新(新增表.字段等操作),那在覆盖安装程序时就要进行CoreData数据库的迁移,具体操作如下: 1.选中你的mydata.xc ...

  2. 马老师 Linux基础入门

    总线(Bus)是计算机各种功能部件之间传送信息的公共通信干线,它是由导线组成的传输线束, 按照计算机所传输的信息种类,计算机的总线可以划分为数据总线.地址总线和控制总线,分别用来传输数据.数据地址和控 ...

  3. Java反射机制--笔记

    1.认识Class类 任何一个类都是Class类的实例对象,这个实例对象有三种表示方式. /*java 反射机制*/ // 获取类的方法 UserDao userDao = new UserDao() ...

  4. PL SQL基本内容(原创)

    本节介绍PL SQL的基本内容 本节所举示例数据来源oracle用户scott下的emp表和dept表,数据如下: 一.plsql简介: 1.概念:procedural language,过程化sql ...

  5. bash 基本功能

    1 shell概述 shell是一个命令解释器,为用户提供了一个向Linux内核发送请求以便运行程序的界面系统级程序.用户可以用shell启动.挂起.停止甚至是编写一些程序. shell是一个功能强大 ...

  6. 转 ShowSlow+Yslow页面前端性能测试环境搭建

    ----//工具介绍 Yslow:YSlow是Yahoo发布的一款基于FireFox的插件. YSlow可以对网站的页面进行分析,并告诉你为了提高网站性能,如何基于某些规则而进行优化. ShowSlo ...

  7. Yii2 mongodb 扩展的where的条件加入大于小于号浅析(转)

    1. mongodb的where中有比较丰富的 条件,如下: static $builders = [ 'NOT' => 'buildNotCondition', 'AND' => 'bu ...

  8. Logstash怎么导入csv

    Logstash.Conf input { file { type => "SSRCode" path => "E:/FTPRootWorkSpace/SD/ ...

  9. 安装ELK

    1. 安装Elasticsearch a. 下载 : https://download.elasticsearch.org/elasticsearch/release/org/elasticsearc ...

  10. regAsm的历史问题

    regAsm是用来注冊.卸载dll成为通用库的一个工具.关于regAsm的具体资料请參照http://msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.11 ...