1

I'm a bit confused with relocation concerning linker and loader. I know that the linker links modules together and that the loader loads them into a place in memory. However if our main program has a subroutine that starts at the same address of the main program, would the linker relocate it? Or would the loader do that?

Thanks in advance.

  • What do you mean by "if our main program has a subroutine that starts at the same address of the main program, would the linker relocate it?" ? – Mihai Mar 11 '21 at 23:26
  • Noone would relocate the main program, no matter if it starts with a subroutine or whatever. Only modules statically linked to the main program are combined and relocated at the link time at the vacant virtual addresses. The resulting image is then loaded as a whole. – vitsoft Mar 12 '21 at 15:31

0 Answers0