Linux system.map file "Go"

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/ysbj123/article/details/51233618

When you run the GNU Linker GLD (LD) with the "-M" option, or use the NM command, the linked image (link map) information is printed on the standard output device (usually the screen), which is the target program memory address image information generated by the linker. It lists location information that is loaded into memory by the program segment. Specifically, the following information is available:

The destination file and symbol information are mapped to a location in memory.

How public symbols are placed.

The link contains all the file members and their referenced symbols.

Usually we redirect the link image information sent to the standard output device to a file (for example, System.map). When compiling the kernel, the System.map file generated by the Linux/makefile file is used to hold the kernel symbol table information. The symbol table is a list of all kernel symbols and their corresponding addresses, including, of course, the address information for symbols such as _etext, _edata, and _end, as described above. With each kernel compilation, a new corresponding System.map file is generated. When the kernel runs out of error, by parsing the symbol table in the System.map file, you can find the variable name corresponding to the address value, or vice versa.

Using the System.map symbol table file, you can obtain information that is more easily identifiable when the kernel or related programs go wrong. The sample symbol table is as follows:

c03441a0 b dmi_brokenc03441a4 b is_sony_vaio_laptopc03441c0 b dmi_identc0344200 b pci_bios_presentc0344204 b pirq_table

Each line describes a symbol, the 1th column indicates the symbol value (address), the 2nd column is the symbol type, which indicates which area of the target file (sections) or its attribute is located, and the 3rd column is the corresponding symbol name.

The symbol type indicators in column 2nd are usually shown in table 3-5 and some are related to the target file format used. If the symbol type is lowercase, the symbol is local, and if it is a uppercase character, the symbol is global (external). See the definition of nlist{} structure n_type field in file Include/a.out.h (line 110th to 185th).

Table 3-5 symbol types in the target file symbol list file

Symbol type

Name

Description

A

Absolute

The value of the symbol is absolute and will not be changed during further linking

B

Bss

The symbol is in the uninitialized data area or region (section), that is, in the BSS segment

C

Common

The symbols are public. The public symbol is uninitialized data. Multiple public symbols may have the same name at the time of the link. If the symbol is defined elsewhere, the public symbol is considered an undefined reference

D

Data

The symbol is in the initialized data area

G

Global

A symbol is a symbol in a small object that has an initialized data area. The format of some target files allows for more efficient access to small data objects, such as a global integer variable

I

Inderect

A symbol is an indirect reference to another symbol

N

Debugging

Symbol is a debug symbol

R

Read only

Symbol in a read-only data area

S

Small

Symbol is a symbol in the uninitialized data area of a small object

T

Text

Symbol is a symbol in the code area

U

Undefined

The symbol is external and has a value of 0 (undefined)

-

Stabs

The symbol is a stab symbol in the a.out destination file that holds the debug information

?

Unknown

The type of the symbol is unknown or is related to a specific file format

You can see that a variable named Dmi_broken is located at the kernel address 0xc03441a0.

System.map is located where the software that uses it (such as the kernel Logging daemon klogd) can find. If the KLOGD is not given a system.map position in the form of a parameter when the system starts, KLOGD will search for System.map in three places. In turn:

/boot/system.map/system.map/usr/src/linux/system.map

Although the kernel itself does not actually use SYSTEM.MAP, many other programs, such as KLOGD, Lsof, PS, and Dosemu, need to have a correct system.map file. Using this file, these programs can find out the corresponding kernel variable name according to the known memory address, which facilitates the debugging of the kernel.

Linux system.map file "Go"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.