Linkers and LoadersBy
- John Levine
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.
practicing programmers, computer language designers and developers, and students.
Paperback, 256 Pages
Published: October 1999
Imprint: Morgan Kaufmann
"I enjoyed reading this useful overview of the techniques and challenges of implementing linkers and loaders. While most of the examples are focused on three computer architectures that are widely used today, there are also many side comments about interesting and quirky computer architectures of the past. I can tell from these war stories that the author really has been there himself and survived to tell the tale."Guy Steele
- 1 Linking and Loading1.1 What do Linkers and Loaders Do?1.2 Address Binding: A Histrical Perspective1.3 Linking vs. Loading1.4 Compiler Drivers1.5 Linking: A True Life Example2 Architectural Issues2.1 Application Binary Interfaces2.2 Memory Addresses2.3 Address Formation2.4 Instruction Formats2.5 Procedure Calls and Accessibility2.6 Data and Instruction References2.7 Paging and Virtual Memory2.8 Intel 386 Segmentation2.9 Embedded Architectures3 Object Files3.1 What Goes Into an Object File?3.2 The Null Object Format: DOS COM Files3.3 Code Sections: UNIX a.out Files3.4 Relocation: DOS EXE Files3.5 Symbols and Relocation3.6 Relocatalble a.out3.7 UNIX ELF3.8 IBM 360 Object Format3.9 Microsoft Portable Executable Format3.10 Intel/Microsoft OMF Files3.11 Comparison of Object Formats4 Storage Allocation4.1 Segments and Addresses4.2 Simple Storage Layout4.3 Multiple-Sgement Types4.4 Segment and Page Alignment4.5 Common Blocks and Other Special Segments4.6 Linker Control Scripts4.7 Storage Allocation in Practice5 Symbol Management5.1 Binding and Name Resolution5.2 Symbol Table Formats5.3 Name Mangling5.4 Weak External and Other Kinds of Symbols5.5 Maintaining Debugging Information6 Libraries6.1 Purpose of Libraries6.2 Library Formats6.3 Craeting Libraries6.4 Searching Libraries6.5 Performance Issues6.6 Weak External Symbols7 Relocation7.1 Hardware and Software Relocation7.2 Link-Time and Load-Time Relocation7.3 Symbol and Segment Relocation7.4 Basic Relocation Techniques7.5 Relinkable and Relocatable Output Formats7.6 Other Relocation Formats7.7 Relocaton Special Cases8 Loading and Overlays8.1 Basic Loading8.2 Basic Loading, with Relocation8.3 Position-Independent Code8.4 Bootstrap Loading8.5 Tree-Structured Overlays9 Shared Libraries9.1 Binding Time9.2 Shared Libraries in Practice9.3 Address Space Management9.4 Structure of Shared Libraries9.5 Creating Shared Libraries9.6 Limking With Shared Libraries9.7 Running With Shared Libraries9.8 The malloc Hack and Other Shared-Library Problems10 Dynamic Linking and Loading10.1 ELF Dynamic Linking10.2 Contents of an ELF File10.3 Loading a Dynamically Linked Program10.4 Lazy Procedure Linking with the PLT10.5 Other Peculiarities of Dynamic Linking10.6 Dynamic Loading of Run Time10.7 Microsoft Dynamic-Link Libraries10.8 OSF/1 Pseiudo-Static Shared Libraries10.9 Making Shared Libraries Fast10.10 Comparison of Dynamic Linking Approaches11 - Advanced Techniques11.1 Techniques for C++11.2 Incremental Linking and Relinking11.3 Link-Time Garbage Collection11.4 Link-Time Optimization11.5 Link-Time Code Generation11.6 The Java Linking Model