About this Manual
Audience
Necessity
Organization
Related Documents
Reader's Comments
Conventions
 
1    Introduction
1.1    Definitions
1.2    History and Applicability
1.3    Producers and Consumers
1.3.1    Compilers
1.3.2    Assemblers
1.3.3    Linkers
1.3.4    Loaders
1.3.5    Debuggers
1.3.6    Object Instrumentation Tools
1.3.6.1    Post-Link Optimizers
1.3.6.2    Profiling Tools
1.3.7    Archivers
1.3.8    Miscellaneous Object Tools
1.3.8.1    Object Dumpers
1.3.8.2    Object Manipulators
1.4    Object File Overview
1.4.1    Main Components of Object Files
1.4.1.1    Object File Headers
1.4.1.2    Instructions and Data
1.4.1.3    Object File Relocation Information
1.4.1.4    Symbol Table
1.4.1.5    Dynamic Loading Information
1.4.1.6    Comment Section
1.4.2    Kinds of Object Files
1.4.3    Object File Compression
1.4.4    Object Archives
1.4.5    Object File Versioning
1.4.6    Object File Abstract Data Types
1.5    Source Language Support
1.6    System Dependencies
1.7    Architectural Dependencies
1.8    Relevant Header Files
 
2    Headers
2.1    New or Changed Header Features
2.2    Structures, Fields, and Values for Headers
2.2.1    File Header (filehdr.h)
2.2.2    a.out Header (aouthdr.h)
2.2.3    Section Headers (scnhdr.h)
2.3    Header Usage
2.3.1    Object Recognition
2.3.2    Image Layout
2.3.2.1    OMAGIC
2.3.2.2    NMAGIC
2.3.2.3    ZMAGIC
2.3.3    Address Space
2.3.3.1    Address Selection
2.3.3.2    TASO Address Space
2.3.4    GP (Global Pointer) Ranges
2.3.5    Alignment
2.3.6    Section Types
2.3.7    Special Symbols
2.3.7.1    Accessing
2.4    Language-Specific Header Features
 
3    Instructions and Data
3.1    New or Changed Instructions and Data Features
3.2    Structures, Fields, and Values for Instructions and Data
3.2.1    Code Range Descriptor (pdsc.h)
3.2.2    Run-time Procedure Descriptor (pdsc.h)
3.3    Instructions and Data Usage
3.3.1    Minimal Objects
3.3.2    Position-Independent Code (PIC)
3.3.3    Lazy-Text Stubs
3.3.4    Constant Data
3.3.5    INIT/FINI Driver Routines
3.3.5.1    Linking
3.3.5.2    Execution Order
3.3.5.2.1    Dynamic Executables
3.3.5.2.2    Static Executables
3.3.5.2.3    Ordering Within Objects
3.3.5.2.4    Subsystem Control of INIT/FINI Order
3.3.6    Initialized Data and Zero-Initialized Data (bss)
3.3.7    Permissions/Protections
3.3.8    Exception Handling Data
3.3.9    Thread Local Storage (TLS) Data
3.3.10    User Text and User Data Sections
3.4    Language-Specific Instructions and Data Features
 
4    Relocation
4.1    New or Changed Relocations Features
4.2    Structures, Fields, and Values for Relocations
4.2.1    Relocation Entry (reloc.h)
4.2.2    Compact Relocation Subsection (of .comment section)
4.2.3    Section Header
4.3    Relocations Usage
4.3.1    Relocatable Objects
4.3.2    Relocation Processing
4.3.2.1    Local and External Entries
4.3.2.2    Relocation Entry Ordering
4.3.2.3    Shared Object Transformation
4.3.3    Kinds of Relocations
4.3.3.1    Direct Relocations
4.3.3.2    GP-Relative Relocations
4.3.3.3    Self-Relative (PC-Relative) Relocations
4.3.3.4    Literal Relocations
4.3.3.5    Relocation Stack Expressions
4.3.3.6    Immediate Relocations
4.3.3.7    TLS Relocations
4.3.4    Relocation Entry Types
4.3.4.1    R_ABS
4.3.4.2    R_REFLONG
4.3.4.3    R_REFQUAD
4.3.4.4    R_GPREL32
4.3.4.5    R_LITERAL
4.3.4.6    R_LITUSE: R_LU_BASE
4.3.4.7    R_LITUSE: R_LU_JSR
4.3.4.8    R_GPDISP
4.3.4.9    R_BRADDR
4.3.4.10    R_HINT
4.3.4.11    R_SREL16
4.3.4.12    R_SREL32
4.3.4.13    R_SREL64
4.3.4.14    R_OP_PUSH
4.3.4.15    R_OP_STORE
4.3.4.16    R_OP_PSUB
4.3.4.17    R_OP_PRSHIFT
4.3.4.18    R_GPVALUE
4.3.4.19    R_GPRELHIGH
4.3.4.20    R_GPRELLOW
4.3.4.21    R_IMMED: GP16
4.3.4.22    R_IMMED: GP_HI32
4.3.4.23    R_IMMED: SCN_HI32
4.3.4.24    R_IMMED: BR_HI32
4.3.4.25    R_IMMED: LO32
4.3.4.26    R_TLS_LITERAL
4.3.4.27    R_TLS_HIGH
4.3.4.28    R_TLS_LOW
4.4    Compact Relocations
4.4.1    Overview
4.4.2    File Format
4.4.2.1    Compact Relocations Version
4.4.2.2    Compact Relocations File Header
4.4.2.3    Compact Relocations Section Header
4.4.2.4    Compact Relocations Table
4.4.2.5    Stack Relocation Table
4.4.2.6    GP Value Tables
4.4.3    Detailed Algorithm for Compact Relocations Production
4.4.4    Detailed Algorithm for Compact Relocations Consumption
4.5    Language-Specific Relocations Features
 
