Position-independent code
In computing, position-independent code (PIC ) or position-independent executable (PIE) is a body of machine code that executes properly regardless of its memory address.[src] PIC is commonly used for shared libraries, so that the same library code can be loaded at a location in each program's address space where it does not overlap with other memory in use by, for example, other shared libraries.[src] PIC was also used on older computer systems that lacked a Memory Management Unit (MMU), so that the operating system could keep applications away from each other even within the single address space of an MMU-less system.[src] Position-independent code can be executed at any memory address without modification.[src] This differs from absolute code, which must be loaded at a specific location to function correctly, and load-time locatable (LTL) code, in which a linker or program loader modifies a program before execution, so it can be run only from a particular memory location.[src] The latter terms are sometimes referred to as position-dependent code.[src] Generating position-independent code is often the default behavior for compilers, but they may place restrictions on the use of some language features, such as disallowing use of absolute addresses (position-independent code has to use relative addressing).…[src]
In computing, position-independent code (PIC ) or position-independent executable (PIE) is a body of machine code that executes properly regardless of its memory address.[src] PIC is commonly used for shared libraries, so that the same library code can be loaded at a location in each program's address space where it does not overlap with other memory in use by, for example, other shared libraries.[src] PIC was also used on older computer systems that lacked a Memory Management Unit (MMU), so that the operating system could keep applications away from each other even within the single address space of an MMU-less system.[src] Position-independent code can be executed at any memory address without modification.[src] This differs from absolute code, which must be loaded at a specific location to function correctly, and load-time locatable (LTL) code, in which a linker or program loader modifies a program before execution, so it can be run only from a particular memory location.[src] The latter terms are sometimes referred to as position-dependent code.[src] Generating position-independent code is often the default behavior for compilers, but they may place restrictions on the use of some language features, such as disallowing use of absolute addresses (position-independent code has to use relative addressing).[src] Instructions that refer directly to specific memory addresses sometimes execute faster, and replacing them with equivalent relative-addressing instructions may result in slightly slower execution, although modern processors make the difference practically negligible.[src] == Position-independent executables == Position-independent executables (PIE) are executable binaries made entirely from position-independent code.[src] While some systems only run PIC executables, there are other reasons they are used.[src] PIE binaries are used in some security-focused Linux distributions to allow PaX or Exec Shield to use address space layout randomization (ASLR) to prevent attackers from knowing where existing executable code is during a security attack using exploits that rely on knowing the offset of the executable code in the binary, such as return-to-libc attacks.[src] (The official Linux kernel since 2.6.12 of 2005 has a weaker ASLR that also works with PIE.[src] It is weak in that randomness is applied to whole ELF file units.) Apple's macOS and iOS fully support PIE executables as of versions 10.7 and 4.3, respectively; a warning is issued when non-PIE iOS executables are submitted for approval to Apple's App Store but there's no hard requirement yet and non-PIE applications are not rejected.[src] OpenBSD has PIE enabled by default on most architectures since OpenBSD 5.3, released on 1 May 2013.[src] Support for PIE in statically linked binaries, such as the executables in /bin and /sbin directories, was added near the end of 2014.[src] openSUSE added PIE as a default in 2015–02.[src] Beginning with Fedora 23, Fedora maintainers decided to build packages with PIE enabled as the default.[src] Ubuntu 17.10 has PIE enabled by default across all architectures.[src] Gentoo's new profiles now support PIE by default.[src] Around July 2017, Debian enabled PIE by default.[src] Android enabled support for PIEs in Jelly Bean and removed non-PIE linker support in Lollipop.[src]
28 sentences · 28 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Position-independent code." encyclopegia.org, 2026, https://encyclopegia.org/wiki/position-independent-code. Accessed 25 November 2026.
Chicago
"Position-independent code." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/position-independent-code.
APA
encyclopegia.org. (2026). Position-independent code. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/position-independent-code
Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON
Claims
| Predicate | Value | Source |
|---|---|---|
| release date | 2013-05-01 | Wikipedia |