Ø
Readelf
Readelf
Available for display
Elf
Format of executable file information. For example
Readelf
View
Hello. o
In
Section
The result is as follows:
$ Readelf-s hello. o There are 15 section headers, starting at offset 0x228:
Section headers: [Nr] Name Type ADDR Off Size Es flg lk inf al
[0] Null 00000000 000000 000000 00 0 0 0
[1]. Text Progbits 00000000 000034 running AE 00 Ax 0 0 4
[2]. Rel. Text REL 00000000 000754 000060 08 13 1 4
[3]. Data Progbits 00000000 running E4 000000 00 Wa 0 0 4
[4]. BSS Nobits 00000000 running E4 000001 00 Wa 0 0 4
[5]. rodata Progbits 00000000 10000e4 00000d 00 A 0 0 1
[6]. ctors Progbits 00000000 usdf4 000004 00 Wa 0 0 4
[7]. Rel. ctors REL 00000000 0007b4 000008 08 13 6 4
[8]. eh_frame Progbits 00000000 running F8 000090 00 A 0 0 4
[9]. Rel. eh_frame REL 00000000 0007bc 000028 08 13 8 4
[10]. Note. GNU-Stack Note 00000000 000188 000000 00 0 0 1
[11]. Comment Progbits 00000000 000188 000034 00 0 0 1
[12]. shstrtab Strtab 00000000 0001bc 00006a 00 0 0 1
[13]. symtab Symtab 00000000 000480 000180 10 14 E 4
[14]. strtab Strtab
00000000 000600 000153 00 0 0 1
Key to flags: W (write), A (alloc), x (execute), m (merge), S (strings)
I (Info), L (link order), g (group), x (unknown)
O (extra OS processing required) O (OS specific), P (processor specific)
|
Ø
Size
Size
Command to list the size of each segment of the target file and the total size. By default, only one output line is generated for each module in each target file or archive file.
Size
Can be used for simple and quick understanding
Elf
File segments, such:
$ Size hello. o Text Data BSS Dec Hex filename
331 4 1 336 150 hello. o
|
Ø
Objcopy
Objcopy
It is used to copy the content of one target file to another type of target file. It is generally used to copy or replace certain segments in the target file, or remove some segments.
Ø
Strings
Strings
Prints printable strings of a file. These strings are the least
4
Characters long, you can also use the option
-N
Set the minimum length of a string. By default, it only prints printable characters in the initialization and loading segments of the target file. For other types of files, it prints printable characters of the entire file, this program is very helpful for understanding the content of non-text files.
Ø
Strip
Strip
: Discard all or specific symbols in the target file, which can be used to reduce the size of executable files and libraries. For more information, see the storage optimization section in the next chapter.
Ø
Addr2line
Addr2line
: Convert the program address to the file name and row number. In the command line, give it an address and an executable file name, and it will use the debugging information of this executable file to indicate which file is on the given address and the row number. For more information, see
Core Dump
Analysis (
9.5
Section), how to use registers
PC
And
Addr2line
Tool to find the error
C/C ++
Source code.
Ø
LDD
LDD
Displays the shared libraries required for execution files.
,
Where does the shared library load manager find the desired shared library. For example:
# LDD hello Libstdc ++. so.5 =>/usr/lib/libstdc ++. so.5 (0x40026000)
Libm. so.6 =>/lib/tls/libm. so.6 (0x400d9000)
Libgcc_s.so.1 =>/lib/libgcc_s.so.1 (0x400fb000)
Libc. so.6 =>/lib/tls/libc. so.6 (0x42000000)
/Lib/ld-linux.so.2 =>/lib/ld-linux.so.2 (0x40000000)
|
LDD
The most common problem is to solve the problem that the library cannot be found during the runtime, such as the"
Error while loading shared libraries: libxxx. So
"Error, you can run
LDD
To see which library files are missing.