Question: Consider the call to function swap in object file m.o (Figure 7.5). Now suppose that the linker relocates .text in m.o to address 0x4004d0 and
Consider the call to function swap in object file m.o (Figure 7.5).

Now suppose that the linker relocates .text in m.o to address 0x4004d0 and swap to address 0x4004e8. Then what is the value of the relocated reference to swap in the callq instruction?
Figure 7.5
![(a) m.c 1 void swap(); 2 3 int buf [2] = {1, 2}; 45 5 int main() 6 { 7 8 9} swap(); return 0;](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1698/2/3/7/18565390b0135c9c1698237182582.jpg)
![(b) swap.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 extern int buf []; int *bufp0 = &buf [0]; int *bufp1; void swap()](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1698/2/3/7/21365390b1d1a7a11698237211119.jpg)
9: e8 00 00 00 00 with the following relocation entry: r.offset= Oxa r.symbol swap r.type r.addend = -4 = R_X86_64_PC32 callq e swap()
Step by Step Solution
3.46 Rating (153 Votes )
There are 3 Steps involved in it
This problem tests your understanding of how the linker r... View full answer
Get step-by-step solutions from verified subject matter experts
