Creating and Using Shared Libraries on Linux course outline
- Course Introduction
- Fundamentals of Shared Libraries
- Background
- The static linker and the dynamic linker
- Static vs shared libraries
- Basics of shared library creation and use
- Position-independent code (PIC)
- The shared library soname
- In pictures: library creation, linking, and loading
- Versioning and Installation
- Shared library versioning
- Shared library real names, sonames, and linker names
- Installing shared libraries
- ldconfig
- The Dynamic Linker
- Rpath: specifying library search paths in an object
- Dynamic string tokens
- Finding shared libraries at run time
- Symbol resolution and symbol interposition
- Link-map lists (namespaces)
- The global look-up scope
LD_DEBUG
: tracing the operation of the dynamic linker
- Shared Libraries and the Static Linker
- Recording dynamic dependencies
- Handling secondary dependencies at link time
- How the static linker finds library dependencies
- ELF and Program Execution
- ELF file layout
- The program header table (PHT)
- The section header table (SHT)
- Program header table vs section header table
- ELF sections
- Useful commands: readelf and objdump
- How programs get run
- Dynamically Loaded Libraries (dlopen)
- Opening a shared library: dlopen()
- Obtaining the address of a symbol: dlsym()
- The dlopen API: example
- The dlopen API: further details
- Symbol Visibility
- Symbol attributes: binding and visibility
- Controlling symbol visibility
- Controlling visibility on a per-symbol bases
- Controlling symbol visibility: dlopen()-ed libraries
- Using version scripts to control symbol visibility
- Look-up scopes
LD_DEBUG=scopes
- Preloading
- Preloading shared libraries
- Weak Symbols (*)
- Weak symbols
- Use cases for weak symbols
- Symbol Versioning
- Creating a symbol-versioned library
- ELF and symbol versioning
- Advantages of symbol versioning
- Further details on symbol versioning
- The library base version
- Symbol Versioning: Further Topics (*)
- Transitioning an existing library to symbol versioning
- Symbol versioning design approaches
- Symbol-version matching rules
- Addendum: a few C++ details
- Lazy Binding (*)
- GOTand PLT (*)
- The GOT and PLT
- Relocation and the PLT: in pictures
- Relocation and the PLT: code
- Observing the effect of lazy binding on the GOT
- Performance considerations
Return to the course overview