MOLD(1) General Commands Manual MOLD(1) (NAME) mold - (SYNOPSIS) mold [option...] file... (DESCRIPTION) mold GNU ld(1) . https://github.com/rui314/mold#how-to-use . mold GNU . https://github.com/rui314/mold/issues . mold (linker script) /usr/lib/x86_64-linux-gnu/libc.so ( ASCII libc.so .) . . mold . . ( ) ( ) . . ( .a) . . . . --start-group --end-group . mold LLVM lld(1) . . mold lld(1) << >> . . --start-group --end-group mold lld(1) . . mold . << ELF>> <<>> ELF . ELF . . : ELF ELF . . . . . (symbol-name, shared-library-name) . ELF . . malloc . malloc . malloc libc . malloc libc libc malloc . malloc malloc libc . . atoi C . atoi ( libc) libc . . (override) . . mold mold mold . . mold . GNU . mold . (OPTION NOTATIONS) "o" . "o" . --as-needed -as-needed --omagic -omagic -omagic --omagic -o magic . MOLD (MOLD-SPECIFIC OPTIONS) --chroot=dir dir . --color-diagnostics=[ auto | always | never ] ANSI . auto mold TTY . auto . --color-diagnostics --color-diagnostics=auto. --no-color-diagnostics --color-diagnostics=never. --detach, --no-detach mold . --fork, --no-fork . mold . --fork . (fork) . --fork time(2) waitpid(2) . --no-fork . --perf . --print-dependencies . . --as-needed . --relocatable-merge-sections -r mold . .text.foo .text.bar -r .text . mold . --repro tar mold . . path/to/output.tar path/to/output -o . --reverse-sections . . ++C . . --reverse-sections . --run command arg... command mold /usr/bin/ld . mold LD_PRELOAD exec(3) ld ld.gold ld.lld argv[0] . --separate-debug-file, --separate-debug-file=file . mold . .dbg . gdb . gdb https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html . mold flock(2) . --no-detach . --shuffle-sections, --shuffle-sections=number . number (seed) . . (benchmarking) . . . . --shuffle-sections . --spare-program-headers=number PT_NULL . ELF PT_LOAD p_vaddr . LOAD . --stats . --thread-count=count count . --threads, --no-threads . mold ( ) . mold . --no-threads --thread-count=1 . --quick-exit, --no-quick-exit quick_exit . --zero-to-bss BSS . mold SHT_NOBITS . BSS (SHT_NOBITS) . BSS . __attribute__((section(".sectname"))) . GCC Clang BSS . __attribute__((section(".sectname"))) int vec[256]; . .sectname SHT_PROGBITS . --zero-to-bss SHT_NOBITS . -z rewrite-endbr, -z norewrite-endbr CPU . CPU . <> . ROP . landing pad . ( ) . landing pad . . --rewrite-endbr mold landing pad no-op . x86-64 . GNU (GNU-COMPATIBLE OPTIONS) --help . -v, --version . -V . -E, --export-dynamic, --no-export-dynamic -E ELF . --no-export-dynamic DSO . -F libname, --filter=libname DT_FILTER libname . -I file, --dynamic-linker=file, --no-dynamic-linker file . -I --no-dynamic-linker . GNU . -I . -L dir, --library-path=dir dir mold -l . GNU mold . . -M, --print-map (map file) . -N, --omagic, --no-omagic mold . . . -S, --strip-debug .debug_* . -T file, --script=file file . -X, --discard-locals . .L . . --discard-none . --discard-none .L . GNU ld . mold ld.lld . -e symbol, --entry=symbol: symbol . -f shlib, --auxiliary=shlib DT_AUXILIARY shlib . -h libname, --soname=libname DT_SONAME libname . . libfoo.so --soname=foo . -l libname liblibname.so liblibname.a . -m target (target) . -o file, --output=file file a.out . -r, --relocatable . -s, --strip-all .symtab . -u symbol, --undefined=symbol symbol symbol symbol . -y symbol, --trace-symbol=symbol symbol . --Bdynamic . --Bstatic . --Bsymbolic ( ). . << >> . --Bsymbolic-functions --Bsymbolic . . --Bsymbolic-non-weak --Bsymbolic (non-weak) . . --Bsymbolic-non-weak-functions --Bsymbolic . . --Bno-symbolic --Bsymbolic --Bsymbolic-functions --Bsymbolic-non-weak --Bsymbolic-non-weak-functions . --Map=file file . --Tbss=address --section-start=.bss=address. --Tdata=address --section-start=.data=address. --Ttext=address --section-start=.text=address. --Ttext-segment=address . --allow-multiple-definition . . --allow-shlib-undefined, --no-allow-shlib-undefined mold ELF . mold . --no-allow-shlib-undefined mold . . -l . . --as-needed, --no-as-needed . --as-needed . --as-needed . --no-as-needed . --build-id=[ md5 | sha1 | sha256 | fast | uuid | 0xhexstring | none ] .note.gnu.build-id . sha256 . md5 sha1 . uuid UUID . 0xhexstring hexstring . fast sha256 . --build-id --build-id=sha256. --no-build-id --build-id=none. --compress-debug-sections=[ zlib | zlib-gabi | zlib:N | zstd | zstd:N | none ] DWARF ( .debug_*) zlib zstd . zlib-gabi zlib . zlib:N zlib N ( ) zstd:N zstd N . . zlib zlib:1 zstd zstd:3 . --defsym=symbol=value symbol value . value ( 0x) . symbol . --default-symver soname . --demangle, --no-demangle ++C Rust (demangle) . --dependency-file=file file . make(1) . Makefile . -MM -MF . --dynamic-list=file file . --export-dynamic-symbol-list --Bsymbolic . file GNU ld . --eh-frame-hdr, --no-eh-frame-hdr .eh_frame_hdr . --emit-relocs (relocation) . --emit-relocs . LLVM Bolt . --enable-new-dtags, --disable-new-dtags mold DT_RUNPATH --rpath . --disable-new-dtags mold DT_RPATH --rpath . --execute-only: . --exclude-libs=libraries ... libraries . --export-dynamic-symbol=symbol symbol . symbol (glob pattern) --export-dynamic-symbol-list --version-script . --export-dynamic-symbol-list=file file . --fatal-warnings, --no-fatal-warnings . --fini=symbol symbol (unload) . --gc-sections, --no-gc-sections . --gdb-index .gdb_index GNU . -ggnu-pubnames . --hash-style=[ sysv | gnu | both | none ] . --icf=[ safe | all | none ], --no-icf . std::vector ++C std::vector std::vector . (ICF Identical Code Folding) . --icf=all mold . <<>> . C ++C --icf=all . . --icf=safe . --icf=safe .llvm_addrsig . LLVM/Clang . GCC --icf=safe GCC ( .) --icf=none --no-icf ICF . --ignore-data-address-equality ICF . --icf=all . --image-base=addr addr . --init=symbol symbol . --no-undefined ( --shared). --noinhibit-exec . --package-metadata=percent-encoded-string .note.package . .rpm .deb . (core file) . (percent- encoded) (,) . -Wl, . mold % %25 . --pack-dyn-relocs=[ relr | android | android+relr | none ] . relr R_*_RELATIVE .rel.dyn .rela.dyn .relr.dyn . .relr.dyn . (PIE) . android (APS2) .rel.dyn .rela.dyn SHT_ANDROID_REL SHT_ANDROID_RELA . DT_ANDROID_REL / DT_ANDROID_RELA SZ . android+relr : R_*_RELATIVE .relr.dyn APS2 . . .relr.dyn --pack-dyn-relocs=relr . glibc ( ) musl ( ) Android ChromeOS Fuchsia . APS2 bionic bionic ( ) DT_ANDROID_REL(A) . --pie, --pic-executable, --no-pie, --no-pic-executable (PIE) . --print-gc-sections, --no-print-gc-sections . --print-icf-sections, --no-print-icf-sections () . --push-state, --pop-state --push-state --as-needed --whole-archive --static --start-lib . pop-state . --push-state --pop-state . . libfoo.so --as-needed --push-state --as-needed -lfoo --pop-state . --relax, --no-relax . . --require-defined=symbol --undefined . --retain-symbols-file=file file . file . mold file . .symtab .dynsym . --rpath=dir dir . --section-start=section=address address . address 0x . --shared, --Bshareable . --spare-dynamic-tags=number DT_NULL .dynamic . --start-lib, --end-lib --start-lib --end-lib . ar(3) . --static . --sysroot=dir dir . --trace . --undefined-glob=pattern --undefined --undefined-glob . --undefined-version, --no-undefined-version mold --export-dynamic-symbol . --undefined-version . --unique=pattern pattern . --unresolved-symbols=[ report-all | ignore-all | ignore-in-object-files | ignore-in-shared-libs ] . --version-script=file file . file GNU ld . -w, --no-warnings --fatal-warnings . --warn-common, --no-warn-common (common symbols) . --warn-once . --warn-unresolved-symbols, --error-unresolved-symbols . --warn-unresolved-symbols . --error-unresolved-symbols . --whole-archive, --no-whole-archive ( .a) . --whole-archive . --whole-archive . --no-whole-archive . --wrap=symbol symbol __wrap_symbol . __real_symbol . (wrapping) . -z cet-report=[ warning | error | none ] (CET) x86 Tiger Lake ( ) . . -fcf-protection . -z cet-report -fcf-protection . warning error mold . mold GNU_PROPERTY_X86_FEATURE_1_IBT GNU_PROPERTY_X86_FEATURE_1_SHSTK .note.gnu.property -fcf-protection . -z now, -z lazy ELF . -z now . -z lazy . -z origin $ORIGIN . -z ibt GNU_PROPERTY_X86_FEATURE_1_IBT .note.gnu.property PLT IBT . -z ibtplt . -z ibtplt PLT (IBT) x86-64 . . -z execstack, -z noexecstack ( ) . -z execstack . -z noexecstack . -z keep-text-section-prefix, -z nokeep-text-section-prefix .text.hot .text.unknown .text.unlikely .text.startup .text.exit .text . -z rodynamic .dynamic . -z relro, -z norelro .dynamic . . . -z relro relro . relro . mold relro . -z norelro . -z sectionheader, -z nosectionheader -z nosectionheader . . -z separate-loadable-segments, -z separate-code, -z noseparate-code ( ) . . separate-loadable-segments (padding) . separate-code . . noseparate-code . -z defs, -z nodefs ( --shared). -z shstk (shadow stack) GNU_PROPERTY_X86_FEATURE_1_SHSTK .note.gnu.property . (CET) Tiger Lake ( ) . -z start_stop_visibility=[ hidden | protected ] C ( /^[_a-zA-Z][_a-zA-Z0-9]*$/ ) mold __start_SECNAME __stop_SECNAME SECNAME . -z start_stop_visibility=protected ELF . hidden . -z text, -z notext, -z textoff mold . -z notext -z textoff mold . -z text . -z max-page-size=number . . . i386 x86-64 RISC-V ARM64 . -z nodefaultlib . -z nodelete DSO . -z nodlopen DSO dlopen(3) . . -z nodump DSO dldump(3) . -z nocopyreloc (copy relocations) . -z initfirst DSO . -z interpose DSO . -(, -), -EL, -Onumber, --dc, --dp, --end-group, --no-add-needed, --no-copy-dt-needed-entries, --nostdlib, --rpath-link=Ar dir, --sort-common, --sort-section, --start-group, --warn-constructors, --warn-once, --fix-cortex-a53-835769, --fix-cortex-a53-843419, -z combreloc, -z common-page-size, -z nocombreloc . (ENVIRONMENT VARIABLES) MOLD_JOBS 1 mold . mold . . mold mold . N mold N N . N . (OOM) 1 OOM . 1 . MOLD_DEBUG mold .comment . MOLD_REPRO --repro . (SEE ALSO) gold(1), ld(1), elf(5), ld.so(8) (AUTHOR) Rui Ueyama ruiu@cs.stanford.edu (BUGS) https://github.com/rui314/mold/issues . August 2026 MOLD(1)