Either of these values can be ord with the rtld

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . Relocating PC-Relative References Recall from our running example in Figure 7.1(a) that the main routine in the .text section of main.o calls the swap routine, which is defined in swap.o. Here is the disassembled listing for the call instruction, as generated by the GNU OBJDUMP tool: 6: e8 fc ff ff ff call 7 <main+0x7> 7: R_386_PC32 swap swap(); relocation entry 368 CHAPTER 7. LINKING From this listing we see that the call instruction begins at section offset 0x6 and consists of the 1-byte opcode 0xe8, followed by the 32-bit reference 0xfffffffc ( decimal), which is stored in little-endian byte order. We also see a relocation entry for this reference displayed on the following line. (Recall that relocation entries and instructions are actually stored in different sections of the object file. The OBJDUMP tool displays them together for convenience.) The relocation entry r consists of three fields: r.offset = 0x7 r.symbol = swap r.type = R_386_PC32 that tell the linker to modify the 32-bit PC-relative reference starting at offset 0x7 so that it w...
View Full Document

Ask a homework question - tutors are online