gpt4 book ai didi

x86 - 为什么 Elf64 不使用 Elf64_Rel 在 64 位 x86 上重定位?

转载 作者:行者123 更新时间:2023-12-04 03:24:17 26 4
gpt4 key购买 nike

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-54839.html#chapter7-2状态:

64–bit SPARC and 64–bit x86 use only Elf64_Rela relocation entries. Thus, the r_addend member serves as the relocation addend. x86 uses only Elf32_Rel relocation entries. The field to be relocated holds the addend.

存在一个 Elf64_Rel 结构,那么为什么不在 64 位 x86 目标上使用它呢?使用 Elf64_Rela 不会浪费空间,因为预重定位地址只是被忽略了(或者至少总是 0 从我在测试中看到的)?

注意:Elf64_Rel中省略了r_addend,不是简单的不用。

最佳答案

There exists an Elf64_Rel struct, so why isn't it being used on 64-bit x86 targets?

x86_64 上,有几种可能的 memory models .默认情况下,small memory model被使用,不需要任何 64 位重定位。

如果您使用 -mcmodel=large 进行编译,则将使用 64 位重定位

关于x86 - 为什么 Elf64 不使用 Elf64_Rel 在 64 位 x86 上重定位?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67892704/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com