5    Symbol Table (V3.13)
5.1    New or Changed Symbol Table Features
5.2    Structures, Fields and Values for Symbol Tables
5.2.1    Symbolic Header (HDRR)
5.2.2    File Descriptor Entry (FDR)
5.2.3    Procedure Descriptor Entry (PDR)
5.2.4    Line Number Entry (LINER)
5.2.5    Local Symbol Entry (SYMR)
5.2.6    External Symbol Entry (EXTR)
5.2.7    Relative File Descriptor Entry (RFDT)
5.2.8    Auxiliary Symbol Table Entry (AUXU)
5.2.8.1    Type Information Record (TIR)
5.2.8.2    Relative Symbol Record (RNDXR)
5.2.9    String Table
5.2.10    Optimization Symbol Entry (PPODHDR)
5.2.11    Symbol Type and Class (st/sc) Combinations
5.3    Symbol Table Usage
5.3.1    Levels of Symbolic Information
5.3.1.1    Compilation Levels
5.3.1.2    Locally Stripped Images
5.3.1.3    (Fully) Stripped Images
5.3.2    Source Information
5.3.2.1    Source Files
5.3.2.2    Line Number Information
5.3.2.2.1    The Line Number Table
5.3.2.2.2    Extended Source Location Information (ESLI)
5.3.3    Optimization Symbols
5.3.4    Run-Time Information
5.3.4.1    Stack Frames
5.3.4.2    Procedure Addresses
5.3.4.3    Local Symbol Addresses
5.3.4.4    Uplevel Links
5.3.4.5    Finding Thread Local Storage (TLS) Symbols
5.3.5    Profile Feedback Data
5.3.6    Scopes
5.3.6.1    Procedure Scope
5.3.6.2    File Scope
5.3.6.3    Block Scope
5.3.6.4    Namespaces (C++)
5.3.6.4.1    Namespace Components
5.3.6.4.2    Namespace Aliases
5.3.6.4.3    Unnamed Namespace
5.3.6.4.4    Usage of Namespaces
5.3.6.5    Exception Handling Blocks (C++)
5.3.6.6    Common Blocks (Fortran)
5.3.6.7    Alternate Entry Points
5.3.7    Data Types in the Symbol Table
5.3.7.1    Basic Types
5.3.7.2    Type Qualifiers
5.3.7.3    Interpreting Type Descriptions in the Auxiliary Table
5.3.8    Individual Type Representations
5.3.8.1    Pointer Type
5.3.8.2    Array Type
5.3.8.3    Structure, Union, and Enumerated Types
5.3.8.4    Typedef Type
5.3.8.5    Function Pointer Type
5.3.8.6    Class Type (C++)
5.3.8.6.1    Empty Class or Structure (C++)
5.3.8.6.2    Base and Derived Classes (C++)
5.3.8.7    Template Type (C++)
5.3.8.8    Interlude Type (C++)
5.3.8.9    Array Descriptor Type (Fortran90)
5.3.8.10    Conformant Array Type (Pascal)
5.3.8.11    Variant Record Type (Pascal and Ada)
5.3.8.12    Subrange Type (Pascal and Ada)
5.3.8.13    Set Type (Pascal)
5.3.9    Special Debug Symbols
5.3.10    Symbol Resolution
5.3.10.1    Library Search
5.3.10.2    Resolution of Symbols with Common Storage Class
5.3.10.3    Mangling and Demangling
5.3.10.4    Mixed Language Resolution
5.3.10.5    TLS Symbols
5.4    Language-Specific Symbol Table Features
5.4.1    Fortran77 and Fortran90
5.4.2    C++
5.4.3    Pascal and Ada
 
