This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ﬁles, this is not a major issue. But on register-starved IA32 systems, losing even one register can trigger spilling of the registers onto the stack. PIC Function Calls
It would certainly be possible for PIC code to use the same approach for resolving external procedure calls:
call L1: popl addl call L1 %ebx; $PROCOFF, %ebx *(%ebx) # ebx contains the current PC # ebx points to GOT entry for proc # call indirect through the GOT However, this approach would require three additional instructions for each run-time procedure call. Instead, ELF compilation systems use an interesting technique, called lazy binding, that defers the binding of procedure addresses until the ﬁrst time the procedure is called. There is a nontrivial run-time overhead the ﬁrst time the procedure is called, but each call thereafter only costs a single instruction and a memory reference for the indirection. Lazy binding is implemented with a compact yet somewhat complex interaction between two data structures: the GOT and the procedure linkage table (PLT). If an object module calls any functions that are deﬁned in shared libraries,...
View Full Document