LD(1) GNU Development Tools LD(1) (NAME) ld - (GNU Linker) (SYNOPSIS) ld [] objfile ... (DESCRIPTION) ld . ld . ld (Linker Command Language) << >> AT&T . ld "info" . ld BFD . ld COFF "a.out". . . ld ( ). ld . . (OPTIONS) . ld . "hello.o": ld -o /lib/crt0.o hello.o -lc ld output "/lib/crt0.o" "hello.o" "libc.a" ( ) . ( -l .) ld . -l -T . ( ) . . . . -l -R . No input files . . ( -T ). "INPUT" "GROUP" . -T "INSERT" . . -trace-symbol --trace-symbol . : 'o' . -o . -omagic magic --omagic NMAGIC . . --trace-symbol foo --trace-symbol=foo . . --- ( gcc) -Wl, ( ) : gcc -Wl,--start-group foo.o bar.o -Wl,--end-group . . : gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map : @file file. @file . file . file (whitespace) . . ( ) . file @file . -a keyword HP/UX . keyword archive shared default . -aarchive -Bstatic -Bdynamic . . --audit AUDITLIB AUDITLIB "DT_AUDIT" . AUDITLIB DT_SONAME . "DT_AUDIT" . "DT_DEPAUDIT" . ELF rtld-audit . -b input-format --format=input-format ld . ld -b . ld ld . input-format BFD . ( objdump -i .) . -b input-format ( ) -b . "GNUTARGET" . "TARGET" -c MRI-commandfile --mri-script=MRI-commandfile MRI ld <> GNU ld . MRI -c -T ld . MRI-cmdfile ld -L . -d -dc -dp . (common symbols) ( -r) . "FORCE_COMMON_ALLOCATION" . --depaudit AUDITLIB -P AUDITLIB AUDITLIB "DT_DEPAUDIT" . AUDITLIB DT_SONAME . "DT_DEPAUDIT" . ELF rtld-audit . -P Solaris . --enable-linker-version "LINKER_VERSION" ( Output Section Data) . . - . . --disable-linker-version "LINKER_VERSION" . . --enable-non-contiguous-regions . . . : MEMORY { MEM1 (rwx) : ORIGIN = 0x1000, LENGTH = 0x14 MEM2 (rwx) : ORIGIN = 0x1000, LENGTH = 0x40 MEM3 (rwx) : ORIGIN = 0x2000, LENGTH = 0x40 } SECTIONS { mem1 : { *(.data.*); } > MEM1 mem2 : { *(.data.*); } > MEM2 mem3 : { *(.data.*); } > MEM3 } with input sections: .data.1: size 8 .data.2: size 0x10 .data.3: size 4 results in .data.1 affected to mem1, and .data.2 and .data.3 affected to mem2, even though .data.3 would fit in mem3. INSERT . --enable-non-contiguous-regions-warnings "--enable-non-contiguous-regions" . -e entry --entry=entry entry . entry entry ( 0x 0 ). i386 PE entry ( / @number stdcall). --exclude-libs lib,lib,... (export) . . "--exclude-libs ALL" . ELF PE . PE .def . ELF (hidden) . --exclude-modules-for-implib module,module,... (import library) . ld . .def . [ PE ] -E --export-dynamic --no-export-dynamic -E --export-dynamic . . ( --no-export-dynamic ) . "dlopen" . . --dynamic-list . ELF . PE DLL EXE --export-all-symbols . --export-dynamic-symbol=glob glob . glob (bound) . -Bsymbolic --dynamic-list (no-op). ELF . --export-dynamic-symbol-list=file --export-dynamic-symbol . (scope) . VERSION . -EB (big-endian). . -EL (little-endian). . -f name --auxiliary=name ELF DT_AUXILIARY . name . DT_AUXILIARY . name . . name . name . . DT_AUXILIARY . -F name --filter=name ELF DT_FILTER . name . DT_FILTER . name . name . -F . : -b --format --oformat "TARGET" "GNUTARGET". ELF -F . -fini=name ELF DT_FINI NAME . "_fini" . -g . . -G value --gpsize=value GP value . MIPS ELF . . -h name -soname=name ELF DT_SONAME . DT_SONAME DT_SONAME . -i ( -r). -init=name ELF DT_INIT NAME . "_init" . -l namespec --library=namespec namespec . . namespec :filename ld filename libnamespec.a . ld libnamespec.a . ELF SunOS ld libnamespec.a libnamespec.so . ( ".so" .) :filename filename . . () . . -( . . . ld AIX AIX . -L searchdir --library-path=searchdir searchdir ld ld . . . . -L -l . -L ld -T . searchdir "=" $SYSROOT sysroot --sysroot . ( -L) ld . "SEARCH_DIR" . . -m emulation emulation. --verbose -V . -m "LDEMULATION" . . --remap-inputs=pattern=filename --remap-inputs-file=file . --remap-inputs=foo.o=bar.o foo.o bar.o . (wildcard) --remap-inputs=foo*.o=bar.o foo*.o bar.o . --remap-inputs-file=filename . . . (#) . (=) . . . . . /dev/null NUL . . . : ld foo.o --remap-inputs=foo.o=bar.o : ld --remap-inputs=foo.o=bar.o foo.o foo.o bar.o . - INPUT . . verbose verbose . -Map --print-map . -M --print-map (link map) . : o . o (common symbols). o . o . - . . . : foo = 1 foo = foo * 4 foo = foo + 8 -M : 0x00000001 foo = 0x1 [0x0000000c] foo = (foo * 0x4) [0x0000000c] foo = (foo + 0x8) Expressions . o (GNU properties). .note.gnu.property .note.gnu.property . . : Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found) 0xc0000002 foo.o ( 0xc0000002 0x1 ) bar.o ( 0xc0000002 ) . Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1) 0xc0010001 foo.o ( 0xc0010001 0x1 ) bar.o ( 0xc0010001 0x1 ) 0x1 . o ELF --relax foo.o: Adjusting branch at 0x00000008 towards "far" in section .text 0x00000008 foo.o "far" .text (trampoline) . --print-map-discarded --no-print-map-discarded ( ) (garbage collected) . . --print-map-locals --no-print-map-locals ( ) . (local) . ( .L ) . . -n --nmagic (page alignment) . (magic numbers) "NMAGIC" . -N --omagic text data . data . "OMAGIC" . : text PE-COFF . --no-omagic -N . text data . - . -Bdynamic . -o output --output=output output ld a.out . "OUTPUT" . - . . - . . -o . : ld -o $(EXE) $(OBJS) ld $(OBJS) -o $(EXE) EXE ( OBJS) . --dependency-file=depfile (dependency file) depfile. "make" . -M -MP . -MM << >> ( << >> ). --dependency-file makefile . -O level level ld . . ELF . . . . level fast ld . . level default - . -plugin name . name . (link time optimization) . ar nm ranlib . ${libdir}/bfd-plugins . gcc . --push-state --push-state --pop-state . : -Bdynamic -Bstatic -dn -dy -call_shared -non_shared -static -N -n --whole-archive --no-whole-archive --link-mapless --no-link-mapless -r -Ur --copy-dt-needed-entries --no-copy-dt-needed-entries --as-needed --no-as-needed -a. pkg-config . --libs . : -Wl,--push-state,--as-needed -libone -libtwo -Wl,--pop-state --pop-state --push-state . -q --emit-relocs (relocation) . . . ELF . --force-dynamic . VxWorks . -r --relocatable (relocatable)--- ld . (partial linking) . "OMAGIC" . . ++C (constructors) -Ur . . "a.out" . (LTO) LTO .gnu_object_only -r LTO . .gnu_object_only . -r (locality) . -i . -R filename --just-symbols=filename filename . . . ELF -R -rpath . --rosegment --no-rosegment . -z separate-code . -z separate-code . --no-rosegment -z separate-code : . LLD GOLD . ELF . -s --strip-all . -S --strip-debug ( ) . --strip-discarded --no-strip-discarded ( ) . . -plugin-save-temps . -t --trace ld. -t . -t . -T scriptfile --script=scriptfile scriptfile . ld ( ) "INSERT" commandfile . scriptfile "ld" -L . -T . -T -T . . -dT scriptfile --default-script=scriptfile scriptfile . --script . --default-script ( gcc ). -u symbol --undefined=symbol symbol . . -u . "EXTERN" . --require-defined . --require-defined=symbol symbol . --undefined symbol . "EXTERN" "ASSERT" "DEFINED" . . -Ur (constructors destructors) ELF -r : --- ld . -Ur -r . -r -Ur -Ur -Ur . -Ur -r . --orphan-handling=MODE (orphan sections). . MODE : "place" Orphan Sections . --unique . "discard" /DISCARD/ . "warn" "place" . "error" . --orphan-handling "place" . --unique[=SECTION] SECTION SECTION . . . -v --version -V ld. -V . --enable-linker-version Options,,Command-line Options . -x --discard-all . -X --discard-locals . ( .L ELF L a.out.) -y symbol --trace-symbol=symbol symbol . . (underscore) . . -Y path path . Solaris . -z keyword : call-nop=prefix-addr call-nop=suffix-nop call-nop=prefix-byte call-nop=suffix-byte "NOP" (padding) foo GOT . call-nop=prefix-addr "0x67 call foo" . call-nop=suffix-nop "call foo 0x90" . call-nop=prefix-byte "byte call foo" . call-nop=suffix-byte "call foo byte" . i386 x86_64 . cet-report=none cet-report=warning cet-report=error GNU_PROPERTY_X86_FEATURE_1_IBT GNU_PROPERTY_X86_FEATURE_1_SHSTK .note.gnu.property. cet-report=none . cet-report=warning . cet-report=error . ibt GNU_PROPERTY_X86_FEATURE_1_IBT shstk GNU_PROPERTY_X86_FEATURE_1_SHSTK . Linux/i386 Linux/x86_64 . combreloc nocombreloc . nocombreloc . common nocommon STT_COMMON . nocommon STT_OBJECT . common-page-size=value value. . defs . . -z undefs . dynamic-undefined-weak nodynamic-undefined-weak (undefined weak symbols) (visibility) . nodynamic-undefined-weak . . . execstack (executable stack). global . . globalaudit . "DF_1_GLOBAUDIT" "DT_FLAGS_1" . --depaudit -P . ibtplt PLT (Intel Indirect Branch Tracking IBT). Linux/i386 Linux/x86_64 . ibt GNU_PROPERTY_X86_FEATURE_1_IBT .note.gnu.property IBT. ibtplt . Linux/i386 Linux/x86_64 . indirect-extern-access noindirect-extern-access GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS .note.gnu.property (copy relocation) . noextern-protected-data nocopyreloc . i386 x86-64 . noindirect-extern-access GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS .note.gnu.property . initfirst . . . interpose (interpose). unique nounique ELF ( ) ( "dlmopen") . libc libpthread . "dlmopen" ( ) . lam-u48 GNU_PROPERTY_X86_FEATURE_1_LAM_U48 .note.gnu.property Intel LAM_U48. Linux/x86_64 . lam-u57 GNU_PROPERTY_X86_FEATURE_1_LAM_U57 .note.gnu.property Intel LAM_U57. Linux/x86_64 . lam-u48-report=none lam-u48-report=warning lam-u48-report=error GNU_PROPERTY_X86_FEATURE_1_LAM_U48 .note.gnu.property. lam-u48-report=none . lam-u48-report=warning . lam-u48-report=error . Linux/x86_64 . lam-u57-report=none lam-u57-report=warning lam-u57-report=error GNU_PROPERTY_X86_FEATURE_1_LAM_U57 .note.gnu.property. lam-u57-report=none . lam-u57-report=warning . lam-u57-report=error . Linux/x86_64 . lam-report=none lam-report=warning lam-report=error GNU_PROPERTY_X86_FEATURE_1_LAM_U48 GNU_PROPERTY_X86_FEATURE_1_LAM_U57 .note.gnu.property. lam-report=none . lam-report=warning lam-report=error . Linux/x86_64 . lazy (lazy binding) . (lazy binding) . loadfltr . max-page-size=value value. mark-plt nomark-plt PLT : DT_X86_64_PLT DT_X86_64_PLTSZ DT_X86_64_PLTENT. r_addend R_X86_64_JUMP_SLOT ( glibc r_addend R_X86_64_GLOB_DAT R_X86_64_JUMP_SLOT). x86_64 . muldefs . nocopyreloc .dynbss . . nodefaultlib . nodelete (unload) . nodlopen "dlopen" . nodump "dldump" . noexecstack . noextern-protected-data . . . . i386 x86-64 . noreloc-overflow (relocation overflow). . x86_64 . memory-seal nomemory-seal PT_LOAD (sealed) ( ) . . GNU_PROPERTY_MEMORY_SEAL .note.gnu.property . now dlopen . origin $ORIGIN . pack-relative-relocs nopack-relative-relocs (PIE) . "DT_RELR" "DT_RELRSZ" "DT_RELRENT" . . nopack-relative-relocs . GNU C GLIBC_ABI_DT_RELR C . i386 x86-64 . relro norelro "PT_GNU_RELRO" ELF . . common-page-size . norelro . report-relative-reloc . Linux/i386 Linux/x86_64 . sectionheader nosectionheader (section header). nosectionheader . sectionheader . separate-code noseparate-code "PT_LOAD" . . noseparate-code . shstk GNU_PROPERTY_X86_FEATURE_1_SHSTK .note.gnu.property Intel Shadow Stack . Linux/i386 Linux/x86_64 . stack-size=value "PT_GNU_STACK" ELF. "PT_GNU_STACK" . start-stop-gc nostart-stop-gc --gc-sections "__start_SECNAME" "__stop_SECNAME" "SECNAME" "SECNAME" C "__start_SECNAME" "__stop_SECNAME" () . -z start-stop-gc . . start-stop-visibility=value ELF (visibility) "__start_SECNAME" "__stop_SECNAME". value default internal hidden protected . protected . -z start-stop-visibility=hidden . text notext textoff DT_TEXTREL . notext textoff . undefs . -z defs . unique-symbol nounique-symbol . unique-symbol "."number"" . nounique-symbol . x86-64-baseline x86-64-v2 x86-64-v3 x86-64-v4 ISA x86-64 .note.gnu.property. x86-64-baseline "GNU_PROPERTY_X86_ISA_1_BASELINE" . x86-64-v2 "GNU_PROPERTY_X86_ISA_1_V2" . x86-64-v3 "GNU_PROPERTY_X86_ISA_1_V3" . x86-64-v4 "GNU_PROPERTY_X86_ISA_1_V4" . Linux/i386 Linux/x86_64 . isa-level-report=none isa-level-report=all isa-level-report=needed isa-level-report=used ISA x86-64 . isa-level-report=none ISA . isa-level-report=all . isa-level-report=needed . isa-level-report=used . Linux/i386 Linux/x86_64 . Solaris . --gnu-tls-tag --no-gnu-tls-tag "GLIBC_ABI_GNU_TLS" glibc "___tls_get_addr" . glibc "GLIBC_ABI_GNU_TLS" . --disable-gnu-tls-tag "___tls_get_addr" libc.so "GLIBC_ABI_GNU_TLS" . Linux/i386 . --gnu2-tls-tag --no-gnu2-tls-tag "GLIBC_ABI_GNU2_TLS" glibc "R_386_TLS_DESC_CALL" "R_X86_64_TLSDESC_CALL" . glibc . Linux/i386 Linux/x86_64 . -( archives -) --start-group archives --end-group archives . -l . . . . . --start-lib/--end-lib . . . --start-lib objects --end-lib objects . --start-lib . . . . --start-lib --end-lib . : -(/--start-group -)/--end-group --whole-archive --no-whole-archive --pop-state --whole-archive . --accept-unknown-input-arch --no-accept-unknown-input-arch . . . . . --accept-unknown-input-arch . --as-needed --no-as-needed DT_NEEDED ELF --as-needed . DT_NEEDED . --as-needed DT_NEEDED . . . --no-as-needed . : --as-needed --rpath --rpath-link . --rpath-link . --add-needed --no-add-needed --as-needed --no-as-needed . --copy-dt-needed-entries --no-copy-dt-needed-entries . -assert keyword SunOS . -Bdynamic -dy -call_shared . . . . : -l . -Bgroup "DF_1_GROUP" "DT_FLAGS_1" . . --unresolved-symbols=report-all . ELF . -Bstatic -dn -non_shared -static . . . : -l . --unresolved-symbols=report-all . -shared . -Bsymbolic ( ) . . ELF . -Bsymbolic-functions ( ) . ELF . -Bno-symbolic -Bsymbolic -Bsymbolic-functions . --dynamic-list=dynamic-list-file . . ELF . . VERSION . --dynamic-list-data . --dynamic-list-cpp-new new delete ++C. libstdc++ . --dynamic-list-cpp-typeinfo ++C (RTTI). --check-sections --no-check-sections . . overlay . --check-sections . --check-sections . --copy-dt-needed-entries --no-copy-dt-needed-entries DT_NEEDED ELF . DT_NEEDED DT_NEEDED . --copy-dt-needed-entries DT_NEEDED . --no-copy-dt-needed-entries . . --copy-dt-needed-entries DT_NEEDED . . --cref (cross reference table). . . . . . . . --ctf-variables --no-ctf-variables CTF . : . --ctf-variables . --no-ctf-variables . --ctf-share-types=method (translation units) CTF. share-unconflicted . . share-duplicated : . . CTF CTF . --no-define-common (Common symbols) . "INHIBIT_COMMON_ALLOCATION" . --no-define-common . . . --force-group-allocation . (-r) . "FORCE_GROUP_ALLOCATION" . --defsym=symbol=expression expression . . expression : "+" "-" . . : symbol ("=") expression . --defsym -T --defsym -T -T --defsym -T . --demangle[=style] --no-demangle (demangle) . : (mangled) ++C . . . COLLECT_NO_DEMANGLE . . -Ifile --dynamic-linker=file . ELF . . --no-dynamic-linker . ELF . --embedded-relocs --emit-relocs . BFIN CR16 M68K . --disable-multiple-abs-defs -R --just-symbols. --fatal-warnings --no-fatal-warnings . --no-fatal-warnings . -w --no-warnings . --fatal-warnings . . --force-exe-suffix .exe . ".exe" ".dll" ".exe" . makefile ".exe" . --gc-sections --no-gc-sections (garbage collection) . . ( ) --no-gc-sections . COFF PE . --gc-sections . . . . --entry --undefined --gc-keep-exported . ( -r) . --entry --undefined --gc-keep-exported "ENTRY" . ELF "SHF_GNU_RETAIN" . --print-gc-sections --no-print-gc-sections . stderr . --gc-sections . --no-print-gc-sections . --gc-keep-exported --gc-sections . . . ELF . --print-output-format ( ). "OUTPUT_FORMAT" . --print-memory-usage MEMORY. . . . : Memory region Used Size Region Size %age Used ROM: 256 KB 1 MB 25.00% RAM: 32 B 2 GB 0.00% : --stats . --help . --target-help . -Map=mapfile mapfile. -M . mapfile "-" stdout . mapfile . output ".map" . "%" . % ".map" . -o foo.exe -Map=bar [Creates ./bar] -o ../dir/foo.exe -Map=bar [Creates ./bar] -o foo.exe -Map=../dir [Creates ../dir/foo.exe.map] -o ../dir2/foo.exe -Map=../dir [Creates ../dir/foo.exe.map] -o foo.exe -Map=% [Creates ./foo.exe.map] -o ../dir/foo.exe -Map=% [Creates ../dir/foo.exe.map] -o foo.exe -Map=%.bar [Creates ./foo.exe.bar] -o ../dir/foo.exe -Map=%.bar [Creates ../dir/foo.exe.bar] -o ../dir2/foo.exe -Map=../dir/% [Creates ../dir/../dir2/foo.exe.map] -o ../dir2/foo.exe -Map=../dir/%.bar [Creates ../dir/../dir2/foo.exe.bar] "%" . . --no-keep-memory ld . ld . ld . --no-undefined -z defs . . --[no-]allow-shlib-undefined . "-z undefs" . --allow-multiple-definition -z muldefs . . --allow-shlib-undefined --no-allow-shlib-undefined . --no-undefined . . . : o . o BeOS HPPA . BeOS . memset . --error-handling-script=scriptname scriptname . : . : "undefined-symbol" "missing-lib" name . . . . --no-undefined-version . . --default-symver (soname) . --default-imported-symver (soname) . --no-warn-mismatch ( ) ld . ld . . --no-warn-search-mismatch ld . . --no-whole-archive --whole-archive . --start-lib/--end-lib . --no-link-mapless . . . --noinhibit-exec . . -nostdlib . ( ) . --oformat=output-format ld . ld --oformat . ld . output-format BFD ( objdump -i ). "OUTPUT_FORMAT" . --out-implib file (import library) file ( DLL ELF). ( DLL "*.dll.a" "*.a" ) ( "dlltool" DLL) . PE ELF . -pie --pic-executable (PIE). ELF . ( ) . ELF ET_DYN . PIE (override) . -no-pie . . -qmagic . -Qy SVR4 . --relax --no-relax . . --relax . . Matsushita MN10200 MN10300 . --no-relax . --relax --no-relax . --retain-symbols-file=filename filename . filename . ( VxWorks) . --retain-symbols-file . --retain-symbols-file . -s -S . -rpath=dir (runtime library search path). ELF . -rpath . -rpath -rpath-link . -rpath (native) (cross) --with-sysroot . ELF -rpath "LD_RUN_PATH" . -rpath SunOS . SunOS -L . -rpath -rpath -L . gcc -L NFS . ELF -R -rpath . -rpath-link=dir ELF SunOS . "ld -shared" . . . -rpath-link . . $ORIGIN $LIB . $ORIGIN lib ( ) lib64 ( ) $LIB . - ${ORIGIN} ${LIB} . $PLATFORM . --rpath-link . . -l ( -l -L ): 1. -rpath-link. 2. -rpath. -rpath -rpath-link -rpath -rpath-link . 3. ELF -rpath -rpath-link "LD_RUN_PATH" . 4. SunOS -rpath -L . 5. "LD_LIBRARY_PATH" . 6. ELF "DT_RUNPATH" "DT_RPATH" . "DT_RUNPATH" "DT_RPATH" . 7. /etc/ld.so.conf . 8. FreeBSD "_PATH_ELF_HINTS" elf-hints.h. 9. "SEARCH_DIR" -T ( -dT). 10. /lib /usr/lib. 11. LDPT_SET_EXTRA_LIBRARY_PATH. 12. "SEARCH_DIR" . . --section-ordering-file=script . "SECTIONS" . . . : SECTIONS { .text : { *(.text.hot) ; *(.text .text.*) } .data : { *(.data.big) ; *(.data .data.*) } } : .text : { *(.text.first) ; *(.text.z*) } .data : { foo.o(.data.first) ; *(.data.small) } : SECTIONS { .text : { *(.text.first) ; *(.text.z*) ; *(.text.hot) ; *(.text .text.*) } .data : { foo.o(.data.first) ; *(.data.small) ; *(.data.big) ; *(.data .data.*) } } . -shared -Bshareable . ELF XCOFF SunOS . SunOS -e . --sort-common --sort-common=ascending --sort-common=descending ld . . . . --sort-section=name "SORT_BY_NAME" . --sort-section=alignment "SORT_BY_ALIGNMENT" . --spare-dynamic-tags=count .dynamic ELF. prelinker . . --split-by-file[=size] --split-by-reloc size . size . --split-by-reloc[=count] count . COFF COFF . . --stats[=filename] . filename (stderr) . filename . filename - stdout . filename + (append) . "LD_STATS" --stats . --stats . CPU (RSS) . : Stats: linker version: (GNU Binutils) 2.44.50.20250401 Stats: linker started: Wed Apr 2 09:36:41 2025 Stats: args: ld -z norelro -z nomemory-seal -z no-separate-code -o a.out [...] Stats: phase cpu time rss user time system time memory Stats: name (microsec) (KiB) (seconds) (seconds) (KiB) Stats: ALL 390082 217740 0 0 25219440 Stats: ctf processing 12 0 0 0 0 Stats: string merge 1324 0 0 0 406544 Stats: parsing 349 288 0 0 119792 Stats: plugins 1 0 0 0 0 Stats: processing files 259616 214524 0 0 31569120 Stats: write 116493 0 0 0 48096 --no-stats --stats LD_STATS . --sysroot=directory directory sysroot . --with-sysroot . --task-link COFF/PE task- linked . --traditional-format ld . ld . SunOS "dbx" . --traditional-format ld . --section-start=sectionname=org org. . org 0x . sectionname ("=") org . --image-base=org ELF -Ttext-segment ELF . PE org dll . dll . 0x400000 0x10000000 dll . -Tbss=org -Tdata=org -Ttext=org --section-start ".bss" ".data" ".text" sectionname. -Ttext-segment=org ELF . -Trodata-segment=org ELF . -Tldata-segment=org ELF x86-64 ldata . --unresolved-symbols=method . method : ignore-all . report-all . . ignore-in-object-files . ignore-in-shared-libs . --[no-]allow-shlib-undefined . --warn-unresolved-symbols . --dll-verbose --verbose[=NUMBER] ld . . . NUMBER . --version-script=version-scriptfile . . ELF VERSION . --warn-common (common symbol) . . . C . C : int i = 1; (definition) (initialized data) . extern int i; . . int i; (common symbol). () . . . . --warn-common . : . : 1. . (
): warning: common of `' overridden by definition (
): warning: defined here 2. . (
): warning: definition of `' overriding common (
): warning: common is here 3. . (
): warning: multiple common of `' (
): warning: previous common is here 4. . (
): warning: common of `' overridden by larger common (
): warning: larger common is here 5. . (
): warning: common of `' overriding smaller common (
): warning: smaller common is here --warn-constructors . . COFF ELF . --warn-execstack --warn-execstack-objects --no-warn-execstack ELF (executable stack) . : 1. . 2. -z execstack . 3. -z execstack . . --no-warn-execstack . --warn-execstack . --warn-execstack-objects . --error-execstack --no-error-execstack --error-execstack . --no-error-execstack . --warn-multiple-gp (global pointer) . Alpha . --warn-once . --warn-rwx-segments --no-warn-rwx-segments . . (TLS) / . . --no-warn-rwx-segments . --error-rwx-segments --no-error-rwx-segments TLS --error-rwx-segments . --no-error-rwx-segments . --warn-section-align . --warn-textrel DT_TEXTREL . --warn-alternate-em ELF . --warn-unresolved-symbols ( --unresolved-symbols ) . . --error-unresolved-symbols . --whole-archive --whole-archive . . . --start-lib/--end-lib . gcc: gcc -Wl,-whole-archive . -Wl,-no-whole-archive gcc . --link-mapless . . . --wrap=symbol (wrapper function) symbol. symbol "__wrap_symbol" . "__real_symbol" symbol . . "__wrap_symbol" . "__real_symbol" . : void * __wrap_malloc (size_t c) { printf ("malloc called with %zu\n", c); return __real_malloc (c); } --wrap malloc "malloc" "__wrap_malloc" . "__real_malloc" "__wrap_malloc" "malloc" . . symbol "__wrap_symbol" . "f" "g" "__wrap_f" : int f (void) { return 123; } int g (void) { return f(); } --eh-frame-hdr --no-eh-frame-hdr (--eh-frame-hdr) (--no-eh-frame-hdr) ".eh_frame_hdr" "PT_GNU_EH_FRAME" ELF. --no-ld-generated-unwind-info (unwind info) ".eh_frame" PLT. . --discard-sframe ".sframe" . SFrame PLT . . --enable-new-dtags --disable-new-dtags ELF . ELF . --enable-new-dtags . --disable-new-dtags . . --hash-size=number number. . . --reduce-memory-overheads . --hash-style=style () . style "sysv" ".hash" ELF "gnu" ".gnu.hash" "both" . "both" . --compress-debug-sections=none --compress-debug-sections=zlib --compress-debug-sections=zlib-gnu --compress-debug-sections=zlib-gabi --compress-debug-sections=zstd ELF DWARF zlib zstd . --compress-debug-sections=none DWARF . --compress-debug-sections=zlib-gnu DWARF .debug .zdebug . --compress-debug-sections=zlib-gabi DWARF SHF_COMPRESSED . --compress-debug-sections=zlib --compress-debug-sections=zlib-gabi . --compress-debug-sections=zstd DWARF zstd . . --reduce-memory-overheads ld . O(n^2) O(n) ( ) . . --max-cache-size=size ld . size . --no-keep-memory . --build-id --build-id=style ELF ".note.gnu.build-id" COFF ".buildid". . style "uuid" ( ) "sha1" ( SHA1) "md5" ( MD5) "xx" ( XXHASH ) "0xhexstring" ( ) . style "sha1" . "md5" "sha1" "xx" . "none" style "--build-id" . --package-metadata=JSON ELF ".note.package". JSON . : https://systemd.io/ELF_PACKAGE_METADATA PE -shared (DLL) . "*.dll" . "*.def" . PE PE . . --add-stdcall-alias stdcall (@nn) . [ PE ] --base-file file file DLL dlltool. [ PE ] --dll DLL . -shared "LIBRARY" ".def" . [ PE ] --enable-long-section-names --disable-long-section-names PE COFF ( COFF) . . . [ PE ] --enable-stdcall-fixup --disable-stdcall-fixup (cdecl stdcall) << >> (fuzzy linking) . --enable-stdcall-fixup . --disable-stdcall-fixup . [ PE ] --leading-underscore --no-leading-underscore (underscore) . . [ PE ] --export-all-symbols DLL . . [ PE ] --exclude-symbols symbol,symbol,... . . [ PE ] --exclude-all-symbols . [ PE ] --file-alignment . . . [ PE ] --heap reserve --heap reserve,commit ( commit) (heap) . . [ PE ] --kill-at stdcall (@nn) . [ PE ] --large-address-aware "Characteristics" COFF . [ i386 PE ] --disable-large-address-aware --large-address-aware . [ i386 PE ] --major-image-version value (major) ("image version"). . [ PE ] --major-os-version value . . [ PE ] --major-subsystem-version value . . [ PE ] --minor-image-version value (minor) . . [ PE ] --minor-os-version value . . [ PE ] --minor-subsystem-version value . . [ PE ] --output-def file file DEF DLL . DEF ( "*.def" ) "dlltool" . [ PE ] --enable-auto-image-base --enable-auto-image-base=value DLL value "--image-base" . [ PE ] --disable-auto-image-base . . [ PE ] --dll-search-prefix string dll ".dll" "lib.dll" . [ PE ] --enable-auto-import "_symbol" "__imp__symbol" DATA DLL dllimport . [ PE ] ( ++C/C): extern type extern_array[]; extern_array[1] --> { volatile type *t=extern_array; t[1] } : extern struct s extern_struct; extern_struct.field --> { volatile struct s *t=&extern_struct; t->field } --disable-auto-import "_symbol" "__imp__symbol" DATA DLL. [ PE ] --enable-runtime-pseudo-reloc --enable-auto-import << >> . [ PE ] --disable-runtime-pseudo-reloc DATA DLL. [ PE ] --enable-extra-pe-debug thunking . [ PE ] --section-alignment . . 0x1000 . [ PE ] --stack reserve --stack reserve,commit ( commit) (stack) . . [ PE ] --subsystem which --subsystem which:major --subsystem which:major.minor . which "native" "windows" "console" "posix" "xbox". . which . [ PE ] "DllCharacteristics" PE : [ PE ] --high-entropy-va --disable-high-entropy-va (ASLR) . PE MinGW . --dynamicbase --enable-reloc-section . [ PE ] --dynamicbase --disable-dynamicbase (ASLR) . MinGW . --enable-reloc-section . --forceinteg --disable-forceinteg . . --nxcompat --disable-nxcompat (DEP) . MinGW . --no-isolation --disable-no-isolation (isolation) . . --no-seh --disable-no-seh SEH . SEH . . --no-bind --disable-no-bind (bind) . . --wdmdriver --disable-wdmdriver (WDM) . . --tsaware --disable-tsaware (Terminal Server) . . --insert-timestamp --no-insert-timestamp . . --no-insert-timestamp . --insert-timestamp "SOURCE_DATE_EPOCH" . --enable-reloc-section --disable-reloc-section PE . . C6X uClinux DSBT . . --dsbt-size size DSBT size. . --dsbt-index index DSBT index. . --no-merge-exidx-entries exidx . --branch-stub . C-SKY . --stub-group-size=N . N . 68HC11 68HC12 . --no-trampoline . "jsr" . --bank-window name MEMORY . GOT 68K . --got=type GOT . type single negative multigot target . Info ld . microMIPS ISA MIPS . --insn32 --no-insn32 microMIPS ( PLT) . --insn32 . --ignore-branch-isa --no-ignore-branch-isa ISA . --compact-branches --no-compact-branches PLT MIPS R6 . pdp11-aout . pdp11-aout --omagic --nmagic . --imagic pdp11-aout . -N --omagic "OMAGIC" (0407) a.out text . text data data text . PDP11 . -n --nmagic "NMAGIC" (0410) a.out text . text . pure executable . -z --imagic "IMAGIC" (0411) a.out text data PDP11 . . text . separate executable . --no-omagic --nmagic pdp11-aout. (ENVIRONMENT) ld "GNUTARGET" "LDEMULATION" "COLLECT_NO_DEMANGLE" . "GNUTARGET" -b ( --format) . BFD . "GNUTARGET" ld . "GNUTARGET" "default" BFD . BFD . "LDEMULATION" -m . . --verbose -V . -m "LDEMULATION" . (demangle) . "COLLECT_NO_DEMANGLE" . "gcc" . --demangle --no-demangle . PE/COFF --insert-timestamp SOURCE_DATE_EPOCH COFF . "LD_STATS" --stats . "LD_STATS" . (SEE ALSO) ar(1) nm(1) objcopy(1) objdump(1) readelf(1) Info binutils ld. (COPYRIGHT) (C) 1991-2026 (Free Software Foundation, Inc.) / (GNU Free Documentation License) . . <> . binutils-2.47 2026-08-11 LD(1)