This preview shows page 1. Sign up to view the full content.
Unformatted text preview: <- PC + 0x9 = 0x80483bf + 0x9 = 0x80483c8 Thus, the next instruction to execute is the ﬁrst instruction of the swap routine, which of course is what we want! You may wonder why the assembler created the reference in the call instruction with an initial value of . The assembler uses this value as a bias to account for the fact that the PC always points to the instruction following the current instruction. On a different machine with different instruction sizes and encodings, the assembler for that machine would use a different bias. This is powerful trick that allows the linker to blindly relocate references, blissfully unaware of the instruction encodings for a particular machine. 7.7. RELOCATION 369 Relocating Absolute References
Recall that in our example program in Figure 7.1, the swap.o module initializes the global pointer bufp0 to the address of the ﬁrst element of the global buf array:
int *bufp0 = &buf; Since bufp0 is an initialized data object, it will be stored in the .data section of the swap.o relocatable object module. Since it is initialized to the address of a global array, it will need to be relocated. H...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American