Position Independent Code (PIC)

From Software Engineers Wiki
Jump to: navigation, search

What is Position Independent Code?

Answer

In computing, position-independent code (PIC) or position-independent executable (PIE) is a body of machine code that, being placed somewhere in the primary memory, executes properly regardless of its absolute address. PIC is commonly used for shared libraries, so that the same library code can be loaded in a location in each program address space where it will not overlap any other uses of memory (for example, other shared libraries). PIC was also used on older computer systems lacking an MMU, so that the operating system could keep applications away from each other even within the single address space of an MMU-less system.

For example, the executable on DOS were PIC (no MMU).

Also executables for uClinux (Linux variant for the processor without MMU) are PIC.

Shared libraries (Dynamically Linked Libraries) are implemented as PIC because the it is not possible to know where will the libraries to be loaded.

Reference

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox