Understanding Load-Time Relocation of Shared Libraries in Modern Operating Systems
By
saltypal
The kind of bagel that ruins lesser bagels for you.
Summary
This technical article explains how modern operating systems implement load-time relocation for shared libraries, focusing on Linux OS running on 32-bit x86 architecture. It covers the fundamental principles of shared library loading, address space layout randomization (ASLR), position-independent code (PIC), and the mechanisms that allow multiple processes to share the same library code while having different data segments. The article discusses the technical challenges of memory management, relocation entries, and how operating systems handle the mapping of shared libraries into process address spaces at load time.
Key quotes
· 4 pulledThis article's aim is to explain how a modern operating system makes it possible to use shared libraries with load-time relocation.
It focuses on the Linux OS running on 32-bit x86, but the general principles apply to other OSes and CPUs as well.
Note that shared libraries have many names - shared libraries, shared objects, dynamic shared objects (DSOs), dynamically linked libraries (DLLs - if you're coming from a Windows background).
For the sake of consistency, I will try to just use the name 'shared library' throughout.
You might also wanna read
WSL9x: Running Modern Linux Kernel Inside Windows 9x
WSL9x is a technical project that runs a modern Linux kernel (version 6.19) cooperatively inside the Windows 9x kernel, allowing users to ru
Fuzix OS 0.4 Released with Reworked Networking Layer and Bug Fixes
Fuzix OS version 0.4 has been released with significant updates including a completely reworked networking layer for better modularity, allo
Redox OS Implements New Deficit Weighted Round Robin CPU Scheduler
The article details the implementation of a new CPU scheduler for Redox OS, replacing the legacy Round Robin scheduler with a Deficit Weight
13-Year-Old Developer Builds Complete 32-bit x86 Operating System from Scratch in 14 Days
AurionOS is a custom 32-bit x86 operating system built entirely from scratch in C and Assembly by a 13-year-old developer. The project was c
Returning to FreeBSD: A Reflection on Server Deployment Evolution
The article reflects on the evolution of server deployment methods over decades, contrasting old manual FTP/file transfer approaches with mo
hypha.pub·3mo agoGenode OS Framework: A Toolkit for Building Secure Special-Purpose Operating Systems
The Genode OS Framework is a toolkit for building highly secure special-purpose operating systems that scales from embedded systems with min
