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).

9: e8 00 00 00 00 with the following relocation entry: r.offset= Oxa r.symbol swap r.type r.addend = -4 =

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;

(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()

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

1 Expert Approved Answer
Step: 1 Unlock

This problem tests your understanding of how the linker r... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!