gpt4 book ai didi

matplotlib - .plt .plt.got 有什么不同?

转载 作者:行者123 更新时间:2023-12-03 15:56:02 27 4
gpt4 key购买 nike

.plt :在 RE 能段中,蹦床功能在 plt[n]除了 0,在 plt[0] 处有 .got.plt 解析器链接
.got .got.plt : 在 RW 段中,只是地址

我从这篇文章中学到的:
https://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/

问题

实际的 Linux shell 命令给了我不同的答案

$readelf -l /bin/bash

read elf -l result

got.plt 消失了,02 段中的 .plt.got 是什么?

我倾倒了两个部分(plt,plt.got)并得到了这个程序集

.plt 是 plt 我了解到的:
.plt is plt as i learned

.plt.got ,这是干什么用的?
.plt.got , what is this for

很抱歉倾销不好,它是由
objcopy -O binary --only-section=.plt.got /bin/bash ./pltgot
objcopy -O binary --only-section=.plt /bin/bash ./plt

问题
  • .plt 和 .plt.got 有什么区别
  • 为什么会发生这种差异?
  • 最佳答案

    .plt 之间的区别和 .plt.got.plt使用惰性绑定(bind)和 .plt.got使用非惰性绑定(bind)。
    当函数的所有使用都是简单的函数调用时,延迟绑定(bind)是可能的。但是,如果需要函数的地址,则必须使用非惰性绑定(bind),因为绑定(bind)只能在调用函数时发生,并且我们可能需要在第一次调用之前知道地址。注意获取地址时直接访问GOT入口;只有函数调用通过 .plt.plt.got .
    如果 -fno-plt使用编译器选项,则不使用 .plt也不是 .plt.got发出,并且函数调用也直接访问 GOT 条目。
    在以下示例中,objdump -d用于拆卸,readelf -r用于列出重定位。.plt以 x64-64 为例,.plt将包含以下条目:

    0000000000014050 <_Unwind_Resume@plt>:
    14050: ff 25 3a e6 0e 00 jmpq *0xee63a(%rip) # 102690 <_Unwind_Resume@GCC_3.0>
    14056: 68 02 00 00 00 pushq $0x2
    1405b: e9 c0 ff ff ff jmpq 14020 <.plt>
    第一个 jmpq是到 GOT 条目,第二个 jmpq如果尚未绑定(bind) GOT 条目,则执行延迟绑定(bind)。 .plt 的搬迁的相关 GOT 条目位于 .rela.plt 中部分和使用 R_X86_64_JUMP_SLOT ,这让动态链接器知道这些是惰性的。
    0000000000102690  0000004600000007 R_X86_64_JUMP_SLOT     0000000000000000 _Unwind_Resume@GCC_3.0 + 0
    .plt.got .plt.got包含只需要一个 jmpq 的条目因为他们并不懒惰:
    0000000000014060 <memset@plt>:
    14060: ff 25 5a ea 0e 00 jmpq *0xeea5a(%rip) # 102ac0 <memset@GLIBC_2.2.5>
    14066: 66 90 xchg %ax,%ax
    .plt.got 的搬迁的相关 GOT 条目位于 .rela.dyn 中部分(连同 GOT 重定位的其余部分),动态链接器立即绑定(bind):
    0000000000102ac0  0000004b00000006 R_X86_64_GLOB_DAT      0000000000000000 memset@GLIBC_2.2.5 + 0

    关于matplotlib - .plt .plt.got 有什么不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58076539/

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