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