I have a very basic doubt in static linking.
Suppose we have 2 object codes A and B. Object code B contains function B() which is called by A.
Now suppose in object code A at 100th location function B() is called.
Now will the function B() be directly placed at location 100 or will it be placed at some other location in the final object code file and resolved during 2nd pass linking (like function B() will be placed at location 150 in final object code and function call to B() will be resolved as 150) ?
When linking, the linker will put the functions from A and B at suitable locations in memory. Then it will look at the call instruction at the 100th location of A and paste the address of B() into this instruction.