可见,符号foo2的运行时地址为0x0804a020,符号foo2_func的运行时地址是0x08048414。 接下来,我们再来看看汇编器为这两个符号填充的Addend是多少。我们使用工具objdump反汇编hello.o,其中黑体标识的分别是汇编器在引用foo2和foo2_func的地址处填充的Addend: root@baisheng:~/demo# objdump -d hello.o hello.o: file format elf32-i386 Disassembly of section .text: 00000000 <main>: 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 e4 f0 and $0xfffffff0,%esp 6: 83 ec 10 sub $0x10,%esp 9: c7 05 00 00 00 00 05 movl $0x5,0x0 10: 00 00 00 13: c7 04 24 32 00 00 00 movl $0x32,(%esp) 1a: e8 fc ff ff ff call 1b <main+0x1b> 1f: b8 00 00 00 00 mov $0x0,%eax 24: c9 leave 25: c3 ret |
|