Linkers and Loaders (The Morgan Kaufmann Series in Software Engineering and Programming)
Whatever your programming language, whatever your platform, you probably tap into linker and loader functions all the time. But do you know how to use them to their greatest possible advantage? Only now, with the publication of Linkers & Loaders, is there an authoritative book devoted entirely to these deep-seated compile-time and run-time processes.
The book begins with a detailed and comparative account of linking and loading that illustrates the differences among various compilers and operating systems. On top of this foundation, the author presents clear practical advice to help you create faster, cleaner code. You'll learn to avoid the pitfalls associated with Windows DLLs, take advantage of the space-saving, performance-improving techniques supported by many modern linkers, make the best use of the UNIX ELF library scheme, and much more. If you're serious about programming, you'll devour this unique guide to one of the field's least understood topics. Linkers & Loaders is also an ideal supplementary text for compiler and operating systems courses.
*Includes a linker construction project written in Perl, with project files available for download. *Covers dynamic linking in Windows, UNIX, Linux, BeOS, and other operating systems.
*Explains the Java linking model and how it figures in network applets and extensible Java code.
*Helps you write more elegant and effective code, and build applications that compile, load, and run more efficiently.
Why Read This Book
You will learn how linkers and loaders actually work across platforms so you can control binary layout, diagnose mysterious runtime failures, and shrink or speed up firmware and applications. Levine combines clear, low-level explanations of object formats and relocation with practical advice you can apply to embedded, desktop, and server toolchains.
Who Will Benefit
Embedded and systems engineers, firmware developers, and build/toolchain maintainers who need to produce small, reliable binaries, debug startup/link-time issues, or tune shared-library behavior.
Level: Advanced — Prerequisites: Working knowledge of C/C++ and assembly, familiarity with basic operating system concepts (process memory layout, dynamic linking), and experience using compilers and basic binutils (gcc/clang, ar, nm).
Key Takeaways
- Understand object file formats and read/link map files to control memory layout and placement of code/data
- Diagnose and fix relocation and symbol-resolution problems that cause link or runtime failures
- Apply linker-script techniques and section-based optimization to reduce firmware size and improve startup performance
- Manage shared libraries and DLLs safely, including versioning, symbol visibility, and common Windows pitfalls
- Use binutils and loader tools (readelf, objdump, nm, ld, ld.so/loader) effectively to inspect and manipulate binaries
- Design build and packaging strategies that take advantage of link-time behavior (incremental linking, garbage-collection of unused sections, COMDAT handling)
Topics Covered
- Introduction: What Linkers and Loaders Do
- Object File Basics: Sections, Symbols, and Relocations
- Linking: Symbol Resolution and Binding Models
- Relocations and Position-Independent Code
- Static Libraries, Archives, and Incremental Linking
- Shared Libraries and Dynamic Linking (UNIX and Windows DLLs)
- Linker Implementation Techniques and Algorithms
- Linker Scripts, Map Files, and Controlling Layout
- Language Issues: C++, Templates, COMDATs, and Weak Symbols
- Debugging Link-Time and Load-Time Problems
- Platform Case Studies: ELF, COFF/PE, a.out and Loader Behavior
- Special Topics: Overlays, Prelinking, and Size/Performance Optimizations
- Practical Tools and Workflows for Developers
Languages, Platforms & Tools
How It Compares
Covers similar low-level linker and loader material to the dynamic-linking chapters in Michael Kerrisk's The Linux Programming Interface, but Levine's book is unique in focusing solely on linkers/loaders across multiple object formats and platforms.













