Consider the call to function swap in object file m.o (Figure 7.5). Now suppose that the linker

Question:

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

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Systems A Programmers Perspective

ISBN: 9781292101767

3rd Global Edition

Authors: Randal E. Bryant, David R. O'Hallaron

Question Posted: