编程常见的符号表和结构查找方法

编程常见的符号表和结构查找方法,第1张

<code>weeds@weeds-ThinkPad-T440p:~/Documents/encrypchip$ objdump -t main.o

main.o: file format elf32-little

SYMBOL TABLE:

00000000 ldf *ABS* 00000000 main.c

00000000 ld .text 00000000 .text

00000000 ld .data 00000000 .data

00000000 ld .bss 00000000 .bss

00000000 ld .mdebug.abi32 00000000 .mdebug.abi32

00000000 ld .rodata00000000 .rodata

00000000 ld .reginfo 00000000 .reginfo

00000000 ld .pdr 00000000 .pdr

00000000 ld .comment 00000000 .comment

00000000 ld .gnu.attributes00000000 .gnu.attributes

00000000 g F .text 000000dc demo1

00000000 *UND* 00000000 GetIdChipSerialNo

00000000 *UND* 00000000 printf

00000000 *UND* 00000000 putchar

000000dc g F .text 0000027c demo2

00000000 *UND* 00000000 _alpu_rand

00000000 *UND* 00000000 gettimeofday

00000000 *UND* 00000000 alpuc_process

00000000 *UND* 00000000 puts

00000358 g F .text 0000003c main

</code>

readelf -h xxx.o

<code>weeds@weeds-ThinkPad-T440p:~/Documents/encrypchip$ readelf -h main.o

ELF Header:

Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00

Class: ELF32

Data: 2's complement, little endian

Version: 1 (current)

OS/ABI:UNIX - System V

ABI Version: 0

Type: REL (Relocatable file)

Machine: MIPS R3000

Version: 0x1

Entry point address: 0x0

Start of program headers: 0 (bytes into file)

Start of section headers: 1624 (bytes into file)

Flags: 0x1005, noreorder, cpic, o32, mips1

Size of this header: 52 (bytes)

Size of program headers: 0 (bytes)

Number of program headers: 0

Size of section headers: 40 (bytes)

Number of section headers: 15

Section header string table index: 12

</code>

readelf -s main.o

<code>weeds@weeds-ThinkPad-T440p:~/Documents/encrypchip$ readelf -s main.o

Symbol table '.symtab' contains 21 entries:

Num:Value Size TypeBind Vis Ndx Name

0: 00000000 0 NOTYPE LOCAL DEFAULT UND

1: 00000000 0 FILELOCAL DEFAULT ABS main.c

2: 00000000 0 SECTION LOCAL DEFAULT1

3: 00000000 0 SECTION LOCAL DEFAULT3

4: 00000000 0 SECTION LOCAL DEFAULT4

5: 00000000 0 SECTION LOCAL DEFAULT8

6: 00000000 0 SECTION LOCAL DEFAULT9

7: 00000000 0 SECTION LOCAL DEFAULT5

8: 00000000 0 SECTION LOCAL DEFAULT6

9: 00000000 0 SECTION LOCAL DEFAULT 10

10: 00000000 0 SECTION LOCAL DEFAULT 11

11: 00000000 220 FUNCGLOBAL DEFAULT1 demo1

12: 00000000 0 NOTYPE GLOBAL DEFAULT UND GetIdChipSerialNo

13: 00000000 0 NOTYPE GLOBAL DEFAULT UND printf

14: 00000000 0 NOTYPE GLOBAL DEFAULT UND putchar

15: 000000dc 636 FUNCGLOBAL DEFAULT1 demo2

16: 00000000 0 NOTYPE GLOBAL DEFAULT UND _alpu_rand

17: 00000000 0 NOTYPE GLOBAL DEFAULT UND gettimeofday

18: 00000000 0 NOTYPE GLOBAL DEFAULT UND alpuc_process

19: 00000000 0 NOTYPE GLOBAL DEFAULT UND puts

20: 0000035860 FUNCGLOBAL DEFAULT1 main

</code>

nm xxx.o 对比g++编译程序生成的符号表与gcc生成的不同点。

?

一般是转义字符

转义字符是C语言中表示字符的一种特殊形式。转义字符以反斜'\'开头,后面跟一个字符或一个八进制或十六进制数表示。转义字符具有特定的含义,不同于字符原有的意义,故称转义字符。示例如下:

char c1 = '\'' //后面接一个特殊字符

char c2 = '\110' //后面接一个三位的八进制数

char c3 = '\x0d' //后面接一个两位的十六进制数


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7771209.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-09
下一篇 2023-04-09

发表评论

登录后才能评论

评论列表(0条)

保存