The answer to the last question: addends are to reduce the size of the symbol table. Instead of having one entry for every array + offset, in the symbol table, many entries in the relocation table can reference a single value in the symbol table with different addends. It is about putting related data close to where it starts to become specialized rather than having a generalized but bloated storage layout.
If you mean memory addresses (pointers) then it is done by OS and processor. OS tells the CPU how virtual memory pages map to physical memory, and CPU does the translation at runtime. If program tries to use virtual address that haven't been mapped to physical memory (because program didn't malloc it) then CPU notifies the OS about it and OS kills the process (this is a common cause of segfaults).
actually you can't, PICs are going to be dynamic mapped into different address trunks when loaded by kernel with ASLR enabled What the compiler could make sure is the offset of each resources/instructions to it's sections's base address. However, the base address is dynamic while executing
Is the answer for the last question, because we can load the program anywhere on memory and execute? (to make it PIC, position independent code)? BTW, thanks for the good explanation. I couldn't understand it 100% but it gave me the essential things of what linker does.
The answer to the last question: addends are to reduce the size of the symbol table. Instead of having one entry for every array + offset, in the symbol table, many entries in the relocation table can reference a single value in the symbol table with different addends. It is about putting related data close to where it starts to become specialized rather than having a generalized but bloated storage layout.
Which book are you referring for all these quality videos?
Computer Systems, a programmer’s perspective, by Randal E. Bryant and David R. O’Hallaron
Your videos are really interesting. Thanks for making such good contents. Can you make your lecture slides public?
Can you talk about the physical and virtual addresses and how they are selected? Where does it come from?
If you mean memory addresses (pointers) then it is done by OS and processor. OS tells the CPU how virtual memory pages map to physical memory, and CPU does the translation at runtime. If program tries to use virtual address that haven't been mapped to physical memory (because program didn't malloc it) then CPU notifies the OS about it and OS kills the process (this is a common cause of segfaults).
What gcc version do you use?
actually you can't, PICs are going to be dynamic mapped into different address trunks when loaded by kernel with ASLR enabled
What the compiler could make sure is the offset of each resources/instructions to it's sections's base address. However, the base address is dynamic while executing
Is the answer for the last question, because we can load the program anywhere on memory and execute? (to make it PIC, position independent code)? BTW, thanks for the good explanation. I couldn't understand it 100% but it gave me the essential things of what linker does.
Thanks!!! This video helps a lot!👍
Thank you!
Thanks, this helped!
Which IDE is this?
VS Code