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