地址0x8048080的意义(significance of address 0x8048080)

编程入门 行业动态 更新时间:2024-10-26 14:27:15
地址0x8048080的意义(significance of address 0x8048080)

为什么当我在gdb中调试asm源时,为起始入口点选择的地址为0x8048080? 这只是一个相对偏移,而不是指令的实际内存偏移,对吗?

why when i debug asm source in gdb is 0x8048080 the address chosen for the starting entry point into code? this is just a relative offset, not an actual offset of into memory of an instruction, correct?

最满意答案

地址0x8048080没有特别的意义,但地址为0x8048080有一个。

后一个地址是默认地址, ld在Linux / x86上启动第一个PT_LOAD段。 在Linux / x86_64上,默认值为0x400000 ,您可以使用“自定义”链接描述文件更改默认值。 您还可以更改.text部分以-Wl,-Ttext,0xNNNNNNNN标志-Wl,-Ttext,0xNNNNNNNN 。

在ld从0x08048000开始0x08048000 ,它为程序头添加空间,并根据其内置链接器脚本继续链接其余可执行文件,如果将-Wl,--verbose传递到链接行-Wl,--verbose则可以看到该脚本。

对于您的程序,程序头的大小似乎始终为0x80 ,因此.text部分始终从0x8048080开始,但这绝不是通用的。

当我链接一个简单的int main() { return 0; } 程序,我得到&_start == &.text . 0x8048300在0x8048178或0x8048360 ,具体取决于我使用的编译器。

There is no special significance to address 0x8048080, but there is one for address 0x08048000.

The latter address is the default address, on which ld starts the first PT_LOAD segment on Linux/x86. On Linux/x86_64, the default is 0x400000, and you can change the default by using a "custom" linker script. You can also change where .text section starts with -Wl,-Ttext,0xNNNNNNNN flag.

After ld starts at 0x08048000, it adds space for program headers, and proceeds to link the rest of the executable according to its built-in linker script, which you can see if you pass in -Wl,--verbose to your link line.

For your program, the size of program headers appears to always be 0x80, so your .text section always starts at 0x8048080, but that is by no means universal.

When I link a trivial int main() { return 0; } program, I get &_start == &.text at 0x8048300, 0x8048178 or 0x8048360, depending on which compiler I use.

更多推荐

本文发布于:2023-07-29 05:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1312625.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:意义   地址   address   significance

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!