什么是搬迁概念是什么意思? [英] What does the concept of relocation mean?

查看:129
本文介绍了什么是搬迁概念是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来组装,因此想了解更多关于搬迁的概念。

I'm new to assembly and hence want to understand more about the concept of relocation.


  1. 到底为什么我们需要搬迁程序,数据?

  2. 究竟它是如何做的?

这将是巨大的,如果有人可以用一​​个初学者的水平例子来说吧。

It would be great if someone could explain with a beginner level example.

推荐答案

该汇编有一个源文件来看待。它基于一个源文件建立一个内存映像。所以它开始以0为code和也为0的数据。结果进入的目标文件。

The assembler has one source file to look at. It has to build a memory image based on that one source file. So it starts with 0 for the code, and also for 0 with the data. The results go into an object file.

现在,链接器走来,需要许多目标文件组合成一个可执行文件(或内核映像,或其他)。它不能离开大家为0,他们会重叠。因此,它必须重新定位的地址数据的每个目标文件的价值分配到一个独特的范围。

Now, the linker comes along and needs to combine many object files into an executable (or kernel image, or whatever). It can't leave everyone at 0, they would overlap. So it must relocate the addresses to assign each object file's worth of data to a unique range.

然后,然后将图像加载到虚拟内存,操作系统可以具有良好的理由要使用比'0'以外的地址为基的虚拟地址。因此,在运行时,它要再次搬迁的一切。

Then, then the image is loaded into virtual memory, the operating system may have good reasons to want to use an address other than '0' as the base virtual address. So, at runtime, it wants to relocate everything again.

最后,如果有共享库涉及,既不汇编也不接头知道在哪里,他们将在运行环境,所以给它们的引用必须重新定位。

Finally, if there are shared libraries involved, neither the assembler nor the linker knows where they will be in the running environment, and so the references to them must be relocated.

这篇关于什么是搬迁概念是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