6    Dynamic Loading Information
6.1    New or Changed Dynamic Loading Information Features
6.2    Structures, Fields, and Values for Dynamic Loading Information
6.2.1    Dynamic Header Entry
6.2.2    Dynamic Symbol Entry
6.2.3    Dynamic Relocation Entry
6.2.4    Msym Table Entry
6.2.5    Library List Entry
6.2.6    Conflict Entry
6.2.7    GOT Entry
6.2.8    Hash Table Entry
6.2.9    Dynamic String Table
6.3    Dynamic Loading Information Usage
6.3.1    Shared Object Identification
6.3.2    Shared Library Dependencies
6.3.2.1    Identification
6.3.2.2    Searching
6.3.2.3    Validation
6.3.2.3.1    Backward Compatibility
6.3.2.4    Loading
6.3.2.4.1    Dynamic Loading and Unloading
6.3.3    Dynamic Symbol Information
6.3.3.1    Symbol Look-Up
6.3.3.2    Scope and Binding
6.3.3.3    Multiple GOT Representation
6.3.3.4    Msym Table
6.3.3.5    Hash Table
6.3.4    Dynamic Symbol Resolution
6.3.4.1    Symbol Preemption and Namespace Pollution
6.3.4.2    Weak Symbols
6.3.4.3    Search Order
6.3.4.4    Precedence
6.3.4.5    Lazy Text Resolution
6.3.4.6    Levels of Resolution
6.3.5    Dynamic Relocation
6.3.6    Quickstart
6.3.6.1    Quickstart Levels
6.3.6.2    Conflict Table
6.3.6.3    Repairing Quickstart
 
7    Comment Section
7.1    New and Changed Comment Section Features
7.2    Structures, Fields, and Values of the Comment Section
7.2.1    Subsection Headers
7.2.2    Tag Descriptor Entry
7.2.2.1    Comment Section Flags
7.3    Comment Section Usage
7.3.1    Comment Section Formatting Requirements
7.3.2    Comment Section Contents
7.3.3    Comment Section Processing
7.3.4    Special Comment Subsections
7.3.4.1    Tag Descriptors (CM_TAGDESC)
7.3.4.2    Tool Version Information (CM_TOOLVER)
 
8    Archives
8.1    Structures, Fields, and Values for Archives
8.1.1    Archive Magic String
8.1.2    Archive Header
8.1.3    Hash Table (ranlib) Structure
8.2    Archive Implementation
8.2.1    Archive File Format
8.2.2    Symdef File Implementation
8.3    Archive Usage
8.3.1    Role As Libraries
8.3.2    Portability
 
9    Examples
9.1    C
9.1.1    Unnamed Structure
9.2    C++
9.2.1    Base and Derived Classes
9.2.2    Virtual Function Tables and Interludes
9.2.3    Namespace Definitions and Uses
9.2.4    Unnamed Namespaces
9.2.5    Namespace Aliases
9.2.6    Exception-Handling
9.3    Fortran
9.3.1    Common Data
9.3.2    Alternate Entry Points
9.3.3    Array Descriptors
9.4    Pascal
9.4.1    Sets
9.4.2    Subranges
9.4.3    Variant Records
 
