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