分享

1. 合并目标文件

 renhl252 2015-02-13
我们来看一下目标文件和链接后的可执行文件的“.text”段。下面分别列出了目标文件hello.o、foo1.o、foo2.o以及可执行文件hello的段表中的“.text”段的相关信息。由于篇幅限制,我们删除了输出的后面几列。
root@baisheng:~/demo# readelf -S hello.o
There are 12 section headers, starting at offset 0x118:
Section Headers:
  [Nr] Name             Type            Addr       Off     Size
  [ 0]                  NULL            00000000  000000  000000     
  [ 1] .text            PROGBITS        00000000  000034  000026 
...
root@baisheng:~/demo# readelf -S foo1.o 
There are 12 section headers, starting at offset 0x104:
Section Headers:
  [Nr] Name             Type           Addr       Off      Size 
  [ 0]                  NULL           00000000  000000   000000
  [ 1] .text            PROGBITS       00000000  000034   000010
...
root@baisheng:~/demo# readelf -S foo2.o
There are 12 section headers, starting at offset 0x104:
Section Headers:
  [Nr] Name              Type           Addr       Off      Size  
  [ 0]                   NULL           00000000  000000   000000
  [ 1] .text             PROGBITS       00000000  000034   000010
...
root@baisheng:~/demo# readelf -S hello
There are 30 section headers, starting at offset 0x1198:我们来看一下目标文件和链接后的可执行文件的“.text”段。下面分别列出了目标文件hello.o、foo1.o、foo2.o以及可执行文件hello的段表中的“.text”段的相关信息。由于篇幅限制,我们删除了输出的后面几列。
root@baisheng:~/demo# readelf -S hello.o
There are 12 section headers, starting at offset 0x118:
Section Headers:
  [Nr] Name             Type            Addr       Off     Size
  [ 0]                  NULL            00000000  000000  000000     
  [ 1] .text            PROGBITS        00000000  000034  000026 
...
root@baisheng:~/demo# readelf -S foo1.o 
There are 12 section headers, starting at offset 0x104:
Section Headers:
  [Nr] Name             Type           Addr       Off      Size 
  [ 0]                  NULL           00000000  000000   000000
  [ 1] .text            PROGBITS       00000000  000034   000010
...
root@baisheng:~/demo# readelf -S foo2.o
There are 12 section headers, starting at offset 0x104:
Section Headers:
  [Nr] Name              Type           Addr       Off      Size  
  [ 0]                   NULL           00000000  000000   000000
  [ 1] .text             PROGBITS       00000000  000034   000010
...
root@baisheng:~/demo# readelf -S hello
There are 30 section headers, starting at offset 0x1198:

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

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多