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