LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Absolute Adresses in compiled program (https://www.linuxquestions.org/questions/linux-newbie-8/absolute-adresses-in-compiled-program-4175704830/)

sundialsvcs 12-14-2021 08:54 AM

Actually, "position independent code" does not require "relocation" in the traditional sense, and that is the point. It requires that some CPU register point to the location (in virtual memory ...) where the code has been loaded, and all references are relative to that register's current value. The code could be "binary copied" to some other place in memory and, so long as the CPU register's value is once again correct, it will continue to run normally.

Non-position-independent code contains (virtual ...) memory references which must be resolved by the operating system's "loader" before the program begins to run, and it cannot be moved elsewhere. The program-file specifies where these memory references are located, and the loader "fixes them up" before the program starts.


All times are GMT -5. The time now is 10:53 PM.