Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the virtual address of ELF can be determined before it is mapped to virtual space?

An object file is linked to generate an ELF file and its virtual address is determined. For example, the virtual address of .text is 0x8048000. When the ELF file is going to be mapped to virtual space, another ELF has already been mapped to this address. What the operating system should do? Why the virtual address of ELF can be determined before it is mapped to virtual space.

like image 627
haolee Avatar asked Oct 19 '22 01:10

haolee


1 Answers

Each process gets its own private virtual address space — that's the point of it being virtual; it doesn't have to correspond to where the program is actually located in physical RAM. So there's no conflict of addresses between programs running in different processes. They can all be mapped to that address, each in its own private address space.

like image 121
Wyzard Avatar answered Oct 21 '22 23:10

Wyzard