.text section address range of position independent executable
.text section address range of position independent executable
我想要与位置无关的可执行文件的 .text 部分的地址。使用 readelf -S
:
Name Type Address Offset
Size EntSize Flags Link Info Align
.text PROGBITS 0000000000002700 00002700
0000000000001672 0000000000000000 AX 0 0 16
我了解到它将在库加载到内存后的 0x2700 字节处开始。但是我怎样才能得到可执行文件的加载地址呢?
有没有其他方法可以在运行时(从 运行 程序)获取 .text 节地址范围?
Is there any other way to get the .text section address range during runtime (from the running program)?
是:您需要使用dl_iterate_phdr并使用info->dlpi_addr
在运行时在内存中定位PIE
二进制文件。对您的 callback
的第一次调用将用于主可执行文件。
我想要与位置无关的可执行文件的 .text 部分的地址。使用 readelf -S
:
Name Type Address Offset
Size EntSize Flags Link Info Align
.text PROGBITS 0000000000002700 00002700
0000000000001672 0000000000000000 AX 0 0 16
我了解到它将在库加载到内存后的 0x2700 字节处开始。但是我怎样才能得到可执行文件的加载地址呢? 有没有其他方法可以在运行时(从 运行 程序)获取 .text 节地址范围?
Is there any other way to get the .text section address range during runtime (from the running program)?
是:您需要使用dl_iterate_phdr并使用info->dlpi_addr
在运行时在内存中定位PIE
二进制文件。对您的 callback
的第一次调用将用于主可执行文件。