Node:Top, Next:Overview, Up:(dir)

## Using ld

This file documents the GNU linker ld version 2.13.2.1.

This document is distributed under the terms of the GNU Free Documentation License. A copy of the license is included in the section entitled "GNU Free Documentation License".

Node:Index, Previous:GNU Free Documentation License, Up:Top

## Index

- `"`: Symbols
- `-(`: Options
- `--add-stdcall-alias`: Options
- `--allow-multiple-definition`: Options
- `--allow-shlib-undefined`: Options
- `--architecture=`arch``: Options
- `--auxiliary`: Options
- `--base-file`: Options
- `--check-sections`: Options
- `--cref`: Options
- `--defsym` symbol`=`exp``: Options
- `--demangle[=`style`]`: Options
- `--disable-auto-image-base`: Options
- `--disable-auto-import`: Options
- `--disable-new-dtags`: Options
- `--disable-stdcall-fixup`: Options
- `--discard-all`: Options
- `--discard-locals`: Options
- `--dll`: Options
- `--dll-search-prefix`: Options
- `--dynamic-linker` file``: Options
- `--embedded-relocs`: Options
- `--emit-relocs`: Options
- `--enable-auto-image-base`: Options
- `--enable-auto-import`: Options
- `--enable-extra-pe-debug`: Options
- `--enable-new-dtags`: Options
- `--enable-stdcall-fixup`: Options
- `--entry=`entry``: Options
- `--exclude-libs`: Options
- `--exclude-symbols`: Options
- `--export-all-symbols`: Options
- `--export-dynamic`: Options
- `--fatal-warnings`: Options
- `--file-alignment`: Options
- `--filter`: Options
- `--force-exe-suffix`: Options
- `--format=`format``: Options
- `--format=`version``: TI COFF
- `--gc-sections`: Options
- `--gpsize`: Options
- `--heap`: Options
- `--help`: Options
- `--image-base`: Options
- `--just-symbols=`file``: Options
- `--kill-at`: Options
- `--library-path=`dir``: Options
- `--library=`archive``: Options
- `--major-image-version`: Options
- `--major-os-version`: Options
- `--major-subsystem-version`: Options
- `--minor-image-version`: Options
- `--minor-os-version`: Options
- `--minor-subsystem-version`: Options
- `--mri-script=`MRI-cmdfile``: Options
- `--multi-subspace`: HPPA ELF32
- `--nmagic`: Options
- `--no-check-sections`: Options
- `--no-define-common`: Options
- `--no-demangle`: Options
- `--no-gc-sections`: Options
- `--no-keep-memory`: Options
- `--no-undefined`: Options
- `--no-undefined-version`: Options
- `--no-warn-mismatch`: Options
- `--no-whole-archive`: Options
- `--noinhibit-exec`: Options
- `--oformat`: Options
- `--omagic`: Options
- `--out-implib`: Options
- `--output-def`: Options
- `--output=`output``: Options
- `--print-map`: Options
- `--relax`: Options
- `--relax` on i960: i960
- `--relocateable`: Options
- `--script=`script``: Options
- `--section-alignment`: Options
- `--section-start` sectionname`=`org``: Options
- `--sort-common`: Options
- `--split-by-file`: Options
- `--split-by-reloc`: Options
- `--stack`: Options
- `--stats`: Options
- `--strip-all`: Options
- `--strip-debug`: Options
- `--stub-group-size=`N``: HPPA ELF32
- `--subsystem`: Options
- `--support-old-code`: ARM
- `--target-help`: Options
- `--thumb-entry=`entry``: ARM
- `--trace`: Options
- `--trace-symbol=`symbol``: Options
- `--traditional-format`: Options
- `--undefined=`symbol``: Options
- `--unique[=`SECTION`]`: Options
- `--verbose`: Options
- `--version`: Options
- `--version-script=`version-scriptfile``: Options
- `--warn-common`: Options
- `--warn-constructors`: Options
- `--warn-multiple-gp`: Options
- `--warn-once`: Options
- `--warn-section-align`: Options
- `--whole-archive`: Options
- `--wrap`: Options
- `-A` arch``: Options
- `-a` keyword``: Options
- `-assert` keyword``: Options
- `-b` format``: Options
- `-Bdynamic`: Options
- `-Bgroup`: Options
- `-Bshareable`: Options
- `-Bstatic`: Options
- `-Bsymbolic`: Options
- `-c` MRI-cmdfile``: Options
- `-call_shared`: Options
- `-d`: Options
- `-dc`: Options
- `-dn`: Options
- `-dp`: Options
- `-dy`: Options
- `-E`: Options
- `-e` entry``: Options
- `-EB`: Options
- `-EL`: Options
- `-f`: Options
- `-F`: Options
- `-fini`: Options
- `-g`: Options
- `-G`: Options
- `-h` name``: Options
- `-i`: Options
- `-I` file``: Options
- `-init`: Options
- `-l` archive``: Options
- `-L` dir``: Options
- `-M`: Options
- `-m` emulation``: Options
- `-Map`: Options
- `-n`: Options
- `-N`: Options
- `-non_shared`: Options
- `-nostdlib`: Options
- `-O` level``: Options
- `-o` output``: Options
- `-q`: Options
- `-qmagic`: Options
- `-Qy`: Options
- `-r`: Options
- `-R` file``: Options
- `-rpath`: Options
- `-rpath-link`: Options
- `-s`: Options
- `-S`: Options
- `-shared`: Options
- `-soname=`name``: Options
- `-static`: Options
- `-t`: Options
- `-T` script``: Options
- `-Tbss` org``: Options
- `-Tdata` org``: Options
- `-Ttext` org``: Options
- `-u` symbol``: Options
- `-Ur`: Options
- `-v`: Options
- `-V`: Options
- `-x`: Options
- `-X`: Options
- `-Y` path``: Options
- `-y` symbol``: Options
- `-z defs`: Options
- `-z` keyword``: Options
- `-z muldefs`: Options
- `.`: Location Counter
- /DISCARD/: Output Section Discarding
- `:`phdr``: Output Section Phdr
- `=`fillexp``: Output Section Fill
- `>`region``: Output Section Region
- [COMMON]: Input Section Common
- `ABSOLUTE` (MRI): MRI
- absolute and relocatable symbols: Expression Section
- absolute expressions: Expression Section
- `ABSOLUTE(`exp`)`: Builtin Functions
- `ADDR(`section`)`: Builtin Functions
- address, section: Output Section Address
- `ALIAS` (MRI): MRI
- `ALIGN` (MRI): MRI
- align location counter: Builtin Functions
- `ALIGN(`exp`)`: Builtin Functions
- allocating memory: MEMORY
- architecture: Miscellaneous Commands
- architectures: Options
- archive files, from cmd line: Options
- archive search path in linker script: File Commands
- arithmetic: Expressions
- arithmetic operators: Operators
- ARM interworking support: ARM
- `ASSERT`: Miscellaneous Commands
- assertion in linker script: Miscellaneous Commands
- assignment in scripts: Assignments
- `AT(`lma`)`: Output Section LMA
- `AT>`lma_region``: Output Section LMA
- back end: BFD
- `BASE` (MRI): MRI
- BFD canonical format: Canonical format
- BFD requirements: BFD
- big-endian objects: Options
- binary input format: Options
- `BLOCK(`exp`)`: Builtin Functions
- bug criteria: Bug Criteria
- bug reports: Bug Reporting
- bugs in `ld`: Reporting Bugs
- `BYTE(`expression`)`: Output Section Data
- C++ constructors, arranging in link: Output Section Keywords
- `CHIP` (MRI): MRI
- `COLLECT_NO_DEMANGLE`: Environment
- combining symbols, warnings on: Options
- command files: Scripts
- command line: Options
- common allocation: Options
- common allocation in linker script: Miscellaneous Commands
- common symbol placement: Input Section Common
- compatibility, MRI: Options
- constants in linker scripts: Constants
- `CONSTRUCTORS`: Output Section Keywords
- constructors: Options
- constructors, arranging in link: Output Section Keywords
- crash of linker: Bug Criteria
- `CREATE_OBJECT_SYMBOLS`: Output Section Keywords
- cross reference table: Options
- cross references: Miscellaneous Commands
- current output location: Location Counter
- data: Output Section Data
- `DATA_SEGMENT_ALIGN(`maxpagesize`,` commonpagesize`)`: Builtin Functions
- `DATA_SEGMENT_END(`exp`)`: Builtin Functions
- dbx: Options
- DEF files, creating: Options
- default emulation: Environment
- default input format: Environment
- `DEFINED(`symbol`)`: Builtin Functions
- deleting local symbols: Options
- demangling, default: Environment
- demangling, from command line: Options
- discarding sections: Output Section Discarding
- discontinuous memory: MEMORY
- DLLs, creating: Options
- DLLs, linking to: Options
- dot: Location Counter
- dot inside sections: Location Counter
- dynamic linker, from command line: Options
- dynamic symbol table: Options
- ELF program headers: PHDRS
- emulation: Options
- emulation, default: Environment
- `END` (MRI): MRI
- endianness: Options
- entry point: Entry Point
- entry point, from command line: Options
- entry point, thumb: ARM
- `ENTRY(`symbol`)`: Entry Point
- error on valid input: Bug Criteria
- example of linker script: Simple Example
- expression evaluation order: Evaluation
- expression sections: Expression Section
- expression, absolute: Builtin Functions
- expressions: Expressions
- `EXTERN`: Miscellaneous Commands
- fatal signal: Bug Criteria
- file name wildcard patterns: Input Section Wildcards
- `FILEHDR`: PHDRS
- filename symbols: Output Section Keywords
- fill pattern, entire section: Output Section Fill
- `FILL(`expression`)`: Output Section Data
- finalization function: Options
- first input file: File Commands
- first instruction: Entry Point
- `FORCE_COMMON_ALLOCATION`: Miscellaneous Commands
- `FORMAT` (MRI): MRI
- functions in expressions: Builtin Functions
- garbage collection: Input Section Keep, Options
- generating optimized output: Options
- GNU Free Documentation License: GNU Free Documentation License
- GNU linker: Overview
- `GNUTARGET`: Environment
- `GROUP(`files`)`: File Commands
- grouping input files: File Commands
- groups of archives: Options
- H8/300 support: H8/300
- header size: Builtin Functions
- heap size: Options
- help: Options
- holes: Location Counter
- holes, filling: Output Section Data
- HPPA multiple sub-space stubs: HPPA ELF32
- HPPA stub grouping: HPPA ELF32
- i960 support: i960
- image base: Options
- implicit linker scripts: Implicit Linker Scripts
- `INCLUDE` filename``: File Commands
- including a linker script: File Commands
- including an entire archive: Options
- incremental link: Options
- `INHIBIT_COMMON_ALLOCATION`: Miscellaneous Commands
- initialization function: Options
- initialized data in ROM: Output Section LMA
- input file format in linker script: Format Commands
- input filename symbols: Output Section Keywords
- input files in linker scripts: File Commands
- input files, displaying: Options
- input format: Options
- input object files in linker scripts: File Commands
- input section basics: Input Section Basics
- input section wildcards: Input Section Wildcards
- input sections: Input Section
- `INPUT(`files`)`: File Commands
- integer notation: Constants
- integer suffixes: Constants
- internal object-file format: Canonical format
- invalid input: Bug Criteria
- K and M integer suffixes: Constants
- KEEP: Input Section Keep
- `l =`: MEMORY
- L, deleting symbols beginning: Options
- lazy evaluation: Evaluation
- `ld` bugs, reporting: Bug Reporting
- `LDEMULATION`: Environment
- `len =`: MEMORY
- `LENGTH =`: MEMORY
- library search path in linker script: File Commands
- link map: Options
- link-time runtime library search path: Options
- linker crash: Bug Criteria
- linker script concepts: Basic Script Concepts
- linker script example: Simple Example
- linker script file commands: File Commands
- linker script format: Script Format
- linker script input object files: File Commands
- linker script simple commands: Simple Commands
- linker scripts: Scripts
- `LIST` (MRI): MRI
- little-endian objects: Options
- `LOAD` (MRI): MRI
- load address: Output Section LMA
- `LOADADDR(`section`)`: Builtin Functions
- loading, preventing: Output Section Type
- local symbols, deleting: Options
- location counter: Location Counter
- `LONG(`expression`)`: Output Section Data
- M and K integer suffixes: Constants
- machine architecture: Miscellaneous Commands
- machine dependencies: Machine Dependent
- mapping input sections to output sections: Input Section
- `MAX`: Builtin Functions
- `MEMORY`: MEMORY
- memory region attributes: MEMORY
- memory regions: MEMORY
- memory regions and sections: Output Section Region
- memory usage: Options
- `MIN`: Builtin Functions
- MIPS embedded PIC code: Options
- MRI compatibility: MRI
- `NAME` (MRI): MRI
- name, section: Output Section Name
- names: Symbols
- naming the output file: Options
- `NEXT(`exp`)`: Builtin Functions
- NMAGIC: Options
- `NOCROSSREFS(`sections`)`: Miscellaneous Commands
- `NOLOAD`: Output Section Type
- not enough room for program headers: Builtin Functions
- `o =`: MEMORY
- `objdump -i`: BFD
- object file management: BFD
- object files: Options
- object formats available: BFD
- object size: Options
- OMAGIC: Options
- opening object files: BFD outline
- operators for arithmetic: Operators
- options: Options
- `ORDER` (MRI): MRI
- `org =`: MEMORY
- `ORIGIN =`: MEMORY
- output file after errors: Options
- output file format in linker script: Format Commands
- output file name in linker scripot: File Commands
- output section attributes: Output Section Attributes
- output section data: Output Section Data
- `OUTPUT(`filename`)`: File Commands
- `OUTPUT_ARCH(`bfdarch`)`: Miscellaneous Commands
- `OUTPUT_FORMAT(`bfdname`)`: Format Commands
- `OVERLAY`: Overlay Description
- overlays: Overlay Description
- partial link: Options
- `PHDRS`: PHDRS
- precedence in expressions: Operators
- prevent unnecessary loading: Output Section Type
- program headers: PHDRS
- program headers and sections: Output Section Phdr
- program headers, not enough room: Builtin Functions
- program segments: PHDRS
- PROVIDE: PROVIDE
- `PUBLIC` (MRI): MRI
- `QUAD(`expression`)`: Output Section Data
- quoted symbol names: Symbols
- read-only text: Options
- read/write from cmd line: Options
- regions of memory: MEMORY
- relative expressions: Expression Section
- relaxing addressing modes: Options
- relaxing on H8/300: H8/300
- relaxing on i960: i960
- relocatable and absolute symbols: Expression Section
- relocatable output: Options
- removing sections: Output Section Discarding
- reporting bugs in `ld`: Reporting Bugs
- requirements for BFD: BFD
- retain relocations in final executable: Options
- retaining specified symbols: Options
- ROM initialized data: Output Section LMA
- round up location counter: Builtin Functions
- runtime library name: Options
- runtime library search path: Options
- scaled integers: Constants
- scommon section: Input Section Common
- script files: Options
- scripts: Scripts
- search directory, from cmd line: Options
- search path in linker script: File Commands
- `SEARCH_DIR(`path`)`: File Commands
- `SECT` (MRI): MRI
- section address: Output Section Address
- section address in expression: Builtin Functions
- section alignment, warnings on: Options
- section data: Output Section Data
- section fill pattern: Output Section Fill
- section load address: Output Section LMA
- section load address in expression: Builtin Functions
- section name: Output Section Name
- section name wildcard patterns: Input Section Wildcards
- section size: Builtin Functions
- section, assigning to memory region: Output Section Region
- section, assigning to program header: Output Section Phdr
- `SECTIONS`: SECTIONS
- sections, discarding: Output Section Discarding
- segment origins, cmd line: Options
- segments, ELF: PHDRS
- shared libraries: Options
- `SHORT(`expression`)`: Output Section Data
- `SIZEOF(`section`)`: Builtin Functions
- `SIZEOF_HEADERS`: Builtin Functions
- small common symbols: Input Section Common
- SORT: Input Section Wildcards
- `SQUAD(`expression`)`: Output Section Data
- stack size: Options
- standard Unix system: Options
- start of execution: Entry Point
- `STARTUP(`filename`)`: File Commands
- strip all symbols: Options
- strip debugger symbols: Options
- stripping all but some symbols: Options
- suffixes for integers: Constants
- symbol defaults: Builtin Functions
- symbol definition, scripts: Assignments
- symbol names: Symbols
- symbol tracing: Options
- symbol versions: VERSION
- symbol-only input: Options
- symbols, from command line: Options
- symbols, relocatable and absolute: Expression Section
- symbols, retaining selectively: Options
- synthesizing linker: Options
- synthesizing on H8/300: H8/300
- `TARGET(`bfdname`)`: Format Commands
- thumb entry point: ARM
- TI COFF versions: TI COFF
- traditional format: Options
- unallocated address, next: Builtin Functions
- undefined symbol: Options
- undefined symbol in linker script: Miscellaneous Commands
- undefined symbols, warnings on: Options
- uninitialized data placement: Input Section Common
- unspecified memory: Output Section Data
- usage: Options
- variables, defining: Assignments
- verbose: Options
- version: Options
- version script: VERSION
- version script, symbol versions: Options
- `VERSION {script text}`: VERSION
- versions of symbols: VERSION
- warnings, on combining symbols: Options
- warnings, on section alignment: Options
- warnings, on undefined symbols: Options
- what is this?: Overview
- wildcard file name patterns: Input Section Wildcards

## Table of Contents

- Using ld
- Overview
- Invocation
  - Command Line Options
    - Options specific to i386 PE targets
  - Environment Variables
- Linker Scripts
  - Basic Linker Script Concepts
  - Linker Script Format
  - Simple Linker Script Example
  - Simple Linker Script Commands
    - Setting the entry point
    - Commands dealing with files
    - Commands dealing with object file formats
    - Other linker script commands
  - Assigning Values to Symbols
    - Simple Assignments
    - PROVIDE
  - SECTIONS command
    - Output section description
    - Output section name
    - Output section address
    - Input section description
      - Input section basics
      - Input section wildcard patterns
      - Input section for common symbols
      - Input section and garbage collection
      - Input section example
    - Output section data
    - Output section keywords
    - Output section discarding
    - Output section attributes
      - Output section type
      - Output section LMA
      - Output section region
      - Output section phdr
      - Output section fill
    - Overlay description
  - MEMORY command
  - PHDRS Command
  - VERSION Command
  - Expressions in Linker Scripts
    - Constants
    - Symbol Names
    - The Location Counter
    - Operators
    - Evaluation
    - The Section of an Expression
    - Builtin Functions
  - Implicit Linker Scripts
- Machine Dependent Features
  - `ld` and the H8/300
  - `ld` and the Intel 960 family
  - `ld`'s support for interworking between ARM and Thumb code
  - `ld` and HPPA 32-bit ELF support
  - `ld` and MMIX
  - `ld`'s support for various TI COFF versions
- BFD
  - How it works: an outline of BFD
    - Information Loss
    - The BFD canonical object-file format
- Reporting Bugs
  - Have you found a bug?
  - How to report bugs
- MRI Compatible Script Files
- GNU Free Documentation License
- Index