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. mybatis&Hibernate区别

    mybatis是一个不完全的orm框架,因为mybatis需要程序员自己写大量的sql,需要程序员对sql的掌握比较高,不过mybatis可以通过xml文件可以灵活的配置要运行的sql语句,将sql与 ...

  2. java 快速求素数

    package test ; import java.util.Scanner ; public class hello { public static void main(String [] arg ...

  3. Foundations of Machine Learning: The PAC Learning Framework(2)

    Foundations of Machine Learning: The PAC Learning Framework(2) (一)假设集有限在一致性下的学习界. 在上一篇文章中我们介绍了PAC-le ...

  4. 配置Eclipse 3.3 + tomcat 6.0 + lomboz 3.3进行Web开发

    http://www.cnblogs.com/xtsong/articles/1203155.html我以前编程用的都是Eclipse 3.2,这次跑到www.eclipse.org上去溜达了一番,发 ...

  5. Android学习系列(2)--App自动更新之通知栏下载

    这篇文章是Android开发人员的必备知识,是我特别为大家整理和总结的,不求完美,但是有用.1.设计思路,使用VersionCode定义为版本升级参数. android为我们定义版本提供了2个属性:& ...

  6. 配置Windows server 2008文件同步[转]

    众所周知,Linux系统可以用rsync来实现文件或目录的同步,windows系统下也一样可以.我们现在就用cwRsync来实现windows server 2008系统下的文件同步. 一.系统环境 ...

  7. 【js】sort()

    //为了实现排序,sort()方法会调用每个数组项的toString()转型方法,然后比较得到的字符串, //以确定如何排序.即使数组中的每一项都是数值,sort()方法比较的也是字符串, var v ...

  8. 信号的捕捉与sigaction函数

    一.内核如何实现信号的捕捉 如果信号的处理动作是用户自定义函数,在信号递达时就调用这个函数,这称为捕捉信号.由于信号处理函数的代码是在用户空间的,处理过程比较复杂,举例如下: 1. 用户程序注册了SI ...

  9. GM11灰色模型

    作者:桂. 时间:2017-08-12  08:34:06 链接:http://www.cnblogs.com/xingshansi/p/7348714.html 前言 灰色模型(Gray model ...

  10. Socket tips: 同意socket发送UDP Broadcast

    假设创建一个UDP Socket: socketHandle = socket(serverAddr->ai_family, serverAddr->ai_socktype, server ...