Even worse the assignment of libraries to memory

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: ere is the disassembled listing of the .data section from swap.o: 00000000 <bufp0>: 0: 00 00 00 00 0: R_386_32 buf int *bufp0 = &buf[0]; relocation entry We see that the .data section contains a single 32-bit reference, the bufp0 pointer, which has a value of 0x0. The relocation entry tells the linker that this is a 32-bit absolute reference, beginning at offset 0, which must relocated so that it points to the symbol buf. Now suppose that the linker has determined that ADDR(r.symbol) = ADDR(buf) = 0x8049454 The linker updates the reference using line 13 of the algorithm in Figure 7.9: *refptr = (unsigned) (ADDR(r.symbol) + *refptr) = (unsigned) (0x8049454 + 0) = (unsigned) (0x8049454) In the resulting executable object file, the reference has the following relocated form: 0804945c <bufp0>: 804945c: 54 94 04 08 Relocated! In words, the linker has decided that at run time, the variable bufp0 will be located at memory address 0x804945c and will be initialized to 0x8049454, which is the run-time address...
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.

Ask a homework question - tutors are online