Figures
1-1    Object File Producers and Consumers
1-2    Object File Contents
1-3    Object File Compression
1-4    LEB 128 Byte
1-5    LEB 128 Multi-Byte Data
1-6    Little Endian Byte Ordering
2-1    OMAGIC Layout
2-2    NMAGIC Layout
2-3    ZMAGIC Layout for Shared Object
2-4    ZMAGIC Layout for Static Executable Objects
2-5    Address Space Layout
2-6    TASO Address Space Layout
2-7    GP (Global Pointer) Ranges
3-1    Raw Data Sections of an Object File
3-2    INIT/FINI Routines in Shared Objects
3-3    INIT/FINI Recognition in Archive Libraries
3-4    INIT/FINI Example (I)
3-5    INIT/FINI Example (II)
3-6    INIT/FINI Example (III)
3-7    INIT/FINI Example (IV)
3-8    Data and Bss Segment Layout (1)
3-9    Data and Bss Segment Layout (II)
3-10    Exception-Handling Data Structuers
3-11    Thread Local Storage Data Structures
4-1    Kinds of Relocations
4-2    Section Relocation Information in an Object File
4-3    Relocation Entry
4-4    External Relocation Entry
4-5    Processing an External Relocation Entry
4-6    Local Relocation Entry
4-7    Processing a Local Relocation Entry
4-8    Relocation Entry Ordering Requirements
5-1    Symbol Table Sections
5-2    Symbol Table Hierarchy
5-3    st/sc Combination Matrix
5-4    Relative File Descriptor Table Example
5-5    Line Number Table
5-6    Line Number Byte Format
5-7    Line Number 3-Byte Extended Format
5-8    ESLI Data Mode Bytes
5-9    ESLI Command Byte
5-10    Optimization Symbols Section
5-11    Fixed-Size Stack Frame
5-12    Variable-Size Stack Frame
5-13    Representation of Uplevel Reference
5-14    Basic Scopes
5-15    Procedure Representation
5-16    Procedure with No Text
5-17    File Representation
5-18    Block Representation
5-19    C++ Namespace Representation
5-20    C++ Exception Handler Representation
5-21    Fortran Common Block Representation
5-22    Alternate Entry Point Representation
5-23    Auxiliary Table Interpretation
5-24    Auxiliary Table "ti" Interpretation
5-25    Auxiliary Table "bt vals" Interpretation
5-26    Auxiliary Table "arrays" Interpretation
5-27    Auxiliary Table "range" Interpretation
5-28    Auxiliary Table "rndx" Interpretation
5-29    Pointer Representation
5-30    Array Representation
5-31    64-Bit Array Representation
5-33    Structure Representation
5-34    Recursive Structure Representation
5-35    Nested Structure Representation
5-36    Typedef Representation
5-37    Function Pointer Representation
5-38    Class Representation
5-39    Empty Class or Structure (C++)
5-40    Base Class Representation
5-41    Interlude Representation
5-42    Array Descriptor Representation (I)
5-43    Array Descriptor Representation (II)
5-44    Variant Record Representation
5-45    Variant Record Representation (pre-V3.13)
5-46    Subrange Representation
5-47    64-bit Range Representation
5-48    Set Representation
6-1    Dynamic Object File Sections
6-2    Shared Library Dependencies
6-3    Valid Shared Library with Multiple Versions
6-4    Invalid Shared Library with Multiple Versions
6-5    Dynamic Symbol Table and Multiple-GOT
6-6    Msym Table
6-7    Hash Table
6-8    Hashing Example
6-9    Namespace Pollution
6-10    Weak Symbol Resolution (I)
6-11    Weak Symbol Resolution (II)
6-12    Symbol Resolution Search Order
6-13    Conflict Entry Example
7-1    Comment Section Data Organization
8-1    Archive File Organization
8-2    Symdef File Hash Table
 
Tables
1-1    COFF Basic Abstract Types
2-1    File Header Magic Numbers
2-2    File Header Flags
2-3    a.out Header Magic Numbers
2-4    Section Header Constants for Section Names
2-5    Section Flags (s_flags field)
2-6    Special Symbols
3-1    Segment Access Permissions
4-1    Section Numbers for Local Relocation Entries
4-2    Relocation Types
4-3    Literal Usage Types
4-4    Immediate Relocation Types
5-1    Source Language (lang) Constants
5-2    Symbol Type (st) Constants
5-3    Storage Class (sc) Constants
5-4    Basic Type (bt) Constants
5-5    Type Qualifier (tq) Constants
5-6    Optimization Tag Values
5-7    Valid Placement for st/sc Combinations
5-8    Symbol Table Sections Produced at Various Compilation Levels
5-9    Line Number Example
5-10    ESLI Commands
5-11    ESLI Example
5-12    Symbol Table Entries with Associated Auxiliary Table Type Descriptions
6-1    Dynamic Array Tags (d_tag)
6-2    DT_FLAGS Flags
6-3    Dynamic Symbol Type (st_info) Constants
6-4    Dynamic Symbol Binding (st_info) Constants
6-5    Dynamic Section Index (st_shndx) Constants
6-6    Library List Flags
6-7    Dynamic Symbol Categories
7-1    Comment Section Tag Values
7-2    Strip Flags
7-3    Combine Flags
7-4    Modify Flags
7-5    Default System Tag Flags
8-1    Archive Magic Strings
 
Index