Consider the call to function swap in object file m0 with th

Consider the call to function swap in object file m.0 with the following relocation entry: r.offset = 0xa r.symbol = swap r.type = R_X86_64_PC32 r.addend = -4 Suppose that the linker relocates.text in m.0 to address 0x4004e0 and swap to address 0x4004f8.Then what is the value of the relocated reference to swap in the callq instruction? Suppose that the linker relocates. text in m. 0 to address 0x4004d0 and swap to address 0x400500. Then what is the value of the relocated reference to swap in the callq instruction?

Solution

callq will push address into stack and jump to that address.

A)
Here swapping from 0x4004e0 to 0x4004f8, so callq will push 0x4004f8 into stack.
And reference value will be 0x4004f8.

B)
Here swapping from 0x4004d0 to 0x400500, so callq will push 0x400500 into stack.
And reference value will be 0x400500.

 Consider the call to function swap in object file m.0 with the following relocation entry: r.offset = 0xa r.symbol = swap r.type = R_X86_64_PC32 r.addend = -4

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site