**Position Independent Code**
When you compile a shared library (with
-fPIC, in the case of
gcc), you are specifying that you want the compiler to generate *position independent code*.
Position independent code never uses straightforward machine addressing modes to access global variables, static variables, or non-static functions. Instead, position independent code accesses these kinds of data indirectly.
**PLTs and the GOT**
Copy *n* bytes of data, and it takes *t* time. Copy *2n* bytes of data, and it takes *2t* time, right? Not necessarily.
In-memory data-copying performance is not so straightforward. This article explains how the *rate* of data copying changes with the amount of data copied.