Scroll to navigation

GOLD(1) User Commands GOLD(1)

NAME

gold - The GNU ELF linker

SYNOPSIS

ld.gold [options] file...

OPTIONS

Report usage information
Report version information
Report version and target information
Not supported
Do not copy DT_NEEDED tags from shared libraries (default)

--allow-multiple-definition Allow multiple definitions of symbols

Do not allow multiple definitions (default)
Allow unresolved references in shared libraries
Do not allow unresolved references in shared libraries (default)
Apply link-time values for dynamic relocations (default)
(aarch64 only) Do not apply link-time values for dynamic relocations
Use DT_NEEDED only for shared libraries that are used
Use DT_NEEDED for all shared libraries (default)
Ignored
Set input format
Output BE8 format image
Generate build ID note
Chunk size for '--build-id=tree'
Minimum output file size for '--build-id=tree' to work differently than '--build-id=sha1'

-Bdynamic -l searches for shared libraries (default)

-Bstatic -l does not search for shared libraries

alias for -Bdynamic (default)
alias for -Bstatic
Use group name lookup rules for shared library
Generate shared library (alias for -G/-shared)
Don't bind default visibility defined symbols locally for -shared (default)
Bind default visibility defined function symbols locally for -shared
Bind default visibility defined symbols locally for -shared
Check segment addresses for overlaps (default)
Do not check segment addresses for overlaps
Compress .debug_* sections in the output file
Not supported

--no-copy-dt-needed-entries Do not copy DT_NEEDED tags from shared libraries (default)

Output cross reference table
Do not output cross reference table (default)
Use DT_INIT_ARRAY for all constructors (default)
Handle constructors as directed by compiler
Define common symbols
Do not define common symbols in relocatable output (default)
Alias for -d
Alias for -d
Turn on debugging
Define a symbol
Demangle C++ symbols in log messages
Do not demangle C++ symbols in log messages
Write a dependency file listing all files read
Look for violations of the C++ One Definition Rule
Do not look for violations of the C++ One Definition Rule (default)
Add data symbols to dynamic symbols
Add C++ operator new/delete to dynamic symbols

--dynamic-list-cpp-typeinfo Add C++ typeinfo to dynamic symbols

Read a list of dynamic symbols
(PowerPC only) Label linker stubs with a symbol (default)
(PowerPC only) Do not label linker stubs with a symbol

-e ADDRESS, --entry ADDRESS Set program start address

Create exception frame header
Do not create exception frame header (default)
Enable use of DT_RUNPATH (default)
Disable use of DT_RUNPATH
Put the linker version string into the .comment section
Put the linker version string into the .note.gnu.gold-version section (default)
(ARM only) Do not warn about objects with incompatible enum sizes
Exclude libraries from automatic export
Export all dynamic symbols
Do not export all dynamic symbols (default)
Export SYMBOL to dynamic symbol table
Link big-endian objects.
Link little-endian objects.

-f SHLIB, --auxiliary SHLIB Auxiliary filter for shared object symbol table

Filter for shared object symbol table
Treat warnings as errors
Do not treat warnings as errors (default)
Call SYMBOL at unload-time
(ARM only) Fix binaries for ARM1176 erratum (default)
(ARM only) Do not fix binaries for ARM1176 erratum
(ARM only) Fix binaries for Cortex-A8 erratum
(ARM only) Do not fix binaries for Cortex-A8 erratum (default)
(AArch64 only) Fix Cortex-A53 erratum 843419
(AArch64 only) Do not fix Cortex-A53 erratum 843419 (default)
(AArch64 only) Fix Cortex-A53 erratum 835769
(AArch64 only) Do not fix Cortex-A53 erratum 835769 (default)
(ARM only) Rewrite BX rn as MOV pc, rn for ARMv4
(ARM only) Rewrite BX rn branch to ARMv4 interworking veneer
Ignored for GCC linker option compatibility
Ignored
Remove unused sections
Don't remove unused sections (default)
Generate .gdb_index section
Do not generate .gdb_index section (default)
Enable STB_GNU_UNIQUE symbol binding (default)
Disable STB_GNU_UNIQUE symbol binding
Generate shared library
Set shared library name
Min fraction of empty buckets in dynamic hash
Dynamic hash style
Alias for -r
Identical Code Folding. '--icf=safe' Folds ctors, dtors and functions whose pointers are definitely not taken
Number of iterations of ICF (default 3)
Do an incremental link if possible; otherwise, do a full link and prepare output for incremental linking
Do a full link (default)
Do a full link and prepare output for incremental linking
Do an incremental link; exit if not possible
Set base file for incremental linking (default is output file)
Assume files changed
Assume files didn't change
Use timestamps to check files (default)
Assume startup files unchanged (files preceding this option)

--incremental-patch PERCENT Amount of extra space to allocate for patches (default 10)

Call SYMBOL at load-time
Set dynamic linker path
Read only symbol values from FILE
Keep files mapped across passes (default on 64bit architectures)
Release mapped files after each pass (default on 32bit architectures)
Do not fold this symbol during ICF
Search for library LIBNAME
Generate unwind information for PLT (default)
Do not generate unwind information for PLT
Add directory to search path
(ARM only) Generate long PLT entries
(ARM only) Do not generate long PLT entries (default)
Set GNU linker emulation; obsolete
Map whole files to memory (default on 64bit architectures)
Map relevant file parts to memory (default on 32bit architectures)
(ARM only) Merge exidx entries in debuginfo (default)
(ARM only) Do not merge exidx entries in debuginfo
Map the output file for writing (default)
Do not map the output file for writing
Write map file on standard output
Write map file
Do not page align data
Do not page align data, do not make text readonly
Page align data, make text readonly (default)
Use less memory and more disk I/O (included only for compatibility with GNU ld)
Report undefined symbols (even with --shared)
Create an output file even if errors occur
Only search directories specified on the command line
Set output file name
Set output format
Optimize output file size
Orphan section handling
Ignored for ARM compatibility
Generate package metadata note
Create a position independent executable
Do not create a position independent executable (default)
Create a position independent executable
Do not create a position independent executable (default)
Force PIC sequences for ARM/Thumb interworking veneers
(ARM only) Ignore for backward compatibility (default)
(PowerPC only) Align PLT call stubs to fit cache lines
(PowerPC64 only) Optimize calls to ELFv2 localentry:0 functions
(PowerPC64 only) Don't optimize ELFv2 calls (default)
(PowerPC64 only) PLT call stubs should load r11
(PowerPC64 only) PLT call stubs should not load r11 (default)
(PowerPC64 only) PLT call stubs with load-load barrier
(PowerPC64 only) PLT call stubs without barrier (default)
Load a plugin library
Pass an option to the plugin
Use posix_fallocate to reserve space in the output file (default)
Use fallocate or ftruncate to reserve space
(PowerPC64 only) stubs use power10 insns
(PowerPC64 only) stubs do not use power10 insns
Preread archive symbols when multi-threaded
List removed unused sections on stderr
Do not list removed unused sections (default)
List folded identical sections on stderr
Do not list folded identical sections (default)
Print default output format
Print symbols defined and used for each input
Save the state of flags related to input files
Restore the state of flags related to input files
Generate relocations in output
Ignored for SVR4 compatibility
Generate relocatable output
Relax branches on certain targets
Do not relax branches (default)
keep only symbols listed in this file
Put read-only non-executable sections in their own segment
Do not put read-only non-executable sections in their own segment (default)
Set offset between executable and read-only segments
Add DIR to runtime search path
Add DIR to runtime search path
Add DIR to link time shared library search path
Strip all symbols
Strip debugging information
Emit only debug line number information
Strip debug symbols that are unused by gdb (at least versions <= 7.4)
Strip LTO intermediate code sections (default)
Layout sections in the order specified
Set address of section
(PowerPC only) Use new-style PLT (default)
Sort common symbols by alignment
Sort sections by name. '--no-text-reorder' will override '--sort-section=name' for .text
Dynamic tag slots to reserve (default 5)
(ARM, PowerPC only) The maximum distance from instructions in a group of sections to their stubs. Negative values mean stubs are always after the group. 1 means use default size
(PowerPC only) Allow a group of stubs to serve multiple output sections (default)
(PowerPC only) Each output section has its own stubs
Stack size when -fsplit-stack function calls non-split
Do not link against shared libraries
Start a library
End a library
Print resource usage statistics
Set target system root directory
Print the name of each input file
(ARM only) Force R_ARM_TARGET1 type to R_ARM_ABS32
(ARM only) Force R_ARM_TARGET1 type to R_ARM_REL32
(ARM only) Set R_ARM_TARGET2 relocation type
Enable text section reordering for GCC section names (default)
Disable text section reordering for GCC section names
Run the linker multi-threaded
Do not run the linker multi-threaded (default)
Number of threads to use
Number of threads to use in initial pass

--thread-count-middle COUNT Number of threads to use in middle pass

Number of threads to use in final pass
(PowerPC/64 only) Optimize GD/LD/IE code to IE/LE (default)
(PowerPC/64 only) Don'''t try to optimize TLS accesses
(PowerPC/64 only) Use a special __tls_get_addr call (default)
(PowerPC/64 only) Don't use a special __tls_get_addr call
(PowerPC64 only) Optimize TOC code sequences (default)
(PowerPC64 only) Don't optimize TOC code sequences
(PowerPC64 only) Sort TOC and GOT sections (default)
(PowerPC64 only) Don't sort TOC and GOT sections
Read linker script
Set the address of the bss segment
Set the address of the data segment
Set the address of the text segment
Set the address of the text segment
Set the address of the rodata segment
Create undefined reference to SYMBOL
How to handle unresolved symbols
Alias for --debug=files
Read version script
Warn about duplicate common symbols
Do not warn about duplicate common symbols (default)
Ignored
Ignored
Warn when discarding version information
Do not warn when discarding version information (default)
Warn if the stack is executable
Do not warn if the stack is executable (default)
Don't warn about mismatched input files
Ignored
Warn when skipping an incompatible library (default)
Don't warn when skipping an incompatible library
Warn if text segment is not shareable
Do not warn if text segment is not shareable (default)
Report unresolved symbols as warnings
Report unresolved symbols as errors (default)
Dummy z option
(ARM only) Do not warn about objects with incompatible wchar_t sizes
Convert unresolved symbols to weak references
Include all archive contents
Include only needed archive contents (default)
Use wrapper functions for SYMBOL
Delete all local symbols
Delete all temporary local symbols
Keep all local symbols
Trace references to symbol
Allow unused version in script (default)
Do not allow unused version in script
Default search path for Solaris compatibility
-(, --start-group
Start a library search group
-), --end-group
End a library search group
Sort dynamic relocs (default)
Do not sort dynamic relocs
Set common page size to SIZE
Report undefined symbols (even with --shared)
Mark output as requiring executable stack
Make symbols in DSO available for subsequently loaded objects
Mark DSO to be initialized first at runtime
Mark object to interpose all DSOs but executable
Mark DSO to be loaded at most once, and only in the main namespace
Do not mark the DSO as one to be loaded only in the main namespace (default)
Mark object for lazy runtime binding (default)
Mark object requiring immediate process
Set maximum page size to SIZE
Allow multiple definitions of symbols
Do not create copy relocs
Mark object not to use default search paths
Mark DSO non-deletable at runtime
Mark DSO not available to dlopen
Mark DSO not available to dldump
Mark output as not requiring executable stack
Mark object for immediate function binding
Mark DSO to indicate that needs immediate $ORIGIN processing at runtime
Where possible mark variables read-only after relocation (default)
Don't mark variables read-only after relocation
Set PT_GNU_STACK segment p_memsz to SIZE
ELF symbol visibility for synthesized __start_* and __stop_* symbols
Do not permit relocations in read-only segments
Permit relocations in read-only segments (default)
Permit relocations in read-only segments (default)
Move .text.unlikely sections to a separate segment.
Do not move .text.unlikely sections to a separate segment. (default)

-z keep-text-section-prefix Keep .text.hot, .text.startup, .text.exit and .text.unlikely as separate sections in the final binary.

Merge all .text.* prefix sections. (default)

Run gold --help for a list of supported targets and emulations.

REPORTING BUGS

Report bugs to <https://sourceware.org/bugzilla/>

COPYRIGHT

Copyright © 2023 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty.

June 2023 GNU gold (GNU Binutils for Debian 2.40.50.20230602) 1.16