GOLD(1)
π GOLD π
okay bestie, sit DOWN, because we're talking about gold β the GNU ELF linker β from the User Commands corner of your manual pages. this is <rainbow>the</rainbow> linker for people who like their linking fast and their flags plentiful. there are a LOT of options here. like, a lot a lot. but don't panic, we're going through every single one, no skips, no cap. π«Ά
β¨ NAME β¨
gold β The GNU ELF linker π
πΈ SYNOPSIS πΈ
ld.gold [options] file...
π OPTIONS π
bestie, grab a snack. this is the main character section and it is LONG. but every single flag is here, exactly as written, so you can trust it fr fr.
--helpβ spill the usage info, please π-v,--versionβ tell me the version info-Vβ version and target info, so you know what you're linking for--add-neededβ not supported. nope. not a thing. π--no-add-neededβ do NOT copyDT_NEEDEDtags from shared libraries (this is the default)--allow-multiple-definitionβ let symbols be defined multiple times, chaotic but valid--no-allow-multiple-definitionβ do not allow multiple definitions (default)--allow-shlib-undefinedβ allow unresolved references in shared libraries--no-allow-shlib-undefinedβ do not allow unresolved references in shared libraries (default)--apply-dynamic-relocsβ apply link-time values for dynamic relocations (default)--no-apply-dynamic-relocsβ (aarch64 only!) do not apply link-time values for dynamic relocations--as-neededβ only useDT_NEEDEDfor shared libraries that are actually used, so no freeloaders--no-as-neededβ useDT_NEEDEDfor all shared libraries (default)-assert [ignored]β ignored. literally just vibes.-b [elf,binary],--format [elf,binary]β set the input format--be8β output aBE8format image--build-id [=STYLE]β generate a build ID note--build-id-chunk-size-for-treehash SIZEβ chunk size for--build-id=tree--build-id-min-file-size-for-treehash SIZEβ minimum output file size for--build-id=treeto work differently than--build-id=sha1-Bdynamicβ-lsearches for shared libraries (default)-Bstaticβ-ldoes not search for shared libraries-dyβ alias for-Bdynamic(default)-dnβ alias for-Bstatic-Bgroupβ use group name lookup rules for shared library-Bshareableβ generate a shared library (alias for-G/-shared)-Bno-symbolicβ don't bind default visibility defined symbols locally for-shared(default)-Bsymbolic-functionsβ bind default visibility defined function symbols locally for-shared-Bsymbolicβ bind default visibility defined symbols locally for-shared--check-sectionsβ check segment addresses for overlaps (default)--no-check-sectionsβ do not check segment addresses for overlaps--compress-debug-sections [none,zlib,zlib-gnu,zlib-gabi,zstd]β compress.debug_*sections in the output file ποΈ--copy-dt-needed-entriesβ not supported. sorry bestie.--no-copy-dt-needed-entriesβ do not copyDT_NEEDEDtags from shared libraries (default)--crefβ output a cross reference table--no-crefβ do not output a cross reference table (default)--ctors-in-init-arrayβ useDT_INIT_ARRAYfor all constructors (default)--no-ctors-in-init-arrayβ handle constructors as directed by the compiler-d,--define-commonβ define common symbols--no-define-commonβ do not define common symbols in relocatable output (default)-dcβ alias for-d-dpβ alias for-d--debug [all,files,script,task][,...]β turn on debugging, let it yap--defsym SYMBOL=EXPRESSIONβ define a symbol--demangle [=STYLE]β demangle C++ symbols in log messages so they're actually readable--no-demangleβ do not demangle C++ symbols in log messages--dependency-file FILEβ write a dependency file listing all files read--detect-odr-violationsβ look for violations of the C++ One Definition Rule π--no-detect-odr-violationsβ do not look for violations of the C++ One Definition Rule (default)--dynamic-list-dataβ add data symbols to dynamic symbols--dynamic-list-cpp-newβ add C++operator new/deleteto dynamic symbols--dynamic-list-cpp-typeinfoβ add C++ typeinfo to dynamic symbols--dynamic-list FILEβ read a list of dynamic symbols--emit-stub-symsβ (PowerPC only) label linker stubs with a symbol (default)--no-emit-stub-symsβ (PowerPC only) do not label linker stubs with a symbol-e ADDRESS,--entry ADDRESSβ set program start address--eh-frame-hdrβ create exception frame header--no-eh-frame-hdrβ do not create exception frame header (default)--enable-new-dtagsβ enable use ofDT_RUNPATH(default)--disable-new-dtagsβ disable use ofDT_RUNPATH--enable-linker-versionβ put the linker version string into the.commentsection--disable-linker-versionβ put the linker version string into the.note.gnu.gold-versionsection (default)--no-enum-size-warningβ (ARM only) do not warn about objects with incompatible enum sizes--exclude-libs lib,lib ...β exclude libraries from automatic export-E,--export-dynamicβ export all dynamic symbols--no-export-dynamicβ do not export all dynamic symbols (default)--export-dynamic-symbol SYMBOLβ exportSYMBOLto the dynamic symbol table-EBβ link big-endian objects.-ELβ link little-endian objects.-f SHLIB,--auxiliary SHLIBβ auxiliary filter for shared object symbol table-F SHLIB,--filter SHLIBβ filter for shared object symbol table--fatal-warningsβ treat warnings as errors, no more "it's just a warning" energy π--no-fatal-warningsβ do not treat warnings as errors (default)-fini SYMBOLβ callSYMBOLat unload-time--fix-arm1176β (ARM only) fix binaries for the ARM1176 erratum (default)--no-fix-arm1176β (ARM only) do not fix binaries for the ARM1176 erratum--fix-cortex-a8β (ARM only) fix binaries for the Cortex-A8 erratum--no-fix-cortex-a8β (ARM only) do not fix binaries for the Cortex-A8 erratum (default)--fix-cortex-a53-843419β (AArch64 only) fix Cortex-A53 erratum 843419--no-fix-cortex-a53-843419β (AArch64 only) do not fix Cortex-A53 erratum 843419 (default)--fix-cortex-a53-835769β (AArch64 only) fix Cortex-A53 erratum 835769--no-fix-cortex-a53-835769β (AArch64 only) do not fix Cortex-A53 erratum 835769 (default)--fix-v4bxβ (ARM only) rewriteBX rnasMOV pc, rnfor ARMv4--fix-v4bx-interworkingβ (ARM only) rewriteBX rnbranch to ARMv4 interworking veneer-fuse-ld [gold,bfd]β ignored, but it's here for GCC linker option compatibility π«Ά-gβ ignored. just chillin'.--gc-sectionsβ remove unused sections, declutter your life π§Ή--no-gc-sectionsβ do not remove unused sections (default)--gdb-indexβ generate a.gdb_indexsection--no-gdb-indexβ do not generate a.gdb_indexsection (default)--gnu-uniqueβ enableSTB_GNU_UNIQUEsymbol binding (default)--no-gnu-uniqueβ disableSTB_GNU_UNIQUEsymbol binding-G,-sharedβ generate a shared library-h FILENAME,-soname FILENAMEβ set the shared library name--hash-bucket-empty-fraction FRACTIONβ min fraction of empty buckets in the dynamic hash--hash-style [sysv,gnu,both]β dynamic hash style-iβ alias for-r--icf [none,all,safe]β Identical Code Folding. and heads up, because this one matters:--icf=safefolds ctors, dtors and functions whose pointers are definitely not taken--icf-iterations COUNTβ number of iterations of ICF (default3)--incrementalβ do an incremental link if possible; otherwise do a full link and prepare output for incremental linking--no-incrementalβ do a full link (default)--incremental-fullβ do a full link and prepare output for incremental linking--incremental-updateβ do an incremental link; exit if not possible--incremental-base FILEβ set base file for incremental linking (default is the output file)--incremental-changedβ assume files changed--incremental-unchangedβ assume files didn't change--incremental-unknownβ use timestamps to check files (default)--incremental-startup-unchangedβ assume startup files unchanged (files preceding this option)--incremental-patch PERCENTβ amount of extra space to allocate for patches (default10)-init SYMBOLβ callSYMBOLat load-time-I PROGRAM,--dynamic-linker PROGRAMβ set the dynamic linker path--just-symbols FILEβ read only symbol values fromFILE--keep-files-mappedβ keep files mapped across passes (default on 64bit architectures)--no-keep-files-mappedβ release mapped files after each pass (default on 32bit architectures)--keep-unique SYMBOLβ do not fold this symbol during ICF-l LIBNAME,--library LIBNAMEβ search for libraryLIBNAME--ld-generated-unwind-infoβ generate unwind information for PLT (default)--no-ld-generated-unwind-infoβ do not generate unwind information for PLT-L DIR,--library-path DIRβ add directory to the search path--long-pltβ (ARM only) generate long PLT entries--no-long-pltβ (ARM only) do not generate long PLT entries (default)-m EMULATIONβ set GNU linker emulation; obsolete, so, like, retro π΅--map-whole-filesβ map whole files to memory (default on 64bit architectures)--no-map-whole-filesβ map relevant file parts to memory (default on 32bit architectures)--merge-exidx-entriesβ (ARM only) merge exidx entries in debuginfo (default)--no-merge-exidx-entriesβ (ARM only) do not merge exidx entries in debuginfo--mmap-output-fileβ map the output file for writing (default)--no-mmap-output-fileβ do not map the output file for writing-M,--print-mapβ write map file on standard output-Map MAPFILENAMEβ write map file-n,--nmagicβ do not page align data-N,--omagicβ do not page align data, do not make text readonly--no-omagicβ page align data, make text readonly (default)--no-keep-memoryβ use less memory and more disk I/O (included only for compatibility with GNU ld)--no-undefinedβ report undefined symbols (even with--shared)--noinhibit-execβ create an output file even if errors occur, stubborn queen π-nostdlibβ only search directories specified on the command line-o FILE,--output FILEβ set output file name--oformat [binary]β set output format-O LEVEL,-optimize LEVELβ optimize output file size--orphan-handling [place,discard,warn,error]β orphan section handling-pβ ignored for ARM compatibility
okay that's the options list done and honestly?? iconic. but we're NOT done bestie, there's more coming. stay tuned πβ¨
--package-metadata [=JSON]β β¨ generates a package metadata note. That's it, that's the whole job.-pieβ makes a position independent executable π-no-pieβ don't make a PIE. This one's the default, bestie.--pic-executableβ okay same energy as-pie: make a position independent executable.--no-pic-executableβ and again, no PIE. Also default. It's giving "we have two names for everything and we're not sorry".--pic-veneerβ forces PIC sequences for ARM/Thumb interworking veneers π§-no-pipeline-knowledgeβ (ARM only) it's just... ignored, kept around for backward compatibility. default, lowkey a fossil π¦--plt-align [=P2ALIGN]β (PowerPC only) aligns PLT call stubs so they fit cache lines nicely π--plt-localentryβ (PowerPC64 only) optimizes calls to ELFv2localentry:0functions.--no-plt-localentryβ (PowerPC64 only) don't do that optimization. default.--plt-static-chainβ (PowerPC64 only) PLT call stubs should loadr11.--no-plt-static-chainβ (PowerPC64 only) they should not loadr11. default.--plt-thread-safeβ (PowerPC64 only) PLT call stubs get a load-load barrier.--no-plt-thread-safeβ (PowerPC64 only) no barrier. default.--plugin PLUGINβ loads a plugin library π--plugin-opt OPTIONβ passes an option along to that plugin.--posix-fallocateβ usesposix_fallocateto reserve space in the output file. default.--no-posix-fallocateβ usesfallocateorftruncateto reserve that space instead.--power10-stubs [=auto,no,yes]β (PowerPC64 only) stubs use power10 insns β‘--no-power10-stubsβ (PowerPC64 only) stubs do not use power10 insns.--preread-archive-symbolsβ prereads archive symbols when multi-threaded πβοΈ--print-gc-sectionsβ lists removed unused sections onstderrποΈ--no-print-gc-sectionsβ doesn't list them. default.--print-icf-sectionsβ lists folded identical sections onstderr.--no-print-icf-sectionsβ doesn't list them. default.--print-output-formatβ prints the default output format π¨οΈ--print-symbol-counts FILENAMEβ prints symbols defined and used for each input.--push-stateβ saves the state of flags related to input files π--pop-stateβ restores the state of flags related to input files. Complementary queens, we love to see it π-q,--emit-relocsβ generates relocations in the output.-Qyβ ignored, for SVR4 compatibility. Yes it's just vibing there.-r,-relocatableβ generates relocatable output.--relaxβ relaxes branches on certain targets π--no-relaxβ no branch relaxing. default.--retain-symbols-file FILEβ keeps only the symbols listed in this file.--rosegmentβ puts read-only non-executable sections in their own segment πΉ--no-rosegmentβ doesn't do that. default.--rosegment-gap OFFSETβ sets the offset between executable and read-only segments.-R DIRβ addsDIRto the runtime search path.-rpath DIRβ addsDIRto the runtime search path. (Same energy, different flag, iykyk.)--rpath-link DIRβ addsDIRto the link time shared library search path.-s,--strip-allβ strips all symbols. All of them. Gone π-S,--strip-debugβ strips debugging information.--strip-debug-non-lineβ emits only debug line number information.--strip-debug-gdbβ strips debug symbols that are unused by gdb (at least versions<= 7.4).--strip-lto-sectionsβ strips LTO intermediate code sections. default.--section-ordering-file FILENAMEβ lays out sections in the order specified π--section-start SECTION=ADDRESSβ sets the address of a section.--secure-pltβ (PowerPC only) uses new-style PLT. default.--sort-common [={ascending,descending}]β sorts common symbols by alignment.--sort-section [none,name]β sorts sections by name. Heads up bestie:--no-text-reorderwill override--sort-section=namefor.textβ οΈ--spare-dynamic-tags COUNTβ how many dynamic tag slots to reserve (5is the default).--stub-group-size SIZEβ (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.1means use default size.--stub-group-multiβ (PowerPC only) allows a group of stubs to serve multiple output sections. default.--no-stub-group-multiβ (PowerPC only) each output section has its own stubs. No sharing π βοΈ--split-stack-adjust-size SIZEβ stack size when a-fsplit-stackfunction calls a non-split one.-staticβ does not link against shared libraries.--start-libβ starts a library.--end-libβ ends a library. π--statsβ prints resource usage statistics π--sysroot DIRβ sets the target system root directory.-t,--traceβ prints the name of each input file π--target1-absβ (ARM only) forcesR_ARM_TARGET1type toR_ARM_ABS32.--target1-relβ (ARM only) forcesR_ARM_TARGET1type toR_ARM_REL32.--target2 [rel, abs, got-relβ (ARM only) sets theR_ARM_TARGET2relocation type. (Yeah the bracket situation is a little unhinged, we're not fixing it, it's canon π )--text-reorderβ enables text section reordering for GCC section names. default.--no-text-reorderβ disables text section reordering for GCC section names.--threadsβ runs the linker multi-threaded π§΅--no-threadsβ doesn't run it multi-threaded. default.--thread-count COUNTβ number of threads to use.--thread-count-initial COUNTβ number of threads to use in the initial pass.--thread-count-middle COUNTβ number of threads to use in the middle pass.--thread-count-final COUNTβ number of threads to use in the final pass. Three passes, three thread counts, main character energy β¨--tls-optimizeβ (PowerPC/64 only) optimizes GD/LD/IE code to IE/LE. default.--no-tls-optimizeβ (PowerPC/64 only) don't try to optimize TLS accesses.--tls-get-addr-optimizeβ (PowerPC/64 only) uses a special__tls_get_addrcall. default.--no-tls-get-addr-optimizeβ (PowerPC/64 only) don't use a special__tls_get_addrcall.--toc-optimizeβ (PowerPC64 only) optimizes TOC code sequences. default.--no-toc-optimizeβ (PowerPC64 only) don't optimize TOC code sequences.--toc-sortβ (PowerPC64 only) sorts TOC and GOT sections. default.--no-toc-sortβ (PowerPC64 only) don't sort TOC and GOT sections.
-T FILE,--script FILEβ reads a linker script π-Tbss ADDRESSβ sets the address of thebsssegment.-Tdata ADDRESSβ sets the address of thedatasegment.-Ttext ADDRESSβ sets the address of thetextsegment.-Ttext-segment ADDRESSβ sets the address of thetextsegment. (Yes, again. They're different flags, don't @ me.)-Trodata-segment ADDRESSβ sets the address of therodatasegment.-u SYMBOL,--undefined SYMBOLβ creates an undefined reference toSYMBOL.--unresolved-symbolsβ how to handle unresolved symbols. The values are:ignore-allreport-allignore-in-object-filesignore-in-shared-libs
--verboseβ alias for--debug=files. π£οΈ--version-script FILEβ reads a version script.--warn-commonβ warns about duplicate common symbols.--no-warn-commonβ doesn't warn about duplicate common symbols. default.--warn-constructorsβ ignored.--no-warn-constructorsβ also ignored. Both of them. Just out here taking up space π--warn-drop-versionβ warns when discarding version information.--no-warn-drop-versionβ doesn't warn when discarding version information. default.--warn-execstackβ warns if the stack is executable. β οΈ--no-warn-execstackβ doesn't warn if the stack is executable. default.--no-warn-mismatchβ don't warn about mismatched input files. π€--warn-multiple-gpβ ignored.--warn-search-mismatchβ warns when skipping an incompatible library. default.--no-warn-search-mismatchβ doesn't warn when skipping an incompatible library.--warn-shared-textrelβ warns if the text segment is not shareable.--no-warn-shared-textrelβ doesn't warn if the text segment is not shareable. default.--warn-unresolved-symbolsβ reports unresolved symbols as warnings.--error-unresolved-symbolsβ reports unresolved symbols as errors. default. π€-z builddβ dummy z option. It does nothing and it's iconic for it π--no-wchar-size-warningβ (ARM only) doesn't warn about objects with incompatiblewchar_tsizes.--weak-unresolved-symbolsβ converts unresolved symbols to weak references.--whole-archiveβ includes all archive contents.--no-whole-archiveβ includes only the needed archive contents. default.--wrap SYMBOLβ uses wrapper functions forSYMBOL.-x,--discard-allβ deletes all local symbols.-X,--discard-localsβ deletes all temporary local symbols.--discard-noneβ keeps all local symbols. π-y SYMBOL,--trace-symbol SYMBOLβ traces references to a symbol.--undefined-versionβ allows unused versions in a script. default.--no-undefined-versionβ does not allow unused versions in a script.-Y PATHβ default search path, for Solaris compatibility.-(,--start-groupβ starts a library search group.-),--end-groupβ ends a library search group. (Group hug for your libraries π«Ά)
-z combrelocβ sorts dynamic relocs. default.-z nocombrelocβ does not sort dynamic relocs.-z common-page-size=SIZEβ sets the common page size toSIZE.-z defsβ reports undefined symbols (even with--shared).-z execstackβ marks the output as requiring an executable stack. β οΈ-z globalβ makes symbols in a DSO available for subsequently loaded objects.-z initfirstβ marks a DSO to be initialized first at runtime. π₯-z interposeβ marks an object to interpose all DSOs but the executable.-z uniqueβ marks a DSO to be loaded at most once, and only in the main namespace.-z nouniqueβ doesn't mark the DSO as one to be loaded only in the main namespace. default.-z lazyβ marks the object for lazy runtime binding. default. π΄-z loadfltrβ marks an object as requiring immediate processing.-z max-page-size=SIZEβ sets the maximum page size toSIZE.-z muldefsβ allows multiple definitions of symbols.-z nocopyrelocβ does not create copy relocs.-z nodefaultlibβ marks an object as not using the default search paths.-z nodeleteβ marks a DSO as non-deletable at runtime.-z nodlopenβ marks a DSO as not available todlopen.-z nodumpβ marks a DSO as not available todldump.-z noexecstackβ marks the output as not requiring an executable stack. β¨-z nowβ marks the object for immediate function binding, bestie. no lazy stalling, we bind now β¨-z originβ marks the DSO to say "hey, this one needs immediate$ORIGINprocessing at runtime" π«-z relroβ where possible, marks variables read-only after relocation. this is the default and it's giving immovable object energy π‘οΈ-z norelroβ the opposite vibe: don't mark those variables read-only after relocation π- *
-z stack-size=SIZE* β sets thePT_GNU_STACKsegmentp_memsztoSIZE. yes it really is that literal π -z start-stop-visibility=[default,internal,hidden,protected]β sets the ELF symbol visibility for the synthesized__start_*and__stop_*symbols. pick one of those four values, no freestyling πΈ-z textβ does not permit relocations in read-only segments. strict queen behavior π-z notextβ permits relocations in read-only segments. this is the default π¦-z textoffβ also permits relocations in read-only segments. also the default. two names, same slay π-z text-unlikely-segmentβ moves.text.unlikelysections into a separate segment. into their own little apartment fr fr π-z notext-unlikely-segmentβ does not move.text.unlikelysections to a separate segment. default, they stay put π-z keep-text-section-prefixβ keeps.text.hot,.text.startup,.text.exitand.text.unlikelyas separate sections in the final binary. no merging, we respect the individual β¨-z nokeep-text-section-prefixβ merges all.text.*prefix sections. default, everyone into the group chat π«Ά
Run gold --help for a list of supported targets and emulations. like, actually do it, it's a whole menu π
π REPORTING BUGS π
Found a bug? Not the cute kind, bestie π Report bugs to <https://sourceware.org/bugzilla/> β the maintainers will literally thank you.
Β©οΈ COPYRIGHT Β©οΈ
Copyright Β© 2025 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. ngl, zero warranty, none, nada π read the license before you come for anyone π«Ά
and that's a wrap on GOLD(1) π This gorgeous thing is GNU gold (GNU Binutils for Ub..., the name got a lil truncated in the footer lol), dated February 2026. Go forth and link, icon ππ
π¦ where this page comes from
- ubuntu resolute: binutils-gold-x86-64-linux-gnu 2.44-3build1
- ubuntu stonking: binutils-gold-x86-64-linux-gnu 2.44-3build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms