加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – ELF文件中的导入表在哪里?

发布时间:2020-12-13 16:59:02 所属栏目:Linux 来源:网络整理
导读:我在String Table中找到了“.dynsym”,得到了索引. 然后我找到了sh_name = index的部分. sh_type = SHT_DYNSYM. 所以我得到了sh_offset = 464和sh_size = 64. 但是你可以在附图中看到,在偏移464上只有零. 我想导入表在偏移528上开始.问题是:如何计算它%)
我在String Table中找到了“.dynsym”,得到了索引.
然后我找到了sh_name = index&&的部分. sh_type = SHT_DYNSYM.
所以我得到了sh_offset = 464和sh_size = 64.
但是你可以在附图中看到,在偏移464上只有零.

我想导入表在偏移528上开始.问题是:如何计算它%)

解决方法

But you can see in the attached picture,that on the offset 464 there are only zeros.

错误:上次我检查时,01,20,29,12等不是“仅零”.

I suppose that Import Table starts on offset 528

不,不是的.出于某种原因,您希望在ELF文件中找到Microsoft PE样式的导入表.它不在那里.

ELF中的导入表的等效项包含在两个表中.一个包含Elf {32,64} _Sym固定大小的记录:

typedef struct
{
  Elf32_Word    st_name;                /* Symbol name (string tbl index) */
  Elf32_Addr    st_value;               /* Symbol value */
  Elf32_Word    st_size;                /* Symbol size */
  unsigned char st_info;                /* Symbol type and binding */
  unsigned char st_other;               /* Symbol visibility */
  Elf32_Section st_shndx;               /* Section index */
} Elf32_Sym;

并包含在.dynsym部分中.

另一个表包含在.dynstr部分中(在您的文件中以偏移量528开始),并且只有(可变大小)字符串由NUL字符分隔.

第一个表中的.st_name引用.dynstr中的偏移量.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读