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