This might sound very silly question to many but i want to have clear understanding on this topic. For example: when we build a C program on linux(ubuntu, x86) which would generate a.out after successful compilation and linking process. What type of addresses a.out contains ? Is it virtual address ? If not then in which step (from building a program to loading it into the memory) the virtual address will come into play?
Asked
Active
Viewed 740 times
2
-
Programs outside the kernel only deal with virtual addresses. The operating system translates virtual addresses to physical addresses. – Barmar May 08 '18 at 20:10
-
In fact, it's actually done by hardware called the Memory Management Unit. The OS fills in the data used by the MMU to perform this. – Barmar May 08 '18 at 20:11
-
Possible duplicate of [Are the load address is common for all the C programs in linux?](https://stackoverflow.com/q/18865763/608639), [Does the load address at compile time is the place where I need to copy the executable in RAM?](https://stackoverflow.com/q/18713104/608639), [When / How does Linux load shared libraries into address space?](https://stackoverflow.com/q/5130654/608639), etc. – jww May 09 '18 at 00:02
1 Answers
-1
Compilers generate addresses. Linkers generate addresses. They are just addresses.
If you do development or run on a system without logical address translation, those addresses are interpreted as physical addresses.
If you do development or run on a system that uses logical address translation, those addresses are interpreted as logical addresses.
What type of addresses a.out contains ? Is it virtual address ?
It contains addresses of unspecified type.
If not then in which step (from building a program to loading it into the memory) the virtual address will come into play?
This is entirely the function of how the processor interprets those addresses.

user3344003
- 20,574
- 3
- 26
- 62