1.\" Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 2.\" See https://llvm.org/LICENSE.txt for license information. 3.\" SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 4.\" 5.\" This man page documents only lld's ELF linking support, obtained originally 6.\" from FreeBSD. 7.Dd May 12, 2019 8.Dt LD.LLD 1 9.Os 10.Sh NAME 11.Nm ld.lld 12.Nd ELF linker from the LLVM project 13.Sh SYNOPSIS 14.Nm ld.lld 15.Op Ar options 16.Ar objfile ... 17.Sh DESCRIPTION 18A linker takes one or more object, archive, and library files, and combines 19them into an output file (an executable, a shared library, or another object 20file). 21It relocates code and data from the input files and resolves symbol 22references between them. 23.Pp 24.Nm 25is a drop-in replacement for the GNU BFD and gold linkers. 26It accepts most of the same command line arguments and linker scripts 27as GNU linkers. 28.Pp 29.Nm 30currently supports i386, x86-64, ARM, AArch64, PowerPC32, PowerPC64, 31MIPS32, MIPS64, RISC-V, AMDGPU, Hexagon and SPARC V9 targets. 32.Nm 33acts as a Microsoft link.exe-compatible linker if invoked as 34.Nm lld-link 35and as macOS's ld if invoked as 36.Nm ld.ld64. 37All these targets are always supported however 38.Nm 39was built, so you can always use 40.Nm 41as a native linker as well as a cross linker. 42.Sh OPTIONS 43Many options have both a single-letter and long form. 44When using the long form options other than those beginning with the 45letter 46.Cm o 47may be specified using either one or two dashes preceding the option name. 48Long options beginning with 49.Cm o 50require two dashes to avoid confusion with the 51.Fl o Ar path 52option. 53.Pp 54.Bl -tag -width indent 55.It Fl -allow-multiple-definition 56Do not error if a symbol is defined multiple times. 57The first definition will be used. 58.It Fl -allow-shlib-undefined 59Allow unresolved references in shared libraries. 60This option is enabled by default when linking a shared library. 61.It Fl -apply-dynamic-relocs 62Apply link-time values for dynamic relocations. 63.It Fl -as-needed 64Only set 65.Dv DT_NEEDED 66for shared libraries if used. 67.It Fl -auxiliary Ns = Ns Ar value 68Set the 69.Dv DT_AUXILIARY 70field to the specified name. 71.It Fl -Bdynamic , Fl -dy 72Link against shared libraries. 73.It Fl -Bstatic , Fl -static , Fl -dn 74Do not link against shared libraries. 75.It Fl Bno-symbolic 76Don't bind default visibility defined symbols locally for 77.Fl shared 78(default). 79.It Fl Bsymbolic 80Bind default visibility defined symbols locally for 81.Fl shared. 82Also set the 83.Dv DF_SYMBOLIC 84flag. 85.It Fl Bsymbolic-functions 86Bind default visibility defined function symbols locally for 87.Fl shared. 88.It Fl Bsymbolic-non-weak-functions 89Bind default visibility defined STB_GLOBAL function symbols locally for 90.Fl shared. 91.It Fl -build-id Ns = Ns Ar value 92Generate a build ID note. 93.Ar value 94may be one of 95.Cm fast , 96.Cm md5 , 97.Cm sha1 , 98.Cm tree , 99.Cm uuid , 100.Cm 0x Ns Ar hex-string , 101and 102.Cm none . 103.Cm tree 104is an alias for 105.Cm sha1 . 106Build-IDs of type 107.Cm fast , 108.Cm md5 , 109.Cm sha1 , 110and 111.Cm tree 112are calculated from the object contents. 113.Cm fast 114is not intended to be cryptographically secure. 115.It Fl -build-id 116Synonym for 117.Fl -build-id Ns = Ns Cm fast . 118.It Fl -color-diagnostics Ns = Ns Ar value 119Use colors in diagnostics. 120.Ar value 121may be one of 122.Cm always , 123.Cm auto , 124and 125.Cm never . 126.Cm auto 127enables color if and only if output is to a terminal. 128.It Fl -color-diagnostics 129Alias for 130.Fl -color-diagnostics Ns = Ns Cm auto . 131.It Fl -compress-debug-sections Ns = Ns Ar value 132Compress DWARF debug sections. 133.Ar value 134may be 135.Cm none 136or 137.Cm zlib . 138The default compression level is 1 (fastest) as the debug info usually 139compresses well at that level, but if you want to compress it more, 140you can specify 141.Fl O2 142to set the compression level to 6. 143.It Fl -cref 144Output cross reference table. If 145.Fl Map 146is specified, print to the map file. 147.It Fl -define-common , Fl d 148Assign space to common symbols. 149.It Fl -defsym Ns = Ns Ar symbol Ns = Ns Ar expression 150Define a symbol alias. 151.Ar expression 152may be another symbol or a linker script expression. 153For example, 154.Ql --defsym=foo=bar 155or 156.Ql --defsym=foo=bar+0x100 . 157.It Fl -demangle 158Demangle symbol names. 159.It Fl -disable-new-dtags 160Disable new dynamic tags. 161.It Fl -discard-all , Fl x 162Delete all local symbols. 163.It Fl -discard-locals , Fl X 164Delete temporary local symbols. 165.It Fl -discard-none 166Keep all symbols in the symbol table. 167.It Fl -dynamic-linker Ns = Ns Ar value 168Specify the dynamic linker to be used for a dynamically linked executable. 169This is recorded in an ELF segment of type 170.Dv PT_INTERP . 171.It Fl -dynamic-list Ns = Ns Ar file 172Similar to 173.Cm --export-dynamic-symbol-list . 174When creating a shared object, implies 175.Cm -Bsymbolic 176but does not set DF_SYMBOLIC 177.It Fl -EB 178Select the big-endian format in the OUTPUT_FORMAT command. 179.It Fl -EL 180Select the little-endian format in the OUTPUT_FORMAT command. 181.It Fl -eh-frame-hdr 182Request creation of 183.Li .eh_frame_hdr 184section and 185.Dv PT_GNU_EH_FRAME 186segment header. 187.It Fl -emit-relocs , Fl q 188Generate relocations in the output. 189.It Fl -enable-new-dtags 190Enable new dynamic tags. 191.It Fl -end-lib 192End a grouping of objects that should be treated as if they were together 193in an archive. 194.It Fl -entry Ns = Ns Ar entry 195Name of entry point symbol. 196.It Fl -error-limit Ns = Ns Ar value 197Maximum number of errors to emit before stopping. 198A value of zero indicates that there is no limit. 199.It Fl -error-unresolved-symbols 200Report unresolved symbols as errors. 201.It Fl -error-handing-script Ns = Ns Ar script_path 202Call script 203.Ar script_path 204upon some error, with 205.Ar tag 206as first argument, and an extra parameter as second argument. The script is 207expected to return 0 on success. Any other value is considered a generic error. 208.Ar tag 209may be 210.Cm missing-lib 211followed by the name of the missing library. 212.Cm undefined-symbol 213followed by the name of the undefined symbol. 214.It Fl -execute-only 215Mark executable sections unreadable. 216This option is currently only supported on AArch64. 217.It Fl -exclude-libs Ns = Ns Ar value 218Exclude static libraries from automatic export. 219.It Fl -export-dynamic , Fl E 220Put symbols in the dynamic symbol table. 221.It Fl -export-dynamic-symbol Ns = Ns Ar glob 222(executable) Put matched non-local defined symbols to the dynamic symbol table. 223(shared object) References to matched non-local STV_DEFAULT symbols shouldn't be bound to definitions within the shared object even if they would otherwise be due to 224.Cm -Bsymbolic 225, 226.Cm -Bsymbolic-functions 227or 228.Cm --dynamic-list 229.It Fl -export-dynamic-symbol-list Ns = Ns Ar file 230Read a list of dynamic symbol patterns from 231.Ar file . 232Apply 233.Cm --export-dynamic-symbol 234on each pattern. 235.It Fl -fatal-warnings 236Treat warnings as errors. 237.It Fl -filter Ns = Ns Ar value , Fl F Ar value 238Set the 239.Dv DT_FILTER 240field to the specified value. 241.It Fl -fini Ns = Ns Ar symbol 242Specify a finalizer function. 243.It Fl -format Ns = Ns Ar input-format , Fl b Ar input-format 244Specify the format of the inputs following this option. 245.Ar input-format 246may be one of 247.Cm binary , 248.Cm elf , 249and 250.Cm default . 251.Cm default 252is a synonym for 253.Cm elf . 254.It Fl -gc-sections 255Enable garbage collection of unused sections. 256.It Fl -gdb-index 257Generate 258.Li .gdb_index 259section. 260.It Fl -hash-style Ns = Ns Ar value 261Specify hash style. 262.Ar value 263may be 264.Cm sysv , 265.Cm gnu , 266or 267.Cm both . 268.Cm both 269is the default. 270.It Fl -help 271Print a help message. 272.It Fl -icf Ns = Ns Cm all 273Enable identical code folding. 274.It Fl -icf Ns = Ns Cm safe 275Enable safe identical code folding. 276.It Fl -icf Ns = Ns Cm none 277Disable identical code folding. 278.It Fl -ignore-data-address-equality 279Ignore address equality of data. C/C++ requires each data to have a unique 280address. 281This option allows lld to do unsafe optimization that breaks the 282requirement: create copies of read-only data or merge two or more read-only data 283that happen to have the same value. 284.It Fl -ignore-function-address-equality 285Ignore address equality of functions. 286This option allows non-PIC calls to a function with non-default visibility in 287a shared object. 288The function may have different addresses within the executable and within the 289shared object. 290.It Fl -image-base Ns = Ns Ar value 291Set the base address to 292.Ar value . 293.It Fl -init Ns = Ns Ar symbol 294Specify an initializer function. 295.It Fl -keep-unique Ns = Ns Ar symbol 296Do not fold 297.Ar symbol 298during ICF. 299.It Fl l Ar libName, Fl -library Ns = Ns Ar libName 300Root name of library to use. 301.It Fl L Ar dir , Fl -library-path Ns = Ns Ar dir 302Add a directory to the library search path. 303.It Fl -lto-aa-pipeline Ns = Ns Ar value 304AA pipeline to run during LTO. 305Used in conjunction with 306.Fl -lto-newpm-passes . 307.It Fl -lto-newpm-passes Ns = Ns Ar value 308Passes to run during LTO. 309.It Fl -lto-O Ns Ar opt-level 310Optimization level for LTO. 311.It Fl -lto-partitions Ns = Ns Ar value 312Number of LTO codegen partitions. 313.It Fl m Ar value 314Set target emulation. 315.It Fl -Map Ns = Ns Ar file , Fl M Ar file 316Print a link map to 317.Ar file . 318.It Fl -nmagic , Fl n 319Do not page align sections, link against static libraries. 320.It Fl -no-allow-shlib-undefined 321Do not allow unresolved references in shared libraries. 322This option is enabled by default when linking an executable. 323.It Fl -no-as-needed 324Always set 325.Dv DT_NEEDED 326for shared libraries. 327.It Fl -no-color-diagnostics 328Do not use colors in diagnostics. 329.It Fl -no-define-common 330Do not assign space to common symbols. 331.It Fl -no-demangle 332Do not demangle symbol names. 333.It Fl -no-dynamic-linker 334Inhibit output of an 335.Li .interp 336section. 337.It Fl -no-fortran-common 338Do not search archive members for definitions to override COMMON symbols. 339.It Fl -no-gc-sections 340Disable garbage collection of unused sections. 341.It Fl -no-gnu-unique 342Disable STB_GNU_UNIQUE symbol binding. 343.It Fl -no-merge-exidx-entries 344Disable merging .ARM.exidx entries. 345.It Fl -no-nmagic 346Page align sections. 347.It Fl -no-omagic 348Do not set the text data sections to be writable, page align sections. 349.It Fl -no-relax 350Disable target-specific relaxations. For x86-64 this disables R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX GOT optimization. 351.It Fl -no-rosegment 352Do not put read-only non-executable sections in their own segment. 353.It Fl -no-undefined-version 354Report version scripts that refer undefined symbols. 355.It Fl -no-undefined 356Report unresolved symbols even if the linker is creating a shared library. 357.It Fl -no-warn-symbol-ordering 358Do not warn about problems with the symbol ordering file or call graph profile. 359.It Fl -no-whole-archive 360Restores the default behavior of loading archive members. 361.It Fl -no-pie , Fl -no-pic-executable 362Do not create a position independent executable. 363.It Fl -noinhibit-exec 364Retain the executable output file whenever it is still usable. 365.It Fl -nostdlib 366Only search directories specified on the command line. 367.It Fl o Ar path 368Write the output executable, library, or object to 369.Ar path . 370If not specified, 371.Dv a.out 372is used as a default. 373.It Fl O Ns Ar value 374Optimize output file size. 375.Ar value 376may be: 377.Pp 378.Bl -tag -width 2n -compact 379.It Cm 0 380Disable string merging. 381.It Cm 1 382Enable string merging. 383.It Cm 2 384Enable string tail merging. If 385.Fl -compress-debug-sections 386is given, compress debug sections at compression level 6 instead of 1. 387.El 388.Pp 389.Fl O Ns Cm 1 390is the default. 391.It Fl -oformat Ns = Ns Ar format 392Specify the format for the output object file. 393The only supported 394.Ar format 395is 396.Cm binary , 397which produces output with no ELF header. 398.It Fl -omagic , Fl N 399Set the text and data sections to be readable and writable, do not page align 400sections, link against static libraries. 401.It Fl -opt-remarks-filename Ar file 402Write optimization remarks in YAML format to 403.Ar file . 404.It Fl -opt-remarks-passes Ar pass-regex 405Filter optimization remarks by only allowing the passes matching 406.Ar pass-regex . 407.It Fl -opt-remarks-with-hotness 408Include hotness information in the optimization remarks file. 409.It Fl -orphan-handling Ns = Ns Ar mode 410Control how orphan sections are handled. 411An orphan section is one not specifically mentioned in a linker script. 412.Ar mode 413may be: 414.Pp 415.Bl -tag -width 2n -compact 416.It Cm place 417Place orphan sections in suitable output sections. 418.It Cm warn 419Place orphan sections as for 420.Cm place 421and also report a warning. 422.It Cm error 423Place orphan sections as for 424.Cm place 425and also report an error. 426.El 427.Pp 428.Cm place 429is the default. 430.It Fl -pack-dyn-relocs Ns = Ns Ar format 431Pack dynamic relocations in the given format. 432.Ar format 433may be: 434.Pp 435.Bl -tag -width 2n -compact 436.It Cm none 437Do not pack. 438Dynamic relocations are encoded in SHT_REL(A). 439.It Cm android 440Pack dynamic relocations in SHT_ANDROID_REL(A). 441.It Cm relr 442Pack relative relocations in SHT_RELR, and the rest of dynamic relocations in 443SHT_REL(A). 444.It Cm android+relr 445Pack relative relocations in SHT_RELR, and the rest of dynamic relocations in 446SHT_ANDROID_REL(A). 447.El 448.Pp 449.Cm none 450is the default. 451If 452.Fl -use-android-relr-tags 453is specified, use SHT_ANDROID_RELR instead of SHT_RELR. 454.Pp 455.It Fl -pic-veneer 456Always generate position independent thunks. 457.It Fl -pie , Fl -pic-executable 458Create a position independent executable. 459.It Fl -power10-stubs Ns = Ns Cm mode 460Whether to use Power10 instructions in call stubs for R_PPC64_REL24_NOTOC and TOC/NOTOC interworking. 461.Ar mode 462may be: 463.Pp 464.Bl -tag -width 2n -compact 465.It Cm yes 466(default) Use. 467.It Cm auto 468Currently the same as yes. 469.It Cm no 470Don't use. 471.El 472 473.It Fl -print-gc-sections 474List removed unused sections. 475.It Fl -print-icf-sections 476List identical folded sections. 477.It Fl -print-map 478Print a link map to the standard output. 479.It Fl -print-archive-stats Ns = Ns Ar file 480Write archive usage statistics to the specified file. 481Print the numbers of members and fetched members for each archive. 482.It Fl -push-state 483Save the current state of 484.Fl -as-needed , 485.Fl -static , 486and 487.Fl -whole-archive. 488.It Fl -pop-state 489Restore the states saved by 490.Fl -push-state. 491.It Fl -relocatable , Fl r 492Create relocatable object file. 493.It Fl -reproduce Ns = Ns Ar path 494Write a tar file to 495.Ar path, 496containing all the input files needed to reproduce the link, a text file called 497response.txt containing the command line options and a text file called 498version.txt containing the output of ld.lld --version. 499The archive when 500unpacked can be used to re-run the linker with the same options and input files. 501.It Fl -retain-symbols-file Ns = Ns Ar file 502Retain only the symbols listed in the file. 503.It Fl -rpath Ns = Ns Ar value , Fl R Ar value 504Add a 505.Dv DT_RUNPATH 506to the output. 507.It Fl -rsp-quoting Ns = Ns Ar value 508Quoting style for response files. 509The supported values are 510.Cm windows 511and 512.Cm posix . 513.It Fl -script Ns = Ns Ar file , Fl T Ar file 514Read linker script from 515.Ar file . 516If multiple linker scripts are given, they are processed as if they 517were concatenated in the order they appeared on the command line. 518.It Fl -section-start Ns = Ns Ar section Ns = Ns Ar address 519Set address of section. 520.It Fl -shared , Fl -Bsharable 521Build a shared object. 522.It Fl -shuffle-sections Ns = Ns Ar seed 523Shuffle matched sections using the given seed before mapping them to the output sections. 524If -1, reverse the section order. If 0, use a random seed. 525.It Fl -soname Ns = Ns Ar value , Fl h Ar value 526Set 527.Dv DT_SONAME 528to 529.Ar value . 530.It Fl -sort-common 531This option is ignored for GNU compatibility. 532.It Fl -sort-section Ns = Ns Ar value 533Specifies sections sorting rule when linkerscript is used. 534.It Fl -start-lib 535Start a grouping of objects that should be treated as if they were together 536in an archive. 537.It Fl -strip-all , Fl s 538Strip all symbols. 539Implies 540.Fl -strip-debug . 541.It Fl -strip-debug , Fl S 542Strip debugging information. 543.It Fl -symbol-ordering-file Ns = Ns Ar file 544Lay out sections in the order specified by 545.Ar file . 546.It Fl -sysroot Ns = Ns Ar value 547Set the system root. 548.It Fl -target1-abs 549Interpret 550.Dv R_ARM_TARGET1 551as 552.Dv R_ARM_ABS32 . 553.It Fl -target1-rel 554Interpret 555.Dv R_ARM_TARGET1 556as 557.Dv R_ARM_REL32 . 558.It Fl -target2 Ns = Ns Ar type 559Interpret 560.Dv R_ARM_TARGET2 561as 562.Ar type , 563where 564.Ar type 565is one of 566.Cm rel , 567.Cm abs , 568or 569.Cm got-rel . 570.It Fl -Tbss Ns = Ns Ar value 571Same as 572.Fl -section-start 573with 574.Li .bss 575as the sectionname. 576.It Fl -Tdata Ns = Ns Ar value 577Same as 578.Fl -section-start 579with 580.Li .data 581as the sectionname. 582.It Fl -Ttext Ns = Ns Ar value 583Same as 584.Fl -section-start 585with 586.Li .text 587as the sectionname. 588.It Fl -thinlto-cache-dir Ns = Ns Ar value 589Path to ThinLTO cached object file directory. 590.It Fl -thinlto-cache-policy Ns = Ns Ar value 591Pruning policy for the ThinLTO cache. 592.It Fl -thinlto-jobs Ns = Ns Ar value 593Number of ThinLTO jobs. 594.It Fl -threads Ns = Ns Ar N 595Number of threads. 596.Cm all 597(default) means all of concurrent threads supported. 598.Cm 1 599disables multi-threading. 600.It Fl -time-trace 601Record time trace. 602.It Fl -time-trace-file Ns = Ns Ar file 603Write time trace output to 604.Ar file . 605.It Fl -time-trace-granularity Ns = Ns Ar value 606Minimum time granularity (in microseconds) traced by time profiler. 607.It Fl -trace 608Print the names of the input files. 609.It Fl -trace-symbol Ns = Ns Ar symbol , Fl y Ar symbol 610Trace references to 611.Ar symbol . 612.It Fl -undefined Ns = Ns Ar symbol , Fl u Ar symbol 613If 614.Ar symbol 615is not defined after symbol resolution, and there's a static library 616that contains an object file defining the symbol, load the member 617to include the object file in the output file. 618.It Fl -undefined-glob Ns = Ns Ar pattern 619Synonym for 620.Fl -undefined , 621except that it takes a glob pattern. 622In a glob pattern, 623.Cm * 624matches zero or more characters, 625.Cm ? 626matches any single character, and 627.Cm [...] 628matches the characters within brackets. 629All symbols that match 630a given pattern are handled as if they were given as arguments of 631.Fl -undefined . 632.It Fl -unique 633Creates a separate output section for every orphan input section. 634.It Fl -unresolved-symbols Ns = Ns Ar value 635Determine how to handle unresolved symbols. 636.It Fl -use-android-relr-tags 637Use SHT_ANDROID_RELR / DT_ANDROID_RELR* tags instead of SHT_RELR / DT_RELR*. 638.It Fl v 639Display the version number and proceed with linking if object files are 640specified. 641.It Fl V , Fl -version 642Display the version number and exit. 643.It Fl -verbose 644Verbose mode. 645.It Fl -version-script Ns = Ns Ar file 646Read version script from 647.Ar file . 648.It Fl -warn-backrefs 649Warn about reverse or cyclic dependencies to or between static archives. 650This can be used to ensure linker invocation remains compatible with 651traditional Unix-like linkers. 652.It Fl -warn-backrefs-exclude Ns = Ns Ar glob 653Glob describing an archive (or an object file within --start-lib) 654which should be ignored for 655.Fl -warn-backrefs 656.It Fl -warn-common 657Warn about duplicate common symbols. 658.It Fl -warn-ifunc-textrel 659Warn about using ifunc symbols in conjunction with text relocations. 660Older versions of glibc library (2.28 and earlier) has a bug that causes 661the segment that includes ifunc symbols to be marked as not executable when 662they are relocated. 663As a result, although the program compiles and links 664successfully, it gives segmentation fault when the instruction pointer reaches 665an ifunc symbol. 666Use -warn-ifunc-textrel to let lld give a warning, if the 667code may include ifunc symbols, may do text relocations and be linked with 668an older glibc version. 669Otherwise, there is no need to use it, as the default value does not give a 670warning. 671This flag has been introduced in late 2018, has no counter part in ld and gold 672linkers, and may be removed in the future. 673.It Fl -warn-unresolved-symbols 674Report unresolved symbols as warnings. 675.It Fl -whole-archive 676Force load of all members in a static library. 677.It Fl -why-extract Ns = Ns Ar file 678Print to a file about why archive members are extracted. 679.It Fl -wrap Ns = Ns Ar symbol 680Redirect 681.Ar symbol 682references to 683.Ar __wrap_symbol 684and 685.Ar __real_symbol 686references to 687.Ar symbol. 688.It Fl z Ar option 689Linker option extensions. 690.Bl -tag -width indent -compact 691.Pp 692.It Cm dead-reloc-in-nonalloc Ns = Ns Ar section_glob=value 693Resolve a relocation in a matched non-SHF_ALLOC section referencing a discarded symbol to 694.Ar value 695Accepts globs, in the event of a section matching more than one option, the last 696option takes precedence. An order of least specific to most specific match is 697recommended. 698.Pp 699.It Cm execstack 700Make the main stack executable. 701Stack permissions are recorded in the 702.Dv PT_GNU_STACK 703segment. 704.Pp 705.It Cm bti-report Ns = Ns Ar [none|warning|error] 706Specify how to report the missing GNU_PROPERTY_AARCH64_FEATURE_1_BTI property. 707.Cm none 708is the default, linker will not report the missing property otherwise will be reported as a warning or an error. 709.Pp 710.It Cm cet-report Ns = Ns Ar [none|warning|error] 711Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_IBT or GNU_PROPERTY_X86_FEATURE_1_SHSTK properties. 712.Cm none 713is the default, linker will not report the missing property otherwise will be reported as a warning or an error. 714.Pp 715.It Cm force-bti 716Force enable AArch64 BTI instruction in PLT, warn if Input ELF file does not have GNU_PROPERTY_AARCH64_FEATURE_1_BTI property. 717.Pp 718.It Cm force-ibt 719Force enable Intel Indirect Branch Tracking in PLT, warn if an input ELF file 720does not have GNU_PROPERTY_X86_FEATURE_1_IBT property. 721.Pp 722.It Cm global 723Sets the 724.Dv DF_1_GLOBAL flag in the 725.Dv DYNAMIC 726section. 727Different loaders can decide how to handle this flag on their own. 728.Pp 729.It Cm ifunc-noplt 730Do not emit PLT entries for ifunc symbols. 731Instead, emit text relocations referencing the resolver. 732This is an experimental optimization and only suitable for standalone 733environments where text relocations do not have the usual drawbacks. 734This option must be combined with the 735.Fl z Li notext 736option. 737.Pp 738.It Cm initfirst 739Sets the 740.Dv DF_1_INITFIRST 741flag to indicate the module should be initialized first. 742.Pp 743.It Cm interpose 744Set the 745.Dv DF_1_INTERPOSE 746flag to indicate to the runtime linker that the object is an interposer. 747During symbol resolution interposers are searched after the application 748but before other dependencies. 749.Pp 750.It Cm muldefs 751Do not error if a symbol is defined multiple times. 752The first definition will be used. 753This is a synonym for 754.Fl -allow-multiple-definition. 755.Pp 756.It Cm nocombreloc 757Disable combining and sorting multiple relocation sections. 758.Pp 759.It Cm nocopyreloc 760Disable the creation of copy relocations. 761.Pp 762.It Cm nodefaultlib 763Set the 764.Dv DF_1_NODEFLIB 765flag to indicate that default library search paths should be ignored. 766.Pp 767.It Cm nodelete 768Set the 769.Dv DF_1_NODELETE 770flag to indicate that the object cannot be unloaded from a process. 771.Pp 772.It Cm nodlopen 773Set the 774.Dv DF_1_NOOPEN 775flag to indicate that the object may not be opened by 776.Xr dlopen 3 . 777.Pp 778.It Cm nognustack 779Do not emit the 780.Dv PT_GNU_STACK 781segment. 782.Pp 783.It Cm norelro 784Do not indicate that portions of the object should be mapped read-only 785after initial relocation processing. 786The object will omit the 787.Dv PT_GNU_RELRO 788segment. 789.Pp 790.It Cm notext 791Allow relocations against read-only segments. 792Sets the 793.Dv DT_TEXTREL flag in the 794.Dv DYNAMIC 795section. 796.Pp 797.It Cm now 798Set the 799.Dv DF_BIND_NOW 800flag to indicate that the run-time loader should perform all relocation 801processing as part of object initialization. 802By default relocations may be performed on demand. 803.Pp 804.It Cm origin 805Set the 806.Dv DF_ORIGIN 807flag to indicate that the object requires 808$ORIGIN 809processing. 810.Pp 811.It Cm pac-plt 812AArch64 only, use pointer authentication in PLT. 813.Pp 814.It Cm rel 815Use REL format for dynamic relocations. 816.Pp 817.It Cm rela 818Use RELA format for dynamic relocations. 819.Pp 820.It Cm retpolineplt 821Emit retpoline format PLT entries as a mitigation for CVE-2017-5715. 822.Pp 823.It Cm rodynamic 824Make the 825.Li .dynamic 826section read-only. 827The 828.Dv DT_DEBUG 829tag will not be emitted. 830.Pp 831.It Cm separate-loadable-segments 832.It Cm separate-code 833.It Cm noseparate-code 834Specify whether two adjacent PT_LOAD segments are allowed to overlap in pages. 835.Cm noseparate-code 836(default) allows overlap. 837.Cm separate-code 838allows overlap between two executable segments, or two non-executable segments. 839.Cm separate-loadable-segments 840disallows overlap. 841.Pp 842.It Cm shstk 843x86 only, use shadow stack. 844.Pp 845.It Cm stack-size Ns = Ns Ar size 846Set the main thread's stack size to 847.Ar size . 848The stack size is recorded as the size of the 849.Ar size . 850.Dv PT_GNU_STACK 851program segment. 852.Pp 853.It Cm start-stop-gc 854Don't let __start_/__stop_ references retain the associated C identifier name sections (default). 855.Pp 856.It Cm nostart-stop-gc 857Let __start_/__stop_ references retain the associated C identifier name sections. 858.Pp 859.It Cm text 860Do not allow relocations against read-only segments. 861This is the default. 862.Pp 863.It Cm wxneeded 864Create a 865.Dv PT_OPENBSD_WXNEEDED 866segment. 867.El 868.El 869.Sh IMPLEMENTATION NOTES 870.Nm Ap s 871handing of archive files (those with a 872.Pa .a 873file extension) is different from traditional linkers used on Unix-like 874systems. 875.Pp 876Traditional linkers maintain a set of undefined symbols during linking. 877The linker processes each file in the order in which it appears on the 878command line, until the set of undefined symbols becomes empty. 879An object file is linked into the output object when it is encountered, 880with its undefined symbols added to the set. 881Upon encountering an archive file a traditional linker searches the objects 882contained therein, and processes those that satisfy symbols in the unresolved 883set. 884.Pp 885Handling mutually dependent archives may be awkward when using a traditional 886linker. 887Archive files may have to be specified multiple times, or the special command 888line options 889.Fl -start-group 890and 891.Fl -end-group 892may be used to have the linker loop over the files in the group until no new 893symbols are added to the set. 894.Pp 895.Nm 896records all symbols found in objects and archives as it iterates over 897command line arguments. 898When 899.Nm 900encounters an undefined symbol that can be resolved by an object file 901contained in a previously processed archive file, it immediately extracts 902and links it into the output object. 903.Pp 904With certain archive inputs 905.Nm 906may produce different results compared to traditional linkers. 907In practice, large bodies of third party software have been linked with 908.Nm 909without material issues. 910.Pp 911The 912.Fl -warn-backrefs 913option may be used to identify a linker invocation that may be incompatible 914with traditional Unix-like linker behavior. 915