分享

2. 符号重定位

 renhl252 2015-02-13
可见,符号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   

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多