Debian Codegraph @

upstream/debian-trixie/man1/ld.bfd.1

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "LD 1"
58 .TH LD 1 2025-03-03 binutils-2.44 "GNU Development Tools"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 ld \- The GNU linker
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 ld [\fBoptions\fR] \fIobjfile\fR ...
68 .SH DESCRIPTION
69 .IX Header "DESCRIPTION"
70 \&\fBld\fR combines a number of object and archive files, relocates
71 their data and ties up symbol references. Usually the last step in
72 compiling a program is to run \fBld\fR.
73 .PP
74 \&\fBld\fR accepts Linker Command Language files written in
75 a superset of AT&T's Link Editor Command Language syntax,
76 to provide explicit and total control over the linking process.
77 .PP
78 This man page does not describe the command language; see the
79 \&\fBld\fR entry in \f(CW\*(C`info\*(C'\fR for full details on the command
80 language and on other aspects of the GNU linker.
81 .PP
82 This version of \fBld\fR uses the general purpose BFD libraries
83 to operate on object files. This allows \fBld\fR to read, combine, and
84 write object files in many different formats\-\-\-for example, COFF or
85 \&\f(CW\*(C`a.out\*(C'\fR. Different formats may be linked together to produce any
86 available kind of object file.
87 .PP
88 Aside from its flexibility, the GNU linker is more helpful than other
89 linkers in providing diagnostic information. Many linkers abandon
90 execution immediately upon encountering an error; whenever possible,
91 \&\fBld\fR continues executing, allowing you to identify other errors
92 (or, in some cases, to get an output file in spite of the error).
93 .PP
94 The GNU linker \fBld\fR is meant to cover a broad range of situations,
95 and to be as compatible as possible with other linkers. As a result,
96 you have many choices to control its behavior.
97 .SH OPTIONS
98 .IX Header "OPTIONS"
99 The linker supports a plethora of command-line options, but in actual
100 practice few of them are used in any particular context.
101 For instance, a frequent use of \fBld\fR is to link standard Unix
102 object files on a standard, supported Unix system. On such a system, to
103 link a file \f(CW\*(C`hello.o\*(C'\fR:
104 .PP
105 .Vb 1
106 \& ld \-o <output> /lib/crt0.o hello.o \-lc
107 .Ve
108 .PP
109 This tells \fBld\fR to produce a file called \fIoutput\fR as the
110 result of linking the file \f(CW\*(C`/lib/crt0.o\*(C'\fR with \f(CW\*(C`hello.o\*(C'\fR and
111 the library \f(CW\*(C`libc.a\*(C'\fR, which will come from the standard search
112 directories. (See the discussion of the \fB\-l\fR option below.)
113 .PP
114 Some of the command-line options to \fBld\fR may be specified at any
115 point in the command line. However, options which refer to files, such
116 as \fB\-l\fR or \fB\-T\fR, cause the file to be read at the point at
117 which the option appears in the command line, relative to the object
118 files and other file options. Repeating non-file options with a
119 different argument will either have no further effect, or override prior
120 occurrences (those further to the left on the command line) of that
121 option. Options which may be meaningfully specified more than once are
122 noted in the descriptions below.
123 .PP
124 Non-option arguments are object files or archives which are to be linked
125 together. They may follow, precede, or be mixed in with command-line
126 options, except that an object file argument may not be placed between
127 an option and its argument.
128 .PP
129 Usually the linker is invoked with at least one object file, but you can
130 specify other forms of binary input files using \fB\-l\fR, \fB\-R\fR,
131 and the script command language. If \fIno\fR binary input files at all
132 are specified, the linker does not produce any output, and issues the
133 message \fBNo input files\fR.
134 .PP
135 If the linker cannot recognize the format of an object file, it will
136 assume that it is a linker script. A script specified in this way
137 augments the main linker script used for the link (either the default
138 linker script or the one specified by using \fB\-T\fR). This feature
139 permits the linker to link against a file which appears to be an object
140 or an archive, but actually merely defines some symbol values, or uses
141 \&\f(CW\*(C`INPUT\*(C'\fR or \f(CW\*(C`GROUP\*(C'\fR to load other objects. Specifying a
142 script in this way merely augments the main linker script, with the
143 extra commands placed after the main script; use the \fB\-T\fR option
144 to replace the default linker script entirely, but note the effect of
145 the \f(CW\*(C`INSERT\*(C'\fR command.
146 .PP
147 For options whose names are a single letter,
148 option arguments must either follow the option letter without intervening
149 whitespace, or be given as separate arguments immediately following the
150 option that requires them.
151 .PP
152 For options whose names are multiple letters, either one dash or two can
153 precede the option name; for example, \fB\-trace\-symbol\fR and
154 \&\fB\-\-trace\-symbol\fR are equivalent. Note\-\-\-there is one exception to
155 this rule. Multiple letter options that start with a lower case 'o' can
156 only be preceded by two dashes. This is to reduce confusion with the
157 \&\fB\-o\fR option. So for example \fB\-omagic\fR sets the output file
158 name to \fBmagic\fR whereas \fB\-\-omagic\fR sets the NMAGIC flag on the
159 output.
160 .PP
161 Arguments to multiple-letter options must either be separated from the
162 option name by an equals sign, or be given as separate arguments
163 immediately following the option that requires them. For example,
164 \&\fB\-\-trace\-symbol foo\fR and \fB\-\-trace\-symbol=foo\fR are equivalent.
165 Unique abbreviations of the names of multiple-letter options are
166 accepted.
167 .PP
168 Note\-\-\-if the linker is being invoked indirectly, via a compiler driver
169 (e.g. \fBgcc\fR) then all the linker command-line options should be
170 prefixed by \fB\-Wl,\fR (or whatever is appropriate for the particular
171 compiler driver) like this:
172 .PP
173 .Vb 1
174 \& gcc \-Wl,\-\-start\-group foo.o bar.o \-Wl,\-\-end\-group
175 .Ve
176 .PP
177 This is important, because otherwise the compiler driver program may
178 silently drop the linker options, resulting in a bad link. Confusion
179 may also arise when passing options that require values through a
180 driver, as the use of a space between option and argument acts as
181 a separator, and causes the driver to pass only the option to the linker
182 and the argument to the compiler. In this case, it is simplest to use
183 the joined forms of both single\- and multiple-letter options, such as:
184 .PP
185 .Vb 1
186 \& gcc foo.o bar.o \-Wl,\-eENTRY \-Wl,\-Map=a.map
187 .Ve
188 .PP
189 Here is a table of the generic command-line switches accepted by the GNU
190 linker:
191 .IP \fB@\fR\fIfile\fR 4
192 .IX Item "@file"
193 Read command-line options from \fIfile\fR. The options read are
194 inserted in place of the original @\fIfile\fR option. If \fIfile\fR
195 does not exist, or cannot be read, then the option will be treated
196 literally, and not removed.
197 .Sp
198 Options in \fIfile\fR are separated by whitespace. A whitespace
199 character may be included in an option by surrounding the entire
200 option in either single or double quotes. Any character (including a
201 backslash) may be included by prefixing the character to be included
202 with a backslash. The \fIfile\fR may itself contain additional
203 @\fIfile\fR options; any such options will be processed recursively.
204 .IP "\fB\-a\fR \fIkeyword\fR" 4
205 .IX Item "-a keyword"
206 This option is supported for HP/UX compatibility. The \fIkeyword\fR
207 argument must be one of the strings \fBarchive\fR, \fBshared\fR, or
208 \&\fBdefault\fR. \fB\-aarchive\fR is functionally equivalent to
209 \&\fB\-Bstatic\fR, and the other two keywords are functionally equivalent
210 to \fB\-Bdynamic\fR. This option may be used any number of times.
211 .IP "\fB\-\-audit\fR \fIAUDITLIB\fR" 4
212 .IX Item "--audit AUDITLIB"
213 Adds \fIAUDITLIB\fR to the \f(CW\*(C`DT_AUDIT\*(C'\fR entry of the dynamic section.
214 \&\fIAUDITLIB\fR is not checked for existence, nor will it use the DT_SONAME
215 specified in the library. If specified multiple times \f(CW\*(C`DT_AUDIT\*(C'\fR
216 will contain a colon separated list of audit interfaces to use. If the linker
217 finds an object with an audit entry while searching for shared libraries,
218 it will add a corresponding \f(CW\*(C`DT_DEPAUDIT\*(C'\fR entry in the output file.
219 This option is only meaningful on ELF platforms supporting the rtld-audit
220 interface.
221 .IP "\fB\-b\fR \fIinput-format\fR" 4
222 .IX Item "-b input-format"
223 .PD 0
224 .IP \fB\-\-format=\fR\fIinput-format\fR 4
225 .IX Item "--format=input-format"
226 .PD
227 \&\fBld\fR may be configured to support more than one kind of object
228 file. If your \fBld\fR is configured this way, you can use the
229 \&\fB\-b\fR option to specify the binary format for input object files
230 that follow this option on the command line. Even when \fBld\fR is
231 configured to support alternative object formats, you don't usually need
232 to specify this, as \fBld\fR should be configured to expect as a
233 default input format the most usual format on each machine.
234 \&\fIinput-format\fR is a text string, the name of a particular format
235 supported by the BFD libraries. (You can list the available binary
236 formats with \fBobjdump \-i\fR.)
237 .Sp
238 You may want to use this option if you are linking files with an unusual
239 binary format. You can also use \fB\-b\fR to switch formats explicitly (when
240 linking object files of different formats), by including
241 \&\fB\-b\fR \fIinput-format\fR before each group of object files in a
242 particular format.
243 .Sp
244 The default format is taken from the environment variable
245 \&\f(CW\*(C`GNUTARGET\*(C'\fR.
246 .Sp
247 You can also define the input format from a script, using the command
248 \&\f(CW\*(C`TARGET\*(C'\fR;
249 .IP "\fB\-c\fR \fIMRI-commandfile\fR" 4
250 .IX Item "-c MRI-commandfile"
251 .PD 0
252 .IP \fB\-\-mri\-script=\fR\fIMRI-commandfile\fR 4
253 .IX Item "--mri-script=MRI-commandfile"
254 .PD
255 For compatibility with linkers produced by MRI, \fBld\fR accepts script
256 files written in an alternate, restricted command language, described in
257 the MRI Compatible Script Files section of GNU ld documentation.
258 Introduce MRI script files with
259 the option \fB\-c\fR; use the \fB\-T\fR option to run linker
260 scripts written in the general-purpose \fBld\fR scripting language.
261 If \fIMRI-cmdfile\fR does not exist, \fBld\fR looks for it in the directories
262 specified by any \fB\-L\fR options.
263 .IP \fB\-d\fR 4
264 .IX Item "-d"
265 .PD 0
266 .IP \fB\-dc\fR 4
267 .IX Item "-dc"
268 .IP \fB\-dp\fR 4
269 .IX Item "-dp"
270 .PD
271 These three options are equivalent; multiple forms are supported for
272 compatibility with other linkers. They assign space to common symbols
273 even if a relocatable output file is specified (with \fB\-r\fR). The
274 script command \f(CW\*(C`FORCE_COMMON_ALLOCATION\*(C'\fR has the same effect.
275 .IP "\fB\-\-depaudit\fR \fIAUDITLIB\fR" 4
276 .IX Item "--depaudit AUDITLIB"
277 .PD 0
278 .IP "\fB\-P\fR \fIAUDITLIB\fR" 4
279 .IX Item "-P AUDITLIB"
280 .PD
281 Adds \fIAUDITLIB\fR to the \f(CW\*(C`DT_DEPAUDIT\*(C'\fR entry of the dynamic section.
282 \&\fIAUDITLIB\fR is not checked for existence, nor will it use the DT_SONAME
283 specified in the library. If specified multiple times \f(CW\*(C`DT_DEPAUDIT\*(C'\fR
284 will contain a colon separated list of audit interfaces to use. This
285 option is only meaningful on ELF platforms supporting the rtld-audit interface.
286 The \-P option is provided for Solaris compatibility.
287 .IP \fB\-\-enable\-linker\-version\fR 4
288 .IX Item "--enable-linker-version"
289 Enables the \f(CW\*(C`LINKER_VERSION\*(C'\fR linker script directive, described
290 in \fBOutput Section Data\fR. If this directive is used in a linker
291 script and this option has been enabled then a string containing the
292 linker version will be inserted at the current point.
293 .Sp
294 Note \- this location of this option on the linker command line is
295 significant. It will only affect linker scripts that come after it on
296 the command line, or which are built into the linker.
297 .IP \fB\-\-disable\-linker\-version\fR 4
298 .IX Item "--disable-linker-version"
299 Disables the \f(CW\*(C`LINKER_VERSION\*(C'\fR linker script directive, so that it
300 does not insert a version string. This is the default.
301 .IP \fB\-\-enable\-non\-contiguous\-regions\fR 4
302 .IX Item "--enable-non-contiguous-regions"
303 This option avoids generating an error if an input section does not
304 fit a matching output section. The linker tries to allocate the input
305 section to subseque nt matching output sections, and generates an
306 error only if no output section is large enough. This is useful when
307 several non-contiguous memory regions are available and the input
308 section does not require a particular one. The order in which input
309 sections are evaluated does not change, for instance:
310 .Sp
311 .Vb 10
312 \& MEMORY {
313 \& MEM1 (rwx) : ORIGIN = 0x1000, LENGTH = 0x14
314 \& MEM2 (rwx) : ORIGIN = 0x1000, LENGTH = 0x40
315 \& MEM3 (rwx) : ORIGIN = 0x2000, LENGTH = 0x40
316 \& }
317 \& SECTIONS {
318 \& mem1 : { *(.data.*); } > MEM1
319 \& mem2 : { *(.data.*); } > MEM2
320 \& mem3 : { *(.data.*); } > MEM3
321 \& }
322 \&
323 \& with input sections:
324 \& .data.1: size 8
325 \& .data.2: size 0x10
326 \& .data.3: size 4
327 \&
328 \& results in .data.1 affected to mem1, and .data.2 and .data.3
329 \& affected to mem2, even though .data.3 would fit in mem3.
330 .Ve
331 .Sp
332 This option is incompatible with INSERT statements because it changes
333 the way input sections are mapped to output sections.
334 .IP \fB\-\-enable\-non\-contiguous\-regions\-warnings\fR 4
335 .IX Item "--enable-non-contiguous-regions-warnings"
336 This option enables warnings when
337 \&\f(CW\*(C`\-\-enable\-non\-contiguous\-regions\*(C'\fR allows possibly unexpected
338 matches in sections mapping, potentially leading to silently
339 discarding a section instead of failing because it does not fit any
340 output region.
341 .IP "\fB\-e\fR \fIentry\fR" 4
342 .IX Item "-e entry"
343 .PD 0
344 .IP \fB\-\-entry=\fR\fIentry\fR 4
345 .IX Item "--entry=entry"
346 .PD
347 Use \fIentry\fR as the explicit symbol for beginning execution of your
348 program, rather than the default entry point. If there is no symbol
349 named \fIentry\fR, the linker will try to parse \fIentry\fR as a number,
350 and use that as the entry address (the number will be interpreted in
351 base 10; you may use a leading \fB0x\fR for base 16, or a leading
352 \&\fB0\fR for base 8).
353 .IP "\fB\-\-exclude\-libs\fR \fIlib\fR\fB,\fR\fIlib\fR\fB,...\fR" 4
354 .IX Item "--exclude-libs lib,lib,..."
355 Specifies a list of archive libraries from which symbols should not be automatically
356 exported. The library names may be delimited by commas or colons. Specifying
357 \&\f(CW\*(C`\-\-exclude\-libs ALL\*(C'\fR excludes symbols in all archive libraries from
358 automatic export. This option is available only for the i386 PE targeted
359 port of the linker and for ELF targeted ports. For i386 PE, symbols
360 explicitly listed in a .def file are still exported, regardless of this
361 option. For ELF targeted ports, symbols affected by this option will
362 be treated as hidden.
363 .IP "\fB\-\-exclude\-modules\-for\-implib\fR \fImodule\fR\fB,\fR\fImodule\fR\fB,...\fR" 4
364 .IX Item "--exclude-modules-for-implib module,module,..."
365 Specifies a list of object files or archive members, from which symbols
366 should not be automatically exported, but which should be copied wholesale
367 into the import library being generated during the link. The module names
368 may be delimited by commas or colons, and must match exactly the filenames
369 used by \fBld\fR to open the files; for archive members, this is simply
370 the member name, but for object files the name listed must include and
371 match precisely any path used to specify the input file on the linker's
372 command-line. This option is available only for the i386 PE targeted port
373 of the linker. Symbols explicitly listed in a .def file are still exported,
374 regardless of this option.
375 .IP \fB\-E\fR 4
376 .IX Item "-E"
377 .PD 0
378 .IP \fB\-\-export\-dynamic\fR 4
379 .IX Item "--export-dynamic"
380 .IP \fB\-\-no\-export\-dynamic\fR 4
381 .IX Item "--no-export-dynamic"
382 .PD
383 When creating a dynamically linked executable, using the \fB\-E\fR
384 option or the \fB\-\-export\-dynamic\fR option causes the linker to add
385 all symbols to the dynamic symbol table. The dynamic symbol table is the
386 set of symbols which are visible from dynamic objects at run time.
387 .Sp
388 If you do not use either of these options (or use the
389 \&\fB\-\-no\-export\-dynamic\fR option to restore the default behavior), the
390 dynamic symbol table will normally contain only those symbols which are
391 referenced by some dynamic object mentioned in the link.
392 .Sp
393 If you use \f(CW\*(C`dlopen\*(C'\fR to load a dynamic object which needs to refer
394 back to the symbols defined by the program, rather than some other
395 dynamic object, then you will probably need to use this option when
396 linking the program itself.
397 .Sp
398 You can also use the dynamic list to control what symbols should
399 be added to the dynamic symbol table if the output format supports it.
400 See the description of \fB\-\-dynamic\-list\fR.
401 .Sp
402 Note that this option is specific to ELF targeted ports. PE targets
403 support a similar function to export all symbols from a DLL or EXE; see
404 the description of \fB\-\-export\-all\-symbols\fR below.
405 .IP \fB\-\-export\-dynamic\-symbol=\fR\fIglob\fR 4
406 .IX Item "--export-dynamic-symbol=glob"
407 When creating a dynamically linked executable, symbols matching
408 \&\fIglob\fR will be added to the dynamic symbol table. When creating a
409 shared library, references to symbols matching \fIglob\fR will not be
410 bound to the definitions within the shared library. This option is a
411 no-op when creating a shared library and \fB\-Bsymbolic\fR or
412 \&\fB\-\-dynamic\-list\fR are not specified. This option is only meaningful
413 on ELF platforms which support shared libraries.
414 .IP \fB\-\-export\-dynamic\-symbol\-list=\fR\fIfile\fR 4
415 .IX Item "--export-dynamic-symbol-list=file"
416 Specify a \fB\-\-export\-dynamic\-symbol\fR for each pattern in the file.
417 The format of the file is the same as the version node without
418 scope and node name. See \fBVERSION\fR for more information.
419 .IP \fB\-EB\fR 4
420 .IX Item "-EB"
421 Link big-endian objects. This affects the default output format.
422 .IP \fB\-EL\fR 4
423 .IX Item "-EL"
424 Link little-endian objects. This affects the default output format.
425 .IP "\fB\-f\fR \fIname\fR" 4
426 .IX Item "-f name"
427 .PD 0
428 .IP \fB\-\-auxiliary=\fR\fIname\fR 4
429 .IX Item "--auxiliary=name"
430 .PD
431 When creating an ELF shared object, set the internal DT_AUXILIARY field
432 to the specified name. This tells the dynamic linker that the symbol
433 table of the shared object should be used as an auxiliary filter on the
434 symbol table of the shared object \fIname\fR.
435 .Sp
436 If you later link a program against this filter object, then, when you
437 run the program, the dynamic linker will see the DT_AUXILIARY field. If
438 the dynamic linker resolves any symbols from the filter object, it will
439 first check whether there is a definition in the shared object
440 \&\fIname\fR. If there is one, it will be used instead of the definition
441 in the filter object. The shared object \fIname\fR need not exist.
442 Thus the shared object \fIname\fR may be used to provide an alternative
443 implementation of certain functions, perhaps for debugging or for
444 machine-specific performance.
445 .Sp
446 This option may be specified more than once. The DT_AUXILIARY entries
447 will be created in the order in which they appear on the command line.
448 .IP "\fB\-F\fR \fIname\fR" 4
449 .IX Item "-F name"
450 .PD 0
451 .IP \fB\-\-filter=\fR\fIname\fR 4
452 .IX Item "--filter=name"
453 .PD
454 When creating an ELF shared object, set the internal DT_FILTER field to
455 the specified name. This tells the dynamic linker that the symbol table
456 of the shared object which is being created should be used as a filter
457 on the symbol table of the shared object \fIname\fR.
458 .Sp
459 If you later link a program against this filter object, then, when you
460 run the program, the dynamic linker will see the DT_FILTER field. The
461 dynamic linker will resolve symbols according to the symbol table of the
462 filter object as usual, but it will actually link to the definitions
463 found in the shared object \fIname\fR. Thus the filter object can be
464 used to select a subset of the symbols provided by the object
465 \&\fIname\fR.
466 .Sp
467 Some older linkers used the \fB\-F\fR option throughout a compilation
468 toolchain for specifying object-file format for both input and output
469 object files.
470 The GNU linker uses other mechanisms for this purpose: the
471 \&\fB\-b\fR, \fB\-\-format\fR, \fB\-\-oformat\fR options, the
472 \&\f(CW\*(C`TARGET\*(C'\fR command in linker scripts, and the \f(CW\*(C`GNUTARGET\*(C'\fR
473 environment variable.
474 The GNU linker will ignore the \fB\-F\fR option when not
475 creating an ELF shared object.
476 .IP \fB\-fini=\fR\fIname\fR 4
477 .IX Item "-fini=name"
478 When creating an ELF executable or shared object, call NAME when the
479 executable or shared object is unloaded, by setting DT_FINI to the
480 address of the function. By default, the linker uses \f(CW\*(C`_fini\*(C'\fR as
481 the function to call.
482 .IP \fB\-g\fR 4
483 .IX Item "-g"
484 Ignored. Provided for compatibility with other tools.
485 .IP "\fB\-G\fR \fIvalue\fR" 4
486 .IX Item "-G value"
487 .PD 0
488 .IP \fB\-\-gpsize=\fR\fIvalue\fR 4
489 .IX Item "--gpsize=value"
490 .PD
491 Set the maximum size of objects to be optimized using the GP register to
492 \&\fIsize\fR. This is only meaningful for object file formats such as
493 MIPS ELF that support putting large and small objects into different
494 sections. This is ignored for other object file formats.
495 .IP "\fB\-h\fR \fIname\fR" 4
496 .IX Item "-h name"
497 .PD 0
498 .IP \fB\-soname=\fR\fIname\fR 4
499 .IX Item "-soname=name"
500 .PD
501 When creating an ELF shared object, set the internal DT_SONAME field to
502 the specified name. When an executable is linked with a shared object
503 which has a DT_SONAME field, then when the executable is run the dynamic
504 linker will attempt to load the shared object specified by the DT_SONAME
505 field rather than using the file name given to the linker.
506 .IP \fB\-i\fR 4
507 .IX Item "-i"
508 Perform an incremental link (same as option \fB\-r\fR).
509 .IP \fB\-init=\fR\fIname\fR 4
510 .IX Item "-init=name"
511 When creating an ELF executable or shared object, call NAME when the
512 executable or shared object is loaded, by setting DT_INIT to the address
513 of the function. By default, the linker uses \f(CW\*(C`_init\*(C'\fR as the
514 function to call.
515 .IP "\fB\-l\fR \fInamespec\fR" 4
516 .IX Item "-l namespec"
517 .PD 0
518 .IP \fB\-\-library=\fR\fInamespec\fR 4
519 .IX Item "--library=namespec"
520 .PD
521 Add the archive or object file specified by \fInamespec\fR to the
522 list of files to link. This option may be used any number of times.
523 If \fInamespec\fR is of the form \fI:filename\fR, \fBld\fR
524 will search the library path for a file called \fIfilename\fR, otherwise it
525 will search the library path for a file called \fIlibnamespec.a\fR.
526 .Sp
527 On systems which support shared libraries, \fBld\fR may also search for
528 files other than \fIlibnamespec.a\fR. Specifically, on ELF
529 and SunOS systems, \fBld\fR will search a directory for a library
530 called \fIlibnamespec.so\fR before searching for one called
531 \&\fIlibnamespec.a\fR. (By convention, a \f(CW\*(C`.so\*(C'\fR extension
532 indicates a shared library.) Note that this behavior does not apply
533 to \fI:filename\fR, which always specifies a file called
534 \&\fIfilename\fR.
535 .Sp
536 The linker will search an archive only once, at the location where it is
537 specified on the command line. If the archive defines a symbol which
538 was undefined in some object which appeared before the archive on the
539 command line, the linker will include the appropriate file(s) from the
540 archive. However, an undefined symbol in an object appearing later on
541 the command line will not cause the linker to search the archive again.
542 .Sp
543 See the \fB\-(\fR option for a way to force the linker to search
544 archives multiple times.
545 .Sp
546 You may list the same archive multiple times on the command line.
547 .Sp
548 This type of archive searching is standard for Unix linkers. However,
549 if you are using \fBld\fR on AIX, note that it is different from the
550 behaviour of the AIX linker.
551 .IP "\fB\-L\fR \fIsearchdir\fR" 4
552 .IX Item "-L searchdir"
553 .PD 0
554 .IP \fB\-\-library\-path=\fR\fIsearchdir\fR 4
555 .IX Item "--library-path=searchdir"
556 .PD
557 Add path \fIsearchdir\fR to the list of paths that \fBld\fR will search
558 for archive libraries and \fBld\fR control scripts. You may use this
559 option any number of times. The directories are searched in the order
560 in which they are specified on the command line. Directories specified
561 on the command line are searched before the default directories. All
562 \&\fB\-L\fR options apply to all \fB\-l\fR options, regardless of the
563 order in which the options appear. \fB\-L\fR options do not affect
564 how \fBld\fR searches for a linker script unless \fB\-T\fR
565 option is specified.
566 .Sp
567 If \fIsearchdir\fR begins with \f(CW\*(C`=\*(C'\fR or \f(CW$SYSROOT\fR, then this
568 prefix will be replaced by the \fIsysroot prefix\fR, controlled by the
569 \&\fB\-\-sysroot\fR option, or specified when the linker is configured.
570 .Sp
571 The default set of paths searched (without being specified with
572 \&\fB\-L\fR) depends on which emulation mode \fBld\fR is using, and in
573 some cases also on how it was configured.
574 .Sp
575 The paths can also be specified in a link script with the
576 \&\f(CW\*(C`SEARCH_DIR\*(C'\fR command. Directories specified this way are searched
577 at the point in which the linker script appears in the command line.
578 .IP "\fB\-m\fR \fIemulation\fR" 4
579 .IX Item "-m emulation"
580 Emulate the \fIemulation\fR linker. You can list the available
581 emulations with the \fB\-\-verbose\fR or \fB\-V\fR options.
582 .Sp
583 If the \fB\-m\fR option is not used, the emulation is taken from the
584 \&\f(CW\*(C`LDEMULATION\*(C'\fR environment variable, if that is defined.
585 .Sp
586 Otherwise, the default emulation depends upon how the linker was
587 configured.
588 .IP \fB\-\-remap\-inputs=\fR\f(BIpattern\fR\fB=\fR\f(BIfilename\fR 4
589 .IX Item "--remap-inputs=pattern=filename"
590 .PD 0
591 .IP \fB\-\-remap\-inputs\-file=\fR\f(BIfile\fR 4
592 .IX Item "--remap-inputs-file=file"
593 .PD
594 These options allow the names of input files to be changed before the
595 linker attempts to open them. The option
596 \&\fB\-\-remap\-inputs=foo.o=bar.o\fR will cause any attempt to load a
597 file called \fIfoo.o\fR to instead try to load a file called
598 \&\fIbar.o\fR. Wildcard patterns are permitted in the first filename,
599 so \fB\-\-remap\-inputs=foo*.o=bar.o\fR will rename any input file that
600 matches \fIfoo*.o\fR to \fIbar.o\fR.
601 .Sp
602 An alternative form of the option
603 \&\fB\-\-remap\-inputs\-file=filename\fR allows the remappings to be read
604 from a file. Each line in the file can contain a single remapping.
605 Blank lines are ignored. Anything from a hash character (\fB#\fR) to
606 the end of a line is considered to be a comment and is also ignored.
607 The mapping pattern can be separated from the filename by whitespace
608 or an equals (\fB=\fR) character.
609 .Sp
610 The options can be specified multiple times. Their contents
611 accumulate. The remappings will be processed in the order in which
612 they occur on the command line, and if they come from a file, in the
613 order in which they occur in the file. If a match is made, no further
614 checking for that filename will be performed.
615 .Sp
616 If the replacement filename is \fI/dev/null\fR or just \fINUL\fR
617 then the remapping will actually cause the input file to be ignored.
618 This can be a convenient way to experiment with removing input files
619 from a complicated build environment.
620 .Sp
621 Note that this option is position dependent and only affects filenames
622 that come after it on the command line. Thus:
623 .Sp
624 .Vb 1
625 \& ld foo.o \-\-remap\-inputs=foo.o=bar.o
626 .Ve
627 .Sp
628 Will have no effect, whereas:
629 .Sp
630 .Vb 1
631 \& ld \-\-remap\-inputs=foo.o=bar.o foo.o
632 .Ve
633 .Sp
634 Will rename the input file \fIfoo.o\fR to \fIbar.o\fR.
635 .Sp
636 Note \- these options also affect files referenced by \fIINPUT\fR
637 statements in linker scripts. But since linker scripts are processed
638 after the entire command line is read, the position of the remap
639 options on the command line is not significant.
640 .Sp
641 If the \fBverbose\fR option is enabled then any mappings that match
642 will be reported, although again the \fBverbose\fR option needs to
643 be enabled on the command line \fIbefore\fR the remaped filenames
644 appear.
645 .Sp
646 If the \fB\-Map\fR or \fB\-\-print\-map\fR options are enabled then
647 the remapping list will be included in the map output.
648 .IP \fB\-M\fR 4
649 .IX Item "-M"
650 .PD 0
651 .IP \fB\-\-print\-map\fR 4
652 .IX Item "--print-map"
653 .PD
654 Print a link map to the standard output. A link map provides
655 information about the link, including the following:
656 .RS 4
657 .IP \(bu 4
658 Where object files are mapped into memory.
659 .IP \(bu 4
660 How common symbols are allocated.
661 .IP \(bu 4
662 All archive members included in the link, with a mention of the symbol
663 which caused the archive member to be brought in.
664 .IP \(bu 4
665 The values assigned to symbols.
666 .Sp
667 Note \- symbols whose values are computed by an expression which
668 involves a reference to a previous value of the same symbol may not
669 have correct result displayed in the link map. This is because the
670 linker discards intermediate results and only retains the final value
671 of an expression. Under such circumstances the linker will display
672 the final value enclosed by square brackets. Thus for example a
673 linker script containing:
674 .Sp
675 .Vb 3
676 \& foo = 1
677 \& foo = foo * 4
678 \& foo = foo + 8
679 .Ve
680 .Sp
681 will produce the following output in the link map if the \fB\-M\fR
682 option is used:
683 .Sp
684 .Vb 3
685 \& 0x00000001 foo = 0x1
686 \& [0x0000000c] foo = (foo * 0x4)
687 \& [0x0000000c] foo = (foo + 0x8)
688 .Ve
689 .Sp
690 See \fBExpressions\fR for more information about expressions in linker
691 scripts.
692 .IP \(bu 4
693 How GNU properties are merged.
694 .Sp
695 When the linker merges input .note.gnu.property sections into one output
696 \&.note.gnu.property section, some properties are removed or updated.
697 These actions are reported in the link map. For example:
698 .Sp
699 .Vb 1
700 \& Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)
701 .Ve
702 .Sp
703 This indicates that property 0xc0000002 is removed from output when
704 merging properties in \fIfoo.o\fR, whose property 0xc0000002 value
705 is 0x1, and \fIbar.o\fR, which doesn't have property 0xc0000002.
706 .Sp
707 .Vb 1
708 \& Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1)
709 .Ve
710 .Sp
711 This indicates that property 0xc0010001 value is updated to 0x1 in output
712 when merging properties in \fIfoo.o\fR, whose 0xc0010001 property value
713 is 0x1, and \fIbar.o\fR, whose 0xc0010001 property value is 0x1.
714 .IP \(bu 4
715 On some ELF targets, a list of fixups inserted by \fB\-\-relax\fR
716 .Sp
717 .Vb 1
718 \& foo.o: Adjusting branch at 0x00000008 towards "far" in section .text
719 .Ve
720 .Sp
721 This indicates that the branch at 0x00000008 in foo.o, targeting
722 the symbol "far" in section .text, has been replaced by a trampoline.
723 .RE
724 .RS 4
725 .RE
726 .IP \fB\-\-print\-map\-discarded\fR 4
727 .IX Item "--print-map-discarded"
728 .PD 0
729 .IP \fB\-\-no\-print\-map\-discarded\fR 4
730 .IX Item "--no-print-map-discarded"
731 .PD
732 Print (or do not print) the list of discarded and garbage collected sections
733 in the link map. Enabled by default.
734 .IP \fB\-\-print\-map\-locals\fR 4
735 .IX Item "--print-map-locals"
736 .PD 0
737 .IP \fB\-\-no\-print\-map\-locals\fR 4
738 .IX Item "--no-print-map-locals"
739 .PD
740 Print (or do not print) local symbols in the link map. Local symbols
741 will have the text \fB(local)\fR printed before their name, and will
742 be listed after all of the global symbols in a given section.
743 Temporary local symbols (typically those that start with \fB.L\fR)
744 will not be included in the output. Disabled by default.
745 .IP \fB\-n\fR 4
746 .IX Item "-n"
747 .PD 0
748 .IP \fB\-\-nmagic\fR 4
749 .IX Item "--nmagic"
750 .PD
751 Turn off page alignment of sections, and disable linking against shared
752 libraries. If the output format supports Unix style magic numbers,
753 mark the output as \f(CW\*(C`NMAGIC\*(C'\fR.
754 .IP \fB\-N\fR 4
755 .IX Item "-N"
756 .PD 0
757 .IP \fB\-\-omagic\fR 4
758 .IX Item "--omagic"
759 .PD
760 Set the text and data sections to be readable and writable. Also, do
761 not page-align the data segment, and disable linking against shared
762 libraries. If the output format supports Unix style magic numbers,
763 mark the output as \f(CW\*(C`OMAGIC\*(C'\fR. Note: Although a writable text section
764 is allowed for PE-COFF targets, it does not conform to the format
765 specification published by Microsoft.
766 .IP \fB\-\-no\-omagic\fR 4
767 .IX Item "--no-omagic"
768 This option negates most of the effects of the \fB\-N\fR option. It
769 sets the text section to be read-only, and forces the data segment to
770 be page-aligned. Note \- this option does not enable linking against
771 shared libraries. Use \fB\-Bdynamic\fR for this.
772 .IP "\fB\-o\fR \fIoutput\fR" 4
773 .IX Item "-o output"
774 .PD 0
775 .IP \fB\-\-output=\fR\fIoutput\fR 4
776 .IX Item "--output=output"
777 .PD
778 Use \fIoutput\fR as the name for the program produced by \fBld\fR; if this
779 option is not specified, the name \fIa.out\fR is used by default. The
780 script command \f(CW\*(C`OUTPUT\*(C'\fR can also specify the output file name.
781 .Sp
782 Note \- the linker will delete the output file before it starts to
783 write to it. It will do this even if it turns out that the link
784 cannot be completed due to errors.
785 .Sp
786 Note \- the linker will check to make sure that the output file name
787 does not match the name of any of the input files, but that is all.
788 In particular it will not complain if the output file might overwrite
789 a source file or some other important file. Therefore in build
790 systems it is recommended to use the \fB\-o\fR option as the last
791 option on the linker command line. For example consider:
792 .Sp
793 .Vb 2
794 \& ld \-o $(EXE) $(OBJS)
795 \& ld $(OBJS) \-o $(EXE)
796 .Ve
797 .Sp
798 If the \fBEXE\fR variable is not defined for some reason, the first
799 version of the linker command could end up deleting one of the object
800 files (the first one in the \fBOBJS\fR list) whereas the second
801 version of the linker command will generate an error message and not
802 delete anything.
803 .IP \fB\-\-dependency\-file=\fR\fIdepfile\fR 4
804 .IX Item "--dependency-file=depfile"
805 Write a \fIdependency file\fR to \fIdepfile\fR. This file contains a rule
806 suitable for \f(CW\*(C`make\*(C'\fR describing the output file and all the input files
807 that were read to produce it. The output is similar to the compiler's
808 output with \fB\-M \-MP\fR. Note that there is no option like the compiler's \fB\-MM\fR,
809 to exclude "system files" (which is not a well-specified concept in the
810 linker, unlike "system headers" in the compiler). So the output from
811 \&\fB\-\-dependency\-file\fR is always specific to the exact state of the
812 installation where it was produced, and should not be copied into
813 distributed makefiles without careful editing.
814 .IP "\fB\-O\fR \fIlevel\fR" 4
815 .IX Item "-O level"
816 If \fIlevel\fR is a numeric values greater than zero \fBld\fR optimizes
817 the output. This might take significantly longer and therefore probably
818 should only be enabled for the final binary. At the moment this
819 option only affects ELF shared library generation. Future releases of
820 the linker may make more use of this option. Also currently there is
821 no difference in the linker's behaviour for different non-zero values
822 of this option. Again this may change with future releases.
823 .IP "\fB\-plugin\fR \fIname\fR" 4
824 .IX Item "-plugin name"
825 Involve a plugin in the linking process. The \fIname\fR parameter is
826 the absolute filename of the plugin. Usually this parameter is
827 automatically added by the complier, when using link time
828 optimization, but users can also add their own plugins if they so
829 wish.
830 .Sp
831 Note that the location of the compiler originated plugins is different
832 from the place where the \fBar\fR, \fBnm\fR and
833 \&\fBranlib\fR programs search for their plugins. In order for
834 those commands to make use of a compiler based plugin it must first be
835 copied into the \fI${libdir}/bfd\-plugins\fR directory. All gcc
836 based linker plugins are backward compatible, so it is sufficient to
837 just copy in the newest one.
838 .IP \fB\-\-push\-state\fR 4
839 .IX Item "--push-state"
840 The \fB\-\-push\-state\fR allows one to preserve the current state of the
841 flags which govern the input file handling so that they can all be
842 restored with one corresponding \fB\-\-pop\-state\fR option.
843 .Sp
844 The option which are covered are: \fB\-Bdynamic\fR, \fB\-Bstatic\fR,
845 \&\fB\-dn\fR, \fB\-dy\fR, \fB\-call_shared\fR, \fB\-non_shared\fR,
846 \&\fB\-static\fR, \fB\-N\fR, \fB\-n\fR, \fB\-\-whole\-archive\fR,
847 \&\fB\-\-no\-whole\-archive\fR, \fB\-r\fR, \fB\-Ur\fR,
848 \&\fB\-\-copy\-dt\-needed\-entries\fR, \fB\-\-no\-copy\-dt\-needed\-entries\fR,
849 \&\fB\-\-as\-needed\fR, \fB\-\-no\-as\-needed\fR, and \fB\-a\fR.
850 .Sp
851 One target for this option are specifications for \fIpkg-config\fR. When
852 used with the \fB\-\-libs\fR option all possibly needed libraries are
853 listed and then possibly linked with all the time. It is better to return
854 something as follows:
855 .Sp
856 .Vb 1
857 \& \-Wl,\-\-push\-state,\-\-as\-needed \-libone \-libtwo \-Wl,\-\-pop\-state
858 .Ve
859 .IP \fB\-\-pop\-state\fR 4
860 .IX Item "--pop-state"
861 Undoes the effect of \-\-push\-state, restores the previous values of the
862 flags governing input file handling.
863 .IP \fB\-q\fR 4
864 .IX Item "-q"
865 .PD 0
866 .IP \fB\-\-emit\-relocs\fR 4
867 .IX Item "--emit-relocs"
868 .PD
869 Leave relocation sections and contents in fully linked executables.
870 Post link analysis and optimization tools may need this information in
871 order to perform correct modifications of executables. This results
872 in larger executables.
873 .Sp
874 This option is currently only supported on ELF platforms.
875 .IP \fB\-\-force\-dynamic\fR 4
876 .IX Item "--force-dynamic"
877 Force the output file to have dynamic sections. This option is specific
878 to VxWorks targets.
879 .IP \fB\-r\fR 4
880 .IX Item "-r"
881 .PD 0
882 .IP \fB\-\-relocatable\fR 4
883 .IX Item "--relocatable"
884 .PD
885 Generate relocatable output\-\-\-i.e., generate an output file that can in
886 turn serve as input to \fBld\fR. This is often called \fIpartial
887 linking\fR. As a side effect, in environments that support standard Unix
888 magic numbers, this option also sets the output file's magic number to
889 \&\f(CW\*(C`OMAGIC\*(C'\fR.
890 If this option is not specified, an absolute file is produced. When
891 linking C++ programs, this option \fIwill not\fR resolve references to
892 constructors; to do that, use \fB\-Ur\fR.
893 .Sp
894 When an input file does not have the same format as the output file,
895 partial linking is only supported if that input file does not contain any
896 relocations. Different output formats can have further restrictions; for
897 example some \f(CW\*(C`a.out\*(C'\fR\-based formats do not support partial linking
898 with input files in other formats at all.
899 .Sp
900 When the relocatable output contains both contents which require
901 link-time optimization (LTO) and contents which don't require LTO,
902 a .gnu_object_only section will be created to contain a relocatable
903 object file, as if \fB\-r\fR is applied to all relocatable inputs
904 which don't require LTO. When processing a relocatable input with
905 a .gnu_object_only section, the linker will extract the .gnu_object_only
906 section as a separate input.
907 .Sp
908 Note that since \fB\-r\fR groups some sections from different input files
909 together, there may be negative impacts on code size and locality in
910 final executable or shared library.
911 .Sp
912 This option does the same thing as \fB\-i\fR.
913 .IP "\fB\-R\fR \fIfilename\fR" 4
914 .IX Item "-R filename"
915 .PD 0
916 .IP \fB\-\-just\-symbols=\fR\fIfilename\fR 4
917 .IX Item "--just-symbols=filename"
918 .PD
919 Read symbol names and their addresses from \fIfilename\fR, but do not
920 relocate it or include it in the output. This allows your output file
921 to refer symbolically to absolute locations of memory defined in other
922 programs. You may use this option more than once.
923 .Sp
924 For compatibility with other ELF linkers, if the \fB\-R\fR option is
925 followed by a directory name, rather than a file name, it is treated as
926 the \fB\-rpath\fR option.
927 .IP \fB\-\-rosegment\fR 4
928 .IX Item "--rosegment"
929 .PD 0
930 .IP \fB\-\-no\-rosegment\fR 4
931 .IX Item "--no-rosegment"
932 .PD
933 Attempt to ensure that only a single read-only, non-code segment is
934 created. Only useful when used in conjunction with the \fB\-z
935 separate-code\fR option. The resulting binaries should be smaller than
936 if \fB\-z separate-code\fR is used on its own. Without this option,
937 or if \fB\-\-no\-rosegment\fR is specified, the \fB\-z separate-code\fR
938 option will create two read-only segments, one before the code segment
939 and one after it.
940 .Sp
941 The name of the options are misleading, but they have been chosen in
942 order for the linker to be compatible with the LLD and GOLD linkers.
943 .Sp
944 Thse options are only supported by ELF targets.
945 .IP \fB\-s\fR 4
946 .IX Item "-s"
947 .PD 0
948 .IP \fB\-\-strip\-all\fR 4
949 .IX Item "--strip-all"
950 .PD
951 Omit all symbol information from the output file.
952 .IP \fB\-S\fR 4
953 .IX Item "-S"
954 .PD 0
955 .IP \fB\-\-strip\-debug\fR 4
956 .IX Item "--strip-debug"
957 .PD
958 Omit debugger symbol information (but not all symbols) from the output file.
959 .IP \fB\-\-strip\-discarded\fR 4
960 .IX Item "--strip-discarded"
961 .PD 0
962 .IP \fB\-\-no\-strip\-discarded\fR 4
963 .IX Item "--no-strip-discarded"
964 .PD
965 Omit (or do not omit) global symbols defined in discarded sections.
966 Enabled by default.
967 .IP \fB\-plugin\-save\-temps\fR 4
968 .IX Item "-plugin-save-temps"
969 Store the plugin "temporary" intermediate files permanently.
970 .IP \fB\-t\fR 4
971 .IX Item "-t"
972 .PD 0
973 .IP \fB\-\-trace\fR 4
974 .IX Item "--trace"
975 .PD
976 Print the names of the input files as \fBld\fR processes them. If
977 \&\fB\-t\fR is given twice then members within archives are also printed.
978 \&\fB\-t\fR output is useful to generate a list of all the object files
979 and scripts involved in linking, for example, when packaging files for
980 a linker bug report.
981 .IP "\fB\-T\fR \fIscriptfile\fR" 4
982 .IX Item "-T scriptfile"
983 .PD 0
984 .IP \fB\-\-script=\fR\fIscriptfile\fR 4
985 .IX Item "--script=scriptfile"
986 .PD
987 Use \fIscriptfile\fR as the linker script. This script replaces
988 \&\fBld\fR's default linker script (rather than adding to it),
989 unless the script contains \f(CW\*(C`INSERT\*(C'\fR, so \fIcommandfile\fR must
990 specify everything necessary to describe the output file.
991 .Sp
992 If \fIscriptfile\fR does not exist in the current directory, \f(CW\*(C`ld\*(C'\fR
993 looks for it in the directories specified by any preceding \fB\-L\fR
994 options.
995 .Sp
996 Command line options that appear before the \fB\-T\fR option can
997 affect the script, but command line options that appear after it do
998 not.
999 .Sp
1000 Multiple \fB\-T\fR options will accumulate if they are augmenting the
1001 current script, otherwise the last, non-augmenting, \fB\-T\fR option
1002 will be used.
1003 .Sp
1004 There are other ways of specifying linker scripts. See
1005 .IP "\fB\-dT\fR \fIscriptfile\fR" 4
1006 .IX Item "-dT scriptfile"
1007 .PD 0
1008 .IP \fB\-\-default\-script=\fR\fIscriptfile\fR 4
1009 .IX Item "--default-script=scriptfile"
1010 .PD
1011 Use \fIscriptfile\fR as the default linker script.
1012 .Sp
1013 This option is similar to the \fB\-\-script\fR option except that
1014 processing of the script is delayed until after the rest of the
1015 command line has been processed. This allows options placed after the
1016 \&\fB\-\-default\-script\fR option on the command line to affect the
1017 behaviour of the linker script, which can be important when the linker
1018 command line cannot be directly controlled by the user. (eg because
1019 the command line is being constructed by another tool, such as
1020 \&\fBgcc\fR).
1021 .IP "\fB\-u\fR \fIsymbol\fR" 4
1022 .IX Item "-u symbol"
1023 .PD 0
1024 .IP \fB\-\-undefined=\fR\fIsymbol\fR 4
1025 .IX Item "--undefined=symbol"
1026 .PD
1027 Force \fIsymbol\fR to be entered in the output file as an undefined
1028 symbol. Doing this may, for example, trigger linking of additional
1029 modules from standard libraries. \fB\-u\fR may be repeated with
1030 different option arguments to enter additional undefined symbols. This
1031 option is equivalent to the \f(CW\*(C`EXTERN\*(C'\fR linker script command.
1032 .Sp
1033 If this option is being used to force additional modules to be pulled
1034 into the link, and if it is an error for the symbol to remain
1035 undefined, then the option \fB\-\-require\-defined\fR should be used
1036 instead.
1037 .IP \fB\-\-require\-defined=\fR\fIsymbol\fR 4
1038 .IX Item "--require-defined=symbol"
1039 Require that \fIsymbol\fR is defined in the output file. This option
1040 is the same as option \fB\-\-undefined\fR except that if \fIsymbol\fR
1041 is not defined in the output file then the linker will issue an error
1042 and exit. The same effect can be achieved in a linker script by using
1043 \&\f(CW\*(C`EXTERN\*(C'\fR, \f(CW\*(C`ASSERT\*(C'\fR and \f(CW\*(C`DEFINED\*(C'\fR together. This option
1044 can be used multiple times to require additional symbols.
1045 .IP \fB\-Ur\fR 4
1046 .IX Item "-Ur"
1047 For programs that do not use constructors or destructors, or for ELF
1048 based systems this option is equivalent to \fB\-r\fR: it generates
1049 relocatable output\-\-\-i.e., an output file that can in turn serve as
1050 input to \fBld\fR. For other binaries however the \fB\-Ur\fR
1051 option is similar to \fB\-r\fR but it also resolves references to
1052 constructors and destructors.
1053 .Sp
1054 For those systems where \fB\-r\fR and \fB\-Ur\fR behave
1055 differently, it does not work to use \fB\-Ur\fR on files that were
1056 themselves linked with \fB\-Ur\fR; once the constructor table has
1057 been built, it cannot be added to. Use \fB\-Ur\fR only for the last
1058 partial link, and \fB\-r\fR for the others.
1059 .IP \fB\-\-orphan\-handling=\fR\fIMODE\fR 4
1060 .IX Item "--orphan-handling=MODE"
1061 Control how orphan sections are handled. An orphan section is one not
1062 specifically mentioned in a linker script.
1063 .Sp
1064 \&\fIMODE\fR can have any of the following values:
1065 .RS 4
1066 .ie n .IP """place""" 4
1067 .el .IP \f(CWplace\fR 4
1068 .IX Item "place"
1069 Orphan sections are placed into a suitable output section following
1070 the strategy described in \fBOrphan Sections\fR. The option
1071 \&\fB\-\-unique\fR also affects how sections are placed.
1072 .ie n .IP """discard""" 4
1073 .el .IP \f(CWdiscard\fR 4
1074 .IX Item "discard"
1075 All orphan sections are discarded, by placing them in the
1076 \&\fB/DISCARD/\fR section.
1077 .ie n .IP """warn""" 4
1078 .el .IP \f(CWwarn\fR 4
1079 .IX Item "warn"
1080 The linker will place the orphan section as for \f(CW\*(C`place\*(C'\fR and also
1081 issue a warning.
1082 .ie n .IP """error""" 4
1083 .el .IP \f(CWerror\fR 4
1084 .IX Item "error"
1085 The linker will exit with an error if any orphan section is found.
1086 .RE
1087 .RS 4
1088 .Sp
1089 The default if \fB\-\-orphan\-handling\fR is not given is \f(CW\*(C`place\*(C'\fR.
1090 .RE
1091 .IP \fB\-\-unique[=\fR\fISECTION\fR\fB]\fR 4
1092 .IX Item "--unique[=SECTION]"
1093 Creates a separate output section for every input section matching
1094 \&\fISECTION\fR, or if the optional wildcard \fISECTION\fR argument is
1095 missing, for every orphan input section. An orphan section is one not
1096 specifically mentioned in a linker script. You may use this option
1097 multiple times on the command line; It prevents the normal merging of
1098 input sections with the same name, overriding output section assignments
1099 in a linker script.
1100 .IP \fB\-v\fR 4
1101 .IX Item "-v"
1102 .PD 0
1103 .IP \fB\-\-version\fR 4
1104 .IX Item "--version"
1105 .IP \fB\-V\fR 4
1106 .IX Item "-V"
1107 .PD
1108 Display the version number for \fBld\fR. The \fB\-V\fR option also
1109 lists the supported emulations. See also the description of the
1110 \&\fB\-\-enable\-linker\-version\fR in \fBOptions,,Command\-line Options\fR
1111 which can be used to insert the linker version string into a binary.
1112 .IP \fB\-x\fR 4
1113 .IX Item "-x"
1114 .PD 0
1115 .IP \fB\-\-discard\-all\fR 4
1116 .IX Item "--discard-all"
1117 .PD
1118 Delete all local symbols.
1119 .IP \fB\-X\fR 4
1120 .IX Item "-X"
1121 .PD 0
1122 .IP \fB\-\-discard\-locals\fR 4
1123 .IX Item "--discard-locals"
1124 .PD
1125 Delete all temporary local symbols. (These symbols start with
1126 system-specific local label prefixes, typically \fB.L\fR for ELF systems
1127 or \fBL\fR for traditional a.out systems.)
1128 .IP "\fB\-y\fR \fIsymbol\fR" 4
1129 .IX Item "-y symbol"
1130 .PD 0
1131 .IP \fB\-\-trace\-symbol=\fR\fIsymbol\fR 4
1132 .IX Item "--trace-symbol=symbol"
1133 .PD
1134 Print the name of each linked file in which \fIsymbol\fR appears. This
1135 option may be given any number of times. On many systems it is necessary
1136 to prepend an underscore.
1137 .Sp
1138 This option is useful when you have an undefined symbol in your link but
1139 don't know where the reference is coming from.
1140 .IP "\fB\-Y\fR \fIpath\fR" 4
1141 .IX Item "-Y path"
1142 Add \fIpath\fR to the default library search path. This option exists
1143 for Solaris compatibility.
1144 .IP "\fB\-z\fR \fIkeyword\fR" 4
1145 .IX Item "-z keyword"
1146 The recognized keywords are:
1147 .RS 4
1148 .IP \fBcall\-nop=prefix\-addr\fR 4
1149 .IX Item "call-nop=prefix-addr"
1150 .PD 0
1151 .IP \fBcall\-nop=suffix\-nop\fR 4
1152 .IX Item "call-nop=suffix-nop"
1153 .IP \fBcall\-nop=prefix\-\fR\fIbyte\fR 4
1154 .IX Item "call-nop=prefix-byte"
1155 .IP \fBcall\-nop=suffix\-\fR\fIbyte\fR 4
1156 .IX Item "call-nop=suffix-byte"
1157 .PD
1158 Specify the 1\-byte \f(CW\*(C`NOP\*(C'\fR padding when transforming indirect call
1159 to a locally defined function, foo, via its GOT slot.
1160 \&\fBcall\-nop=prefix\-addr\fR generates \f(CW\*(C`0x67 call foo\*(C'\fR.
1161 \&\fBcall\-nop=suffix\-nop\fR generates \f(CW\*(C`call foo 0x90\*(C'\fR.
1162 \&\fBcall\-nop=prefix\-\fR\fIbyte\fR generates \f(CW\*(C`\fR\f(CIbyte\fR\f(CW call foo\*(C'\fR.
1163 \&\fBcall\-nop=suffix\-\fR\fIbyte\fR generates \f(CW\*(C`call foo \fR\f(CIbyte\fR\f(CW\*(C'\fR.
1164 Supported for i386 and x86_64.
1165 .IP \fBcet\-report=none\fR 4
1166 .IX Item "cet-report=none"
1167 .PD 0
1168 .IP \fBcet\-report=warning\fR 4
1169 .IX Item "cet-report=warning"
1170 .IP \fBcet\-report=error\fR 4
1171 .IX Item "cet-report=error"
1172 .PD
1173 Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_IBT and
1174 GNU_PROPERTY_X86_FEATURE_1_SHSTK properties in input .note.gnu.property
1175 section. \fBcet\-report=none\fR, which is the default, will make the
1176 linker not report missing properties in input files.
1177 \&\fBcet\-report=warning\fR will make the linker issue a warning for
1178 missing properties in input files. \fBcet\-report=error\fR will make
1179 the linker issue an error for missing properties in input files.
1180 Note that \fBibt\fR will turn off the missing
1181 GNU_PROPERTY_X86_FEATURE_1_IBT property report and \fBshstk\fR will
1182 turn off the missing GNU_PROPERTY_X86_FEATURE_1_SHSTK property report.
1183 Supported for Linux/i386 and Linux/x86_64.
1184 .IP \fBcombreloc\fR 4
1185 .IX Item "combreloc"
1186 .PD 0
1187 .IP \fBnocombreloc\fR 4
1188 .IX Item "nocombreloc"
1189 .PD
1190 Combine multiple dynamic relocation sections and sort to improve
1191 dynamic symbol lookup caching. Do not do this if \fBnocombreloc\fR.
1192 .IP \fBcommon\fR 4
1193 .IX Item "common"
1194 .PD 0
1195 .IP \fBnocommon\fR 4
1196 .IX Item "nocommon"
1197 .PD
1198 Generate common symbols with STT_COMMON type during a relocatable
1199 link. Use STT_OBJECT type if \fBnocommon\fR.
1200 .IP \fBcommon\-page\-size=\fR\fIvalue\fR 4
1201 .IX Item "common-page-size=value"
1202 Set the page size most commonly used to \fIvalue\fR. Memory image
1203 layout will be optimized to minimize memory pages if the system is
1204 using pages of this size.
1205 .IP \fBdefs\fR 4
1206 .IX Item "defs"
1207 Report unresolved symbol references from regular object files. This
1208 is done even if the linker is creating a non-symbolic shared library.
1209 This option is the inverse of \fB\-z undefs\fR.
1210 .IP \fBdynamic-undefined-weak\fR 4
1211 .IX Item "dynamic-undefined-weak"
1212 .PD 0
1213 .IP \fBnodynamic-undefined-weak\fR 4
1214 .IX Item "nodynamic-undefined-weak"
1215 .PD
1216 Make undefined weak symbols dynamic when building a dynamic object,
1217 if they are referenced from a regular object file and not forced local
1218 by symbol visibility or versioning. Do not make them dynamic if
1219 \&\fBnodynamic-undefined-weak\fR. If neither option is given, a target
1220 may default to either option being in force, or make some other
1221 selection of undefined weak symbols dynamic. Not all targets support
1222 these options.
1223 .IP \fBexecstack\fR 4
1224 .IX Item "execstack"
1225 Marks the object as requiring executable stack.
1226 .IP \fBglobal\fR 4
1227 .IX Item "global"
1228 This option is only meaningful when building a shared object. It makes
1229 the symbols defined by this shared object available for symbol resolution
1230 of subsequently loaded libraries.
1231 .IP \fBglobalaudit\fR 4
1232 .IX Item "globalaudit"
1233 This option is only meaningful when building a dynamic executable.
1234 This option marks the executable as requiring global auditing by
1235 setting the \f(CW\*(C`DF_1_GLOBAUDIT\*(C'\fR bit in the \f(CW\*(C`DT_FLAGS_1\*(C'\fR dynamic
1236 tag. Global auditing requires that any auditing library defined via
1237 the \fB\-\-depaudit\fR or \fB\-P\fR command-line options be run for
1238 all dynamic objects loaded by the application.
1239 .IP \fBibtplt\fR 4
1240 .IX Item "ibtplt"
1241 Generate Intel Indirect Branch Tracking (IBT) enabled PLT entries.
1242 Supported for Linux/i386 and Linux/x86_64.
1243 .IP \fBibt\fR 4
1244 .IX Item "ibt"
1245 Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property section
1246 to indicate compatibility with IBT. This also implies \fBibtplt\fR.
1247 Supported for Linux/i386 and Linux/x86_64.
1248 .IP \fBindirect-extern-access\fR 4
1249 .IX Item "indirect-extern-access"
1250 .PD 0
1251 .IP \fBnoindirect-extern-access\fR 4
1252 .IX Item "noindirect-extern-access"
1253 .PD
1254 Generate GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS in
1255 \&.note.gnu.property section to indicate that object file requires
1256 canonical function pointers and cannot be used with copy relocation.
1257 This option also implies \fBnoextern-protected-data\fR and
1258 \&\fBnocopyreloc\fR. Supported for i386 and x86\-64.
1259 .Sp
1260 \&\fBnoindirect-extern-access\fR removes
1261 GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS from .note.gnu.property
1262 section.
1263 .IP \fBinitfirst\fR 4
1264 .IX Item "initfirst"
1265 This option is only meaningful when building a shared object.
1266 It marks the object so that its runtime initialization will occur
1267 before the runtime initialization of any other objects brought into
1268 the process at the same time. Similarly the runtime finalization of
1269 the object will occur after the runtime finalization of any other
1270 objects.
1271 .IP \fBinterpose\fR 4
1272 .IX Item "interpose"
1273 Specify that the dynamic loader should modify its symbol search order
1274 so that symbols in this shared library interpose all other shared
1275 libraries not so marked.
1276 .IP \fBunique\fR 4
1277 .IX Item "unique"
1278 .PD 0
1279 .IP \fBnounique\fR 4
1280 .IX Item "nounique"
1281 .PD
1282 When generating a shared library or other dynamically loadable ELF
1283 object mark it as one that should (by default) only ever be loaded once,
1284 and only in the main namespace (when using \f(CW\*(C`dlmopen\*(C'\fR). This is
1285 primarily used to mark fundamental libraries such as libc, libpthread et
1286 al which do not usually function correctly unless they are the sole instances
1287 of themselves. This behaviour can be overridden by the \f(CW\*(C`dlmopen\*(C'\fR caller
1288 and does not apply to certain loading mechanisms (such as audit libraries).
1289 .IP \fBlam\-u48\fR 4
1290 .IX Item "lam-u48"
1291 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U48 in .note.gnu.property section
1292 to indicate compatibility with Intel LAM_U48. Supported for Linux/x86_64.
1293 .IP \fBlam\-u57\fR 4
1294 .IX Item "lam-u57"
1295 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U57 in .note.gnu.property section
1296 to indicate compatibility with Intel LAM_U57. Supported for Linux/x86_64.
1297 .IP \fBlam\-u48\-report=none\fR 4
1298 .IX Item "lam-u48-report=none"
1299 .PD 0
1300 .IP \fBlam\-u48\-report=warning\fR 4
1301 .IX Item "lam-u48-report=warning"
1302 .IP \fBlam\-u48\-report=error\fR 4
1303 .IX Item "lam-u48-report=error"
1304 .PD
1305 Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U48
1306 property in input .note.gnu.property section.
1307 \&\fBlam\-u48\-report=none\fR, which is the default, will make the
1308 linker not report missing properties in input files.
1309 \&\fBlam\-u48\-report=warning\fR will make the linker issue a warning for
1310 missing properties in input files. \fBlam\-u48\-report=error\fR will
1311 make the linker issue an error for missing properties in input files.
1312 Supported for Linux/x86_64.
1313 .IP \fBlam\-u57\-report=none\fR 4
1314 .IX Item "lam-u57-report=none"
1315 .PD 0
1316 .IP \fBlam\-u57\-report=warning\fR 4
1317 .IX Item "lam-u57-report=warning"
1318 .IP \fBlam\-u57\-report=error\fR 4
1319 .IX Item "lam-u57-report=error"
1320 .PD
1321 Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U57
1322 property in input .note.gnu.property section.
1323 \&\fBlam\-u57\-report=none\fR, which is the default, will make the
1324 linker not report missing properties in input files.
1325 \&\fBlam\-u57\-report=warning\fR will make the linker issue a warning for
1326 missing properties in input files. \fBlam\-u57\-report=error\fR will
1327 make the linker issue an error for missing properties in input files.
1328 Supported for Linux/x86_64.
1329 .IP \fBlam\-report=none\fR 4
1330 .IX Item "lam-report=none"
1331 .PD 0
1332 .IP \fBlam\-report=warning\fR 4
1333 .IX Item "lam-report=warning"
1334 .IP \fBlam\-report=error\fR 4
1335 .IX Item "lam-report=error"
1336 .PD
1337 Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
1338 GNU_PROPERTY_X86_FEATURE_1_LAM_U57 properties in input .note.gnu.property
1339 section. \fBlam\-report=none\fR, which is the default, will make the
1340 linker not report missing properties in input files.
1341 \&\fBlam\-report=warning\fR will make the linker issue a warning for
1342 missing properties in input files. \fBlam\-report=error\fR will make
1343 the linker issue an error for missing properties in input files.
1344 Supported for Linux/x86_64.
1345 .IP \fBlazy\fR 4
1346 .IX Item "lazy"
1347 When generating an executable or shared library, mark it to tell the
1348 dynamic linker to defer function call resolution to the point when
1349 the function is called (lazy binding), rather than at load time.
1350 Lazy binding is the default.
1351 .IP \fBloadfltr\fR 4
1352 .IX Item "loadfltr"
1353 Specify that the object's filters be processed immediately at runtime.
1354 .IP \fBmax\-page\-size=\fR\fIvalue\fR 4
1355 .IX Item "max-page-size=value"
1356 Set the maximum memory page size supported to \fIvalue\fR.
1357 .IP \fBmark-plt\fR 4
1358 .IX Item "mark-plt"
1359 .PD 0
1360 .IP \fBnomark-plt\fR 4
1361 .IX Item "nomark-plt"
1362 .PD
1363 Mark PLT entries with dynamic tags, DT_X86_64_PLT, DT_X86_64_PLTSZ and
1364 DT_X86_64_PLTENT. Since this option stores a non-zero value in the
1365 r_addend field of R_X86_64_JUMP_SLOT relocations, the resulting
1366 executables and shared libraries are incompatible with dynamic linkers,
1367 such as those in older versions of glibc without the change to ignore
1368 r_addend in R_X86_64_GLOB_DAT and R_X86_64_JUMP_SLOT relocations, which
1369 don't ignore the r_addend field of R_X86_64_JUMP_SLOT relocations.
1370 Supported for x86_64.
1371 .IP \fBmuldefs\fR 4
1372 .IX Item "muldefs"
1373 Allow multiple definitions.
1374 .IP \fBnocopyreloc\fR 4
1375 .IX Item "nocopyreloc"
1376 Disable linker generated .dynbss variables used in place of variables
1377 defined in shared libraries. May result in dynamic text relocations.
1378 .IP \fBnodefaultlib\fR 4
1379 .IX Item "nodefaultlib"
1380 Specify that the dynamic loader search for dependencies of this object
1381 should ignore any default library search paths.
1382 .IP \fBnodelete\fR 4
1383 .IX Item "nodelete"
1384 Specify that the object shouldn't be unloaded at runtime.
1385 .IP \fBnodlopen\fR 4
1386 .IX Item "nodlopen"
1387 Specify that the object is not available to \f(CW\*(C`dlopen\*(C'\fR.
1388 .IP \fBnodump\fR 4
1389 .IX Item "nodump"
1390 Specify that the object can not be dumped by \f(CW\*(C`dldump\*(C'\fR.
1391 .IP \fBnoexecstack\fR 4
1392 .IX Item "noexecstack"
1393 Marks the object as not requiring executable stack.
1394 .IP \fBnoextern-protected-data\fR 4
1395 .IX Item "noextern-protected-data"
1396 Don't treat protected data symbols as external when building a shared
1397 library. This option overrides the linker backend default. It can be
1398 used to work around incorrect relocations against protected data symbols
1399 generated by compiler. Updates on protected data symbols by another
1400 module aren't visible to the resulting shared library. Supported for
1401 i386 and x86\-64.
1402 .IP \fBnoreloc-overflow\fR 4
1403 .IX Item "noreloc-overflow"
1404 Disable relocation overflow check. This can be used to disable
1405 relocation overflow check if there will be no dynamic relocation
1406 overflow at run-time. Supported for x86_64.
1407 .IP \fBmemory-seal\fR 4
1408 .IX Item "memory-seal"
1409 .PD 0
1410 .IP \fBnomemory-seal\fR 4
1411 .IX Item "nomemory-seal"
1412 .PD
1413 Instruct the executable or shared library that the all PT_LOAD segments
1414 should be sealed to avoid further manipulation (such as changing the
1415 protection flags, the segment size, or remove the mapping).
1416 This is a security hardening that requires system support. This
1417 generates GNU_PROPERTY_MEMORY_SEAL in .note.gnu.property section
1418 .IP \fBnow\fR 4
1419 .IX Item "now"
1420 When generating an executable or shared library, mark it to tell the
1421 dynamic linker to resolve all symbols when the program is started, or
1422 when the shared library is loaded by dlopen, instead of deferring
1423 function call resolution to the point when the function is first
1424 called.
1425 .IP \fBorigin\fR 4
1426 .IX Item "origin"
1427 Specify that the object requires \fR\f(CB$ORIGIN\fR\fB\fR handling in paths.
1428 .IP \fBpack-relative-relocs\fR 4
1429 .IX Item "pack-relative-relocs"
1430 .PD 0
1431 .IP \fBnopack-relative-relocs\fR 4
1432 .IX Item "nopack-relative-relocs"
1433 .PD
1434 Generate compact relative relocation in position-independent executable
1435 and shared library. It adds \f(CW\*(C`DT_RELR\*(C'\fR, \f(CW\*(C`DT_RELRSZ\*(C'\fR and
1436 \&\f(CW\*(C`DT_RELRENT\*(C'\fR entries to the dynamic section. It is ignored when
1437 building position-dependent executable and relocatable output.
1438 \&\fBnopack-relative-relocs\fR is the default, which disables compact
1439 relative relocation. When linked against the GNU C Library, a
1440 GLIBC_ABI_DT_RELR symbol version dependency on the shared C Library is
1441 added to the output. Supported for i386 and x86\-64.
1442 .IP \fBrelro\fR 4
1443 .IX Item "relro"
1444 .PD 0
1445 .IP \fBnorelro\fR 4
1446 .IX Item "norelro"
1447 .PD
1448 Create an ELF \f(CW\*(C`PT_GNU_RELRO\*(C'\fR segment header in the object. This
1449 specifies a memory segment that should be made read-only after
1450 relocation, if supported. Specifying \fBcommon-page-size\fR smaller
1451 than the system page size will render this protection ineffective.
1452 Don't create an ELF \f(CW\*(C`PT_GNU_RELRO\*(C'\fR segment if \fBnorelro\fR.
1453 .IP \fBreport-relative-reloc\fR 4
1454 .IX Item "report-relative-reloc"
1455 Report dynamic relative relocations generated by linker. Supported for
1456 Linux/i386 and Linux/x86_64.
1457 .IP \fBsectionheader\fR 4
1458 .IX Item "sectionheader"
1459 .PD 0
1460 .IP \fBnosectionheader\fR 4
1461 .IX Item "nosectionheader"
1462 .PD
1463 Generate section header. Don't generate section header if
1464 \&\fBnosectionheader\fR is used. \fBsectionheader\fR is the default.
1465 .IP \fBseparate-code\fR 4
1466 .IX Item "separate-code"
1467 .PD 0
1468 .IP \fBnoseparate-code\fR 4
1469 .IX Item "noseparate-code"
1470 .PD
1471 Create separate code \f(CW\*(C`PT_LOAD\*(C'\fR segment header in the object. This
1472 specifies a memory segment that should contain only instructions and must
1473 be in wholly disjoint pages from any other data. Don't create separate
1474 code \f(CW\*(C`PT_LOAD\*(C'\fR segment if \fBnoseparate-code\fR is used.
1475 .IP \fBshstk\fR 4
1476 .IX Item "shstk"
1477 Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in .note.gnu.property section
1478 to indicate compatibility with Intel Shadow Stack. Supported for
1479 Linux/i386 and Linux/x86_64.
1480 .IP \fBstack\-size=\fR\fIvalue\fR 4
1481 .IX Item "stack-size=value"
1482 Specify a stack size for an ELF \f(CW\*(C`PT_GNU_STACK\*(C'\fR segment.
1483 Specifying zero will override any default non-zero sized
1484 \&\f(CW\*(C`PT_GNU_STACK\*(C'\fR segment creation.
1485 .IP \fBstart-stop-gc\fR 4
1486 .IX Item "start-stop-gc"
1487 .PD 0
1488 .IP \fBnostart-stop-gc\fR 4
1489 .IX Item "nostart-stop-gc"
1490 .PD
1491 When \fB\-\-gc\-sections\fR is in effect, a reference from a retained
1492 section to \f(CW\*(C`_\|_start_SECNAME\*(C'\fR or \f(CW\*(C`_\|_stop_SECNAME\*(C'\fR causes all
1493 input sections named \f(CW\*(C`SECNAME\*(C'\fR to also be retained, if
1494 \&\f(CW\*(C`SECNAME\*(C'\fR is representable as a C identifier and either
1495 \&\f(CW\*(C`_\|_start_SECNAME\*(C'\fR or \f(CW\*(C`_\|_stop_SECNAME\*(C'\fR is synthesized by the
1496 linker. \fB\-z start-stop-gc\fR disables this effect, allowing
1497 sections to be garbage collected as if the special synthesized symbols
1498 were not defined. \fB\-z start-stop-gc\fR has no effect on a
1499 definition of \f(CW\*(C`_\|_start_SECNAME\*(C'\fR or \f(CW\*(C`_\|_stop_SECNAME\*(C'\fR in an
1500 object file or linker script. Such a definition will prevent the
1501 linker providing a synthesized \f(CW\*(C`_\|_start_SECNAME\*(C'\fR or
1502 \&\f(CW\*(C`_\|_stop_SECNAME\*(C'\fR respectively, and therefore the special
1503 treatment by garbage collection for those references.
1504 .IP \fBstart\-stop\-visibility=\fR\fIvalue\fR 4
1505 .IX Item "start-stop-visibility=value"
1506 Specify the ELF symbol visibility for synthesized
1507 \&\f(CW\*(C`_\|_start_SECNAME\*(C'\fR and \f(CW\*(C`_\|_stop_SECNAME\*(C'\fR symbols. \fIvalue\fR must be exactly \fBdefault\fR,
1508 \&\fBinternal\fR, \fBhidden\fR, or \fBprotected\fR. If no \fB\-z
1509 start-stop-visibility\fR option is given, \fBprotected\fR is used for
1510 compatibility with historical practice. However, it's highly
1511 recommended to use \fB\-z start\-stop\-visibility=hidden\fR in new
1512 programs and shared libraries so that these symbols are not exported
1513 between shared objects, which is not usually what's intended.
1514 .IP \fBtext\fR 4
1515 .IX Item "text"
1516 .PD 0
1517 .IP \fBnotext\fR 4
1518 .IX Item "notext"
1519 .IP \fBtextoff\fR 4
1520 .IX Item "textoff"
1521 .PD
1522 Report an error if DT_TEXTREL is set, i.e., if the position-independent
1523 or shared object has dynamic relocations in read-only sections. Don't
1524 report an error if \fBnotext\fR or \fBtextoff\fR.
1525 .IP \fBundefs\fR 4
1526 .IX Item "undefs"
1527 Do not report unresolved symbol references from regular object files,
1528 either when creating an executable, or when creating a shared library.
1529 This option is the inverse of \fB\-z defs\fR.
1530 .IP \fBunique-symbol\fR 4
1531 .IX Item "unique-symbol"
1532 .PD 0
1533 .IP \fBnounique-symbol\fR 4
1534 .IX Item "nounique-symbol"
1535 .PD
1536 Avoid duplicated local symbol names in the symbol string table. Append
1537 ".\f(CW\*(C`number\*(C'\fR" to duplicated local symbol names if \fBunique-symbol\fR
1538 is used. \fBnounique-symbol\fR is the default.
1539 .IP \fBx86\-64\-baseline\fR 4
1540 .IX Item "x86-64-baseline"
1541 .PD 0
1542 .IP \fBx86\-64\-v2\fR 4
1543 .IX Item "x86-64-v2"
1544 .IP \fBx86\-64\-v3\fR 4
1545 .IX Item "x86-64-v3"
1546 .IP \fBx86\-64\-v4\fR 4
1547 .IX Item "x86-64-v4"
1548 .PD
1549 Specify the x86\-64 ISA level needed in .note.gnu.property section.
1550 \&\fBx86\-64\-baseline\fR generates \f(CW\*(C`GNU_PROPERTY_X86_ISA_1_BASELINE\*(C'\fR.
1551 \&\fBx86\-64\-v2\fR generates \f(CW\*(C`GNU_PROPERTY_X86_ISA_1_V2\*(C'\fR.
1552 \&\fBx86\-64\-v3\fR generates \f(CW\*(C`GNU_PROPERTY_X86_ISA_1_V3\*(C'\fR.
1553 \&\fBx86\-64\-v4\fR generates \f(CW\*(C`GNU_PROPERTY_X86_ISA_1_V4\*(C'\fR.
1554 Supported for Linux/i386 and Linux/x86_64.
1555 .IP \fBisa\-level\-report=none\fR 4
1556 .IX Item "isa-level-report=none"
1557 .PD 0
1558 .IP \fBisa\-level\-report=all\fR 4
1559 .IX Item "isa-level-report=all"
1560 .IP \fBisa\-level\-report=needed\fR 4
1561 .IX Item "isa-level-report=needed"
1562 .IP \fBisa\-level\-report=used\fR 4
1563 .IX Item "isa-level-report=used"
1564 .PD
1565 Specify how to report x86\-64 ISA levels in input relocatable files.
1566 \&\fBisa\-level\-report=none\fR, which is the default, will make the
1567 linker not report x86\-64 ISA levels in input files.
1568 \&\fBisa\-level\-report=all\fR will make the linker report needed and
1569 used x86\-64 ISA levels in input files.
1570 \&\fBisa\-level\-report=needed\fR will make the linker report needed
1571 x86\-64 ISA levels in input files.
1572 \&\fBisa\-level\-report=used\fR will make the linker report used
1573 x86\-64 ISA levels in input files.
1574 Supported for Linux/i386 and Linux/x86_64.
1575 .RE
1576 .RS 4
1577 .Sp
1578 Other keywords are ignored for Solaris compatibility.
1579 .RE
1580 .IP "\fB\-(\fR \fIarchives\fR \fB\-)\fR" 4
1581 .IX Item "-( archives -)"
1582 .PD 0
1583 .IP "\fB\-\-start\-group\fR \fIarchives\fR \fB\-\-end\-group\fR" 4
1584 .IX Item "--start-group archives --end-group"
1585 .PD
1586 The \fIarchives\fR should be a list of archive files. They may be
1587 either explicit file names, or \fB\-l\fR options.
1588 .Sp
1589 The specified archives are searched repeatedly until no new undefined
1590 references are created. Normally, an archive is searched only once in
1591 the order that it is specified on the command line. If a symbol in that
1592 archive is needed to resolve an undefined symbol referred to by an
1593 object in an archive that appears later on the command line, the linker
1594 would not be able to resolve that reference. By grouping the archives,
1595 they will all be searched repeatedly until all possible references are
1596 resolved.
1597 .Sp
1598 Using this option has a significant performance cost. It is best to use
1599 it only when there are unavoidable circular references between two or
1600 more archives.
1601 .IP \fB\-\-accept\-unknown\-input\-arch\fR 4
1602 .IX Item "--accept-unknown-input-arch"
1603 .PD 0
1604 .IP \fB\-\-no\-accept\-unknown\-input\-arch\fR 4
1605 .IX Item "--no-accept-unknown-input-arch"
1606 .PD
1607 Tells the linker to accept input files whose architecture cannot be
1608 recognised. The assumption is that the user knows what they are doing
1609 and deliberately wants to link in these unknown input files. This was
1610 the default behaviour of the linker, before release 2.14. The default
1611 behaviour from release 2.14 onwards is to reject such input files, and
1612 so the \fB\-\-accept\-unknown\-input\-arch\fR option has been added to
1613 restore the old behaviour.
1614 .IP \fB\-\-as\-needed\fR 4
1615 .IX Item "--as-needed"
1616 .PD 0
1617 .IP \fB\-\-no\-as\-needed\fR 4
1618 .IX Item "--no-as-needed"
1619 .PD
1620 This option affects ELF DT_NEEDED tags for dynamic libraries mentioned
1621 on the command line after the \fB\-\-as\-needed\fR option. Normally
1622 the linker will add a DT_NEEDED tag for each dynamic library mentioned
1623 on the command line, regardless of whether the library is actually
1624 needed or not. \fB\-\-as\-needed\fR causes a DT_NEEDED tag to only be
1625 emitted for a library that \fIat that point in the link\fR satisfies a
1626 non-weak undefined symbol reference from a regular object file or, if
1627 the library is not found in the DT_NEEDED lists of other needed libraries, a
1628 non-weak undefined symbol reference from another needed dynamic library.
1629 Object files or libraries appearing on the command line \fIafter\fR
1630 the library in question do not affect whether the library is seen as
1631 needed. This is similar to the rules for extraction of object files
1632 from archives. \fB\-\-no\-as\-needed\fR restores the default behaviour.
1633 .Sp
1634 Note: On Linux based systems the \fB\-\-as\-needed\fR option also has
1635 an affect on the behaviour of the \fB\-\-rpath\fR and
1636 \&\fB\-\-rpath\-link\fR options. See the description of
1637 \&\fB\-\-rpath\-link\fR for more details.
1638 .IP \fB\-\-add\-needed\fR 4
1639 .IX Item "--add-needed"
1640 .PD 0
1641 .IP \fB\-\-no\-add\-needed\fR 4
1642 .IX Item "--no-add-needed"
1643 .PD
1644 These two options have been deprecated because of the similarity of
1645 their names to the \fB\-\-as\-needed\fR and \fB\-\-no\-as\-needed\fR
1646 options. They have been replaced by \fB\-\-copy\-dt\-needed\-entries\fR
1647 and \fB\-\-no\-copy\-dt\-needed\-entries\fR.
1648 .IP "\fB\-assert\fR \fIkeyword\fR" 4
1649 .IX Item "-assert keyword"
1650 This option is ignored for SunOS compatibility.
1651 .IP \fB\-Bdynamic\fR 4
1652 .IX Item "-Bdynamic"
1653 .PD 0
1654 .IP \fB\-dy\fR 4
1655 .IX Item "-dy"
1656 .IP \fB\-call_shared\fR 4
1657 .IX Item "-call_shared"
1658 .PD
1659 Link against dynamic libraries. This is only meaningful on platforms
1660 for which shared libraries are supported. This option is normally the
1661 default on such platforms. The different variants of this option are
1662 for compatibility with various systems. You may use this option
1663 multiple times on the command line: it affects library searching for
1664 \&\fB\-l\fR options which follow it.
1665 .IP \fB\-Bgroup\fR 4
1666 .IX Item "-Bgroup"
1667 Set the \f(CW\*(C`DF_1_GROUP\*(C'\fR flag in the \f(CW\*(C`DT_FLAGS_1\*(C'\fR entry in the dynamic
1668 section. This causes the runtime linker to handle lookups in this
1669 object and its dependencies to be performed only inside the group.
1670 \&\fB\-\-unresolved\-symbols=report\-all\fR is implied. This option is
1671 only meaningful on ELF platforms which support shared libraries.
1672 .IP \fB\-Bstatic\fR 4
1673 .IX Item "-Bstatic"
1674 .PD 0
1675 .IP \fB\-dn\fR 4
1676 .IX Item "-dn"
1677 .IP \fB\-non_shared\fR 4
1678 .IX Item "-non_shared"
1679 .IP \fB\-static\fR 4
1680 .IX Item "-static"
1681 .PD
1682 Do not link against shared libraries. This is only meaningful on
1683 platforms for which shared libraries are supported. The different
1684 variants of this option are for compatibility with various systems. You
1685 may use this option multiple times on the command line: it affects
1686 library searching for \fB\-l\fR options which follow it. This
1687 option also implies \fB\-\-unresolved\-symbols=report\-all\fR. This
1688 option can be used with \fB\-shared\fR. Doing so means that a
1689 shared library is being created but that all of the library's external
1690 references must be resolved by pulling in entries from static
1691 libraries.
1692 .IP \fB\-Bsymbolic\fR 4
1693 .IX Item "-Bsymbolic"
1694 When creating a shared library, bind references to global symbols to the
1695 definition within the shared library, if any. Normally, it is possible
1696 for a program linked against a shared library to override the definition
1697 within the shared library. This option is only meaningful on ELF
1698 platforms which support shared libraries.
1699 .IP \fB\-Bsymbolic\-functions\fR 4
1700 .IX Item "-Bsymbolic-functions"
1701 When creating a shared library, bind references to global function
1702 symbols to the definition within the shared library, if any.
1703 This option is only meaningful on ELF platforms which support shared
1704 libraries.
1705 .IP \fB\-Bno\-symbolic\fR 4
1706 .IX Item "-Bno-symbolic"
1707 This option can cancel previously specified \fB\-Bsymbolic\fR and
1708 \&\fB\-Bsymbolic\-functions\fR.
1709 .IP \fB\-\-dynamic\-list=\fR\fIdynamic-list-file\fR 4
1710 .IX Item "--dynamic-list=dynamic-list-file"
1711 Specify the name of a dynamic list file to the linker. This is
1712 typically used when creating shared libraries to specify a list of
1713 global symbols whose references shouldn't be bound to the definition
1714 within the shared library, or creating dynamically linked executables
1715 to specify a list of symbols which should be added to the symbol table
1716 in the executable. This option is only meaningful on ELF platforms
1717 which support shared libraries.
1718 .Sp
1719 The format of the dynamic list is the same as the version node without
1720 scope and node name. See \fBVERSION\fR for more information.
1721 .IP \fB\-\-dynamic\-list\-data\fR 4
1722 .IX Item "--dynamic-list-data"
1723 Include all global data symbols to the dynamic list.
1724 .IP \fB\-\-dynamic\-list\-cpp\-new\fR 4
1725 .IX Item "--dynamic-list-cpp-new"
1726 Provide the builtin dynamic list for C++ operator new and delete. It
1727 is mainly useful for building shared libstdc++.
1728 .IP \fB\-\-dynamic\-list\-cpp\-typeinfo\fR 4
1729 .IX Item "--dynamic-list-cpp-typeinfo"
1730 Provide the builtin dynamic list for C++ runtime type identification.
1731 .IP \fB\-\-check\-sections\fR 4
1732 .IX Item "--check-sections"
1733 .PD 0
1734 .IP \fB\-\-no\-check\-sections\fR 4
1735 .IX Item "--no-check-sections"
1736 .PD
1737 Asks the linker \fInot\fR to check section addresses after they have
1738 been assigned to see if there are any overlaps. Normally the linker will
1739 perform this check, and if it finds any overlaps it will produce
1740 suitable error messages. The linker does know about, and does make
1741 allowances for sections in overlays. The default behaviour can be
1742 restored by using the command-line switch \fB\-\-check\-sections\fR.
1743 Section overlap is not usually checked for relocatable links. You can
1744 force checking in that case by using the \fB\-\-check\-sections\fR
1745 option.
1746 .IP \fB\-\-copy\-dt\-needed\-entries\fR 4
1747 .IX Item "--copy-dt-needed-entries"
1748 .PD 0
1749 .IP \fB\-\-no\-copy\-dt\-needed\-entries\fR 4
1750 .IX Item "--no-copy-dt-needed-entries"
1751 .PD
1752 This option affects the treatment of dynamic libraries referred to
1753 by DT_NEEDED tags \fIinside\fR ELF dynamic libraries mentioned on the
1754 command line. Normally the linker won't add a DT_NEEDED tag to the
1755 output binary for each library mentioned in a DT_NEEDED tag in an
1756 input dynamic library. With \fB\-\-copy\-dt\-needed\-entries\fR
1757 specified on the command line however any dynamic libraries that
1758 follow it will have their DT_NEEDED entries added. The default
1759 behaviour can be restored with \fB\-\-no\-copy\-dt\-needed\-entries\fR.
1760 .Sp
1761 This option also has an effect on the resolution of symbols in dynamic
1762 libraries. With \fB\-\-copy\-dt\-needed\-entries\fR dynamic libraries
1763 mentioned on the command line will be recursively searched, following
1764 their DT_NEEDED tags to other libraries, in order to resolve symbols
1765 required by the output binary. With the default setting however
1766 the searching of dynamic libraries that follow it will stop with the
1767 dynamic library itself. No DT_NEEDED links will be traversed to resolve
1768 symbols.
1769 .IP \fB\-\-cref\fR 4
1770 .IX Item "--cref"
1771 Output a cross reference table. If a linker map file is being
1772 generated, the cross reference table is printed to the map file.
1773 Otherwise, it is printed on the standard output.
1774 .Sp
1775 The format of the table is intentionally simple, so that it may be
1776 easily processed by a script if necessary. The symbols are printed out,
1777 sorted by name. For each symbol, a list of file names is given. If the
1778 symbol is defined, the first file listed is the location of the
1779 definition. If the symbol is defined as a common value then any files
1780 where this happens appear next. Finally any files that reference the
1781 symbol are listed.
1782 .IP \fB\-\-ctf\-variables\fR 4
1783 .IX Item "--ctf-variables"
1784 .PD 0
1785 .IP \fB\-\-no\-ctf\-variables\fR 4
1786 .IX Item "--no-ctf-variables"
1787 .PD
1788 The CTF debuginfo format supports a section which encodes the names and
1789 types of variables found in the program which do not appear in any symbol
1790 table. These variables clearly cannot be looked up by address by
1791 conventional debuggers, so the space used for their types and names is
1792 usually wasted: the types are usually small but the names are often not.
1793 \&\fB\-\-ctf\-variables\fR causes the generation of such a section.
1794 The default behaviour can be restored with \fB\-\-no\-ctf\-variables\fR.
1795 .IP \fB\-\-ctf\-share\-types=\fR\fImethod\fR 4
1796 .IX Item "--ctf-share-types=method"
1797 Adjust the method used to share types between translation units in CTF.
1798 .RS 4
1799 .IP \fBshare-unconflicted\fR 4
1800 .IX Item "share-unconflicted"
1801 Put all types that do not have ambiguous definitions into the shared dictionary,
1802 where debuggers can easily access them, even if they only occur in one
1803 translation unit. This is the default.
1804 .IP \fBshare-duplicated\fR 4
1805 .IX Item "share-duplicated"
1806 Put only types that occur in multiple translation units into the shared
1807 dictionary: types with only one definition go into per-translation-unit
1808 dictionaries. Types with ambiguous definitions in multiple translation units
1809 always go into per-translation-unit dictionaries. This tends to make the CTF
1810 larger, but may reduce the amount of CTF in the shared dictionary. For very
1811 large projects this may speed up opening the CTF and save memory in the CTF
1812 consumer at runtime.
1813 .RE
1814 .RS 4
1815 .RE
1816 .IP \fB\-\-no\-define\-common\fR 4
1817 .IX Item "--no-define-common"
1818 This option inhibits the assignment of addresses to common symbols.
1819 The script command \f(CW\*(C`INHIBIT_COMMON_ALLOCATION\*(C'\fR has the same effect.
1820 .Sp
1821 The \fB\-\-no\-define\-common\fR option allows decoupling
1822 the decision to assign addresses to Common symbols from the choice
1823 of the output file type; otherwise a non-Relocatable output type
1824 forces assigning addresses to Common symbols.
1825 Using \fB\-\-no\-define\-common\fR allows Common symbols that are referenced
1826 from a shared library to be assigned addresses only in the main program.
1827 This eliminates the unused duplicate space in the shared library,
1828 and also prevents any possible confusion over resolving to the wrong
1829 duplicate when there are many dynamic modules with specialized search
1830 paths for runtime symbol resolution.
1831 .IP \fB\-\-force\-group\-allocation\fR 4
1832 .IX Item "--force-group-allocation"
1833 This option causes the linker to place section group members like
1834 normal input sections, and to delete the section groups. This is the
1835 default behaviour for a final link but this option can be used to
1836 change the behaviour of a relocatable link (\fB\-r\fR). The script
1837 command \f(CW\*(C`FORCE_GROUP_ALLOCATION\*(C'\fR has the same
1838 effect.
1839 .IP \fB\-\-defsym=\fR\fIsymbol\fR\fB=\fR\fIexpression\fR 4
1840 .IX Item "--defsym=symbol=expression"
1841 Create a global symbol in the output file, containing the absolute
1842 address given by \fIexpression\fR. You may use this option as many
1843 times as necessary to define multiple symbols in the command line. A
1844 limited form of arithmetic is supported for the \fIexpression\fR in this
1845 context: you may give a hexadecimal constant or the name of an existing
1846 symbol, or use \f(CW\*(C`+\*(C'\fR and \f(CW\*(C`\-\*(C'\fR to add or subtract hexadecimal
1847 constants or symbols. If you need more elaborate expressions, consider
1848 using the linker command language from a script.
1849 \&\fINote:\fR there should be no white space between \fIsymbol\fR, the
1850 equals sign ("\fB=\fR"), and \fIexpression\fR.
1851 .Sp
1852 The linker processes \fB\-\-defsym\fR arguments and \fB\-T\fR arguments
1853 in order, placing \fB\-\-defsym\fR before \fB\-T\fR will define the
1854 symbol before the linker script from \fB\-T\fR is processed, while
1855 placing \fB\-\-defsym\fR after \fB\-T\fR will define the symbol after
1856 the linker script has been processed. This difference has
1857 consequences for expressions within the linker script that use the
1858 \&\fB\-\-defsym\fR symbols, which order is correct will depend on what
1859 you are trying to achieve.
1860 .IP \fB\-\-demangle[=\fR\fIstyle\fR\fB]\fR 4
1861 .IX Item "--demangle[=style]"
1862 .PD 0
1863 .IP \fB\-\-no\-demangle\fR 4
1864 .IX Item "--no-demangle"
1865 .PD
1866 These options control whether to demangle symbol names in error messages
1867 and other output. When the linker is told to demangle, it tries to
1868 present symbol names in a readable fashion: it strips leading
1869 underscores if they are used by the object file format, and converts C++
1870 mangled symbol names into user readable names. Different compilers have
1871 different mangling styles. The optional demangling style argument can be used
1872 to choose an appropriate demangling style for your compiler. The linker will
1873 demangle by default unless the environment variable \fBCOLLECT_NO_DEMANGLE\fR
1874 is set. These options may be used to override the default.
1875 .IP \fB\-I\fR\fIfile\fR 4
1876 .IX Item "-Ifile"
1877 .PD 0
1878 .IP \fB\-\-dynamic\-linker=\fR\fIfile\fR 4
1879 .IX Item "--dynamic-linker=file"
1880 .PD
1881 Set the name of the dynamic linker. This is only meaningful when
1882 generating dynamically linked ELF executables. The default dynamic
1883 linker is normally correct; don't use this unless you know what you are
1884 doing.
1885 .IP \fB\-\-no\-dynamic\-linker\fR 4
1886 .IX Item "--no-dynamic-linker"
1887 When producing an executable file, omit the request for a dynamic
1888 linker to be used at load-time. This is only meaningful for ELF
1889 executables that contain dynamic relocations, and usually requires
1890 entry point code that is capable of processing these relocations.
1891 .IP \fB\-\-embedded\-relocs\fR 4
1892 .IX Item "--embedded-relocs"
1893 This option is similar to the \fB\-\-emit\-relocs\fR option except
1894 that the relocs are stored in a target-specific section. This option
1895 is only supported by the \fBBFIN\fR, \fBCR16\fR and \fIM68K\fR
1896 targets.
1897 .IP \fB\-\-disable\-multiple\-abs\-defs\fR 4
1898 .IX Item "--disable-multiple-abs-defs"
1899 Do not allow multiple definitions with symbols included
1900 in filename invoked by \-R or \-\-just\-symbols
1901 .IP \fB\-\-fatal\-warnings\fR 4
1902 .IX Item "--fatal-warnings"
1903 .PD 0
1904 .IP \fB\-\-no\-fatal\-warnings\fR 4
1905 .IX Item "--no-fatal-warnings"
1906 .PD
1907 Treat all warnings as errors. The default behaviour can be restored
1908 with the option \fB\-\-no\-fatal\-warnings\fR.
1909 .IP \fB\-w\fR 4
1910 .IX Item "-w"
1911 .PD 0
1912 .IP \fB\-\-no\-warnings\fR 4
1913 .IX Item "--no-warnings"
1914 .PD
1915 Do not display any warning or error messages. This overrides
1916 \&\fB\-\-fatal\-warnings\fR if it has been enabled. This option can be
1917 used when it is known that the output binary will not work, but there
1918 is still a need to create it.
1919 .IP \fB\-\-force\-exe\-suffix\fR 4
1920 .IX Item "--force-exe-suffix"
1921 Make sure that an output file has a .exe suffix.
1922 .Sp
1923 If a successfully built fully linked output file does not have a
1924 \&\f(CW\*(C`.exe\*(C'\fR or \f(CW\*(C`.dll\*(C'\fR suffix, this option forces the linker to copy
1925 the output file to one of the same name with a \f(CW\*(C`.exe\*(C'\fR suffix. This
1926 option is useful when using unmodified Unix makefiles on a Microsoft
1927 Windows host, since some versions of Windows won't run an image unless
1928 it ends in a \f(CW\*(C`.exe\*(C'\fR suffix.
1929 .IP \fB\-\-gc\-sections\fR 4
1930 .IX Item "--gc-sections"
1931 .PD 0
1932 .IP \fB\-\-no\-gc\-sections\fR 4
1933 .IX Item "--no-gc-sections"
1934 .PD
1935 Enable garbage collection of unused input sections. It is ignored on
1936 targets that do not support this option. The default behaviour (of not
1937 performing this garbage collection) can be restored by specifying
1938 \&\fB\-\-no\-gc\-sections\fR on the command line. Note that garbage
1939 collection for COFF and PE format targets is supported, but the
1940 implementation is currently considered to be experimental.
1941 .Sp
1942 \&\fB\-\-gc\-sections\fR decides which input sections are used by
1943 examining symbols and relocations. The section containing the entry
1944 symbol and all sections containing symbols undefined on the
1945 command-line will be kept, as will sections containing symbols
1946 referenced by dynamic objects. Note that when building shared
1947 libraries, the linker must assume that any visible symbol is
1948 referenced. Once this initial set of sections has been determined,
1949 the linker recursively marks as used any section referenced by their
1950 relocations. See \fB\-\-entry\fR, \fB\-\-undefined\fR, and
1951 \&\fB\-\-gc\-keep\-exported\fR.
1952 .Sp
1953 This option can be set when doing a partial link (enabled with option
1954 \&\fB\-r\fR). In this case the root of symbols kept must be explicitly
1955 specified either by one of the options \fB\-\-entry\fR,
1956 \&\fB\-\-undefined\fR, or \fB\-\-gc\-keep\-exported\fR or by a \f(CW\*(C`ENTRY\*(C'\fR
1957 command in the linker script.
1958 .Sp
1959 As a GNU extension, ELF input sections marked with the
1960 \&\f(CW\*(C`SHF_GNU_RETAIN\*(C'\fR flag will not be garbage collected.
1961 .IP \fB\-\-print\-gc\-sections\fR 4
1962 .IX Item "--print-gc-sections"
1963 .PD 0
1964 .IP \fB\-\-no\-print\-gc\-sections\fR 4
1965 .IX Item "--no-print-gc-sections"
1966 .PD
1967 List all sections removed by garbage collection. The listing is
1968 printed on stderr. This option is only effective if garbage
1969 collection has been enabled via the \fB\-\-gc\-sections\fR) option. The
1970 default behaviour (of not listing the sections that are removed) can
1971 be restored by specifying \fB\-\-no\-print\-gc\-sections\fR on the command
1972 line.
1973 .IP \fB\-\-gc\-keep\-exported\fR 4
1974 .IX Item "--gc-keep-exported"
1975 When \fB\-\-gc\-sections\fR is enabled, this option prevents garbage
1976 collection of unused input sections that contain global symbols having
1977 default or protected visibility. This option is intended to be used for
1978 executables where unreferenced sections would otherwise be garbage
1979 collected regardless of the external visibility of contained symbols.
1980 Note that this option has no effect when linking shared objects since
1981 it is already the default behaviour. This option is only supported for
1982 ELF format targets.
1983 .IP \fB\-\-print\-output\-format\fR 4
1984 .IX Item "--print-output-format"
1985 Print the name of the default output format (perhaps influenced by
1986 other command-line options). This is the string that would appear
1987 in an \f(CW\*(C`OUTPUT_FORMAT\*(C'\fR linker script command.
1988 .IP \fB\-\-print\-memory\-usage\fR 4
1989 .IX Item "--print-memory-usage"
1990 Print used size, total size and used size of memory regions created with
1991 the \fBMEMORY\fR command. This is useful on embedded targets to have a
1992 quick view of amount of free memory. The format of the output has one
1993 headline and one line per region. It is both human readable and easily
1994 parsable by tools. Here is an example of an output:
1995 .Sp
1996 .Vb 3
1997 \& Memory region Used Size Region Size %age Used
1998 \& ROM: 256 KB 1 MB 25.00%
1999 \& RAM: 32 B 2 GB 0.00%
2000 .Ve
2001 .IP \fB\-\-help\fR 4
2002 .IX Item "--help"
2003 Print a summary of the command-line options on the standard output and exit.
2004 .IP \fB\-\-target\-help\fR 4
2005 .IX Item "--target-help"
2006 Print a summary of all target-specific options on the standard output and exit.
2007 .IP \fB\-Map=\fR\fImapfile\fR 4
2008 .IX Item "-Map=mapfile"
2009 Print a link map to the file \fImapfile\fR. See the description of the
2010 \&\fB\-M\fR option, above. If \fImapfile\fR is just the character
2011 \&\f(CW\*(C`\-\*(C'\fR then the map will be written to stdout.
2012 .Sp
2013 Specifying a directory as \fImapfile\fR causes the linker map to be
2014 written as a file inside the directory. Normally name of the file
2015 inside the directory is computed as the basename of the \fIoutput\fR
2016 file with \f(CW\*(C`.map\*(C'\fR appended. If however the special character
2017 \&\f(CW\*(C`%\*(C'\fR is used then this will be replaced by the full path of the
2018 output file. Additionally if there are any characters after the
2019 \&\fI%\fR symbol then \f(CW\*(C`.map\*(C'\fR will no longer be appended.
2020 .Sp
2021 .Vb 10
2022 \& \-o foo.exe \-Map=bar [Creates ./bar]
2023 \& \-o ../dir/foo.exe \-Map=bar [Creates ./bar]
2024 \& \-o foo.exe \-Map=../dir [Creates ../dir/foo.exe.map]
2025 \& \-o ../dir2/foo.exe \-Map=../dir [Creates ../dir/foo.exe.map]
2026 \& \-o foo.exe \-Map=% [Creates ./foo.exe.map]
2027 \& \-o ../dir/foo.exe \-Map=% [Creates ../dir/foo.exe.map]
2028 \& \-o foo.exe \-Map=%.bar [Creates ./foo.exe.bar]
2029 \& \-o ../dir/foo.exe \-Map=%.bar [Creates ../dir/foo.exe.bar]
2030 \& \-o ../dir2/foo.exe \-Map=../dir/% [Creates ../dir/../dir2/foo.exe.map]
2031 \& \-o ../dir2/foo.exe \-Map=../dir/%.bar [Creates ../dir/../dir2/foo.exe.bar]
2032 .Ve
2033 .Sp
2034 It is an error to specify more than one \f(CW\*(C`%\*(C'\fR character.
2035 .Sp
2036 If the map file already exists then it will be overwritten by this
2037 operation.
2038 .IP \fB\-\-no\-keep\-memory\fR 4
2039 .IX Item "--no-keep-memory"
2040 \&\fBld\fR normally optimizes for speed over memory usage by caching the
2041 symbol tables of input files in memory. This option tells \fBld\fR to
2042 instead optimize for memory usage, by rereading the symbol tables as
2043 necessary. This may be required if \fBld\fR runs out of memory space
2044 while linking a large executable.
2045 .IP \fB\-\-no\-undefined\fR 4
2046 .IX Item "--no-undefined"
2047 .PD 0
2048 .IP "\fB\-z defs\fR" 4
2049 .IX Item "-z defs"
2050 .PD
2051 Report unresolved symbol references from regular object files. This
2052 is done even if the linker is creating a non-symbolic shared library.
2053 The switch \fB\-\-[no\-]allow\-shlib\-undefined\fR controls the
2054 behaviour for reporting unresolved references found in shared
2055 libraries being linked in.
2056 .Sp
2057 The effects of this option can be reverted by using \f(CW\*(C`\-z undefs\*(C'\fR.
2058 .IP \fB\-\-allow\-multiple\-definition\fR 4
2059 .IX Item "--allow-multiple-definition"
2060 .PD 0
2061 .IP "\fB\-z muldefs\fR" 4
2062 .IX Item "-z muldefs"
2063 .PD
2064 Normally when a symbol is defined multiple times, the linker will
2065 report a fatal error. These options allow multiple definitions and the
2066 first definition will be used.
2067 .IP \fB\-\-allow\-shlib\-undefined\fR 4
2068 .IX Item "--allow-shlib-undefined"
2069 .PD 0
2070 .IP \fB\-\-no\-allow\-shlib\-undefined\fR 4
2071 .IX Item "--no-allow-shlib-undefined"
2072 .PD
2073 Allows or disallows undefined symbols in shared libraries.
2074 This switch is similar to \fB\-\-no\-undefined\fR except that it
2075 determines the behaviour when the undefined symbols are in a
2076 shared library rather than a regular object file. It does not affect
2077 how undefined symbols in regular object files are handled.
2078 .Sp
2079 The default behaviour is to report errors for any undefined symbols
2080 referenced in shared libraries if the linker is being used to create
2081 an executable, but to allow them if the linker is being used to create
2082 a shared library.
2083 .Sp
2084 The reasons for allowing undefined symbol references in shared
2085 libraries specified at link time are that:
2086 .RS 4
2087 .IP \(bu 4
2088 A shared library specified at link time may not be the same as the one
2089 that is available at load time, so the symbol might actually be
2090 resolvable at load time.
2091 .IP \(bu 4
2092 There are some operating systems, eg BeOS and HPPA, where undefined
2093 symbols in shared libraries are normal.
2094 .Sp
2095 The BeOS kernel for example patches shared libraries at load time to
2096 select whichever function is most appropriate for the current
2097 architecture. This is used, for example, to dynamically select an
2098 appropriate memset function.
2099 .RE
2100 .RS 4
2101 .RE
2102 .IP \fB\-\-error\-handling\-script=\fR\fIscriptname\fR 4
2103 .IX Item "--error-handling-script=scriptname"
2104 If this option is provided then the linker will invoke
2105 \&\fIscriptname\fR whenever an error is encountered. Currently however
2106 only two kinds of error are supported: missing symbols and missing
2107 libraries. Two arguments will be passed to script: the keyword
2108 "undefined-symbol" or `missing\-lib" and the \fIname\fR of the
2109 undefined symbol or missing library. The intention is that the script
2110 will provide suggestions to the user as to where the symbol or library
2111 might be found. After the script has finished then the normal linker
2112 error message will be displayed.
2113 .Sp
2114 The availability of this option is controlled by a configure time
2115 switch, so it may not be present in specific implementations.
2116 .IP \fB\-\-no\-undefined\-version\fR 4
2117 .IX Item "--no-undefined-version"
2118 Normally when a symbol has an undefined version, the linker will ignore
2119 it. This option disallows symbols with undefined version and a fatal error
2120 will be issued instead.
2121 .IP \fB\-\-default\-symver\fR 4
2122 .IX Item "--default-symver"
2123 Create and use a default symbol version (the soname) for unversioned
2124 exported symbols.
2125 .IP \fB\-\-default\-imported\-symver\fR 4
2126 .IX Item "--default-imported-symver"
2127 Create and use a default symbol version (the soname) for unversioned
2128 imported symbols.
2129 .IP \fB\-\-no\-warn\-mismatch\fR 4
2130 .IX Item "--no-warn-mismatch"
2131 Normally \fBld\fR will give an error if you try to link together input
2132 files that are mismatched for some reason, perhaps because they have
2133 been compiled for different processors or for different endiannesses.
2134 This option tells \fBld\fR that it should silently permit such possible
2135 errors. This option should only be used with care, in cases when you
2136 have taken some special action that ensures that the linker errors are
2137 inappropriate.
2138 .IP \fB\-\-no\-warn\-search\-mismatch\fR 4
2139 .IX Item "--no-warn-search-mismatch"
2140 Normally \fBld\fR will give a warning if it finds an incompatible
2141 library during a library search. This option silences the warning.
2142 .IP \fB\-\-no\-whole\-archive\fR 4
2143 .IX Item "--no-whole-archive"
2144 Turn off the effect of the \fB\-\-whole\-archive\fR option for subsequent
2145 archive files.
2146 .IP \fB\-\-noinhibit\-exec\fR 4
2147 .IX Item "--noinhibit-exec"
2148 Retain the executable output file whenever it is still usable.
2149 Normally, the linker will not produce an output file if it encounters
2150 errors during the link process; it exits without writing an output file
2151 when it issues any error whatsoever.
2152 .IP \fB\-nostdlib\fR 4
2153 .IX Item "-nostdlib"
2154 Only search library directories explicitly specified on the
2155 command line. Library directories specified in linker scripts
2156 (including linker scripts specified on the command line) are ignored.
2157 .IP \fB\-\-oformat=\fR\fIoutput-format\fR 4
2158 .IX Item "--oformat=output-format"
2159 \&\fBld\fR may be configured to support more than one kind of object
2160 file. If your \fBld\fR is configured this way, you can use the
2161 \&\fB\-\-oformat\fR option to specify the binary format for the output
2162 object file. Even when \fBld\fR is configured to support alternative
2163 object formats, you don't usually need to specify this, as \fBld\fR
2164 should be configured to produce as a default output format the most
2165 usual format on each machine. \fIoutput-format\fR is a text string, the
2166 name of a particular format supported by the BFD libraries. (You can
2167 list the available binary formats with \fBobjdump \-i\fR.) The script
2168 command \f(CW\*(C`OUTPUT_FORMAT\*(C'\fR can also specify the output format, but
2169 this option overrides it.
2170 .IP "\fB\-\-out\-implib\fR \fIfile\fR" 4
2171 .IX Item "--out-implib file"
2172 Create an import library in \fIfile\fR corresponding to the executable
2173 the linker is generating (eg. a DLL or ELF program). This import
2174 library (which should be called \f(CW\*(C`*.dll.a\*(C'\fR or \f(CW\*(C`*.a\*(C'\fR for DLLs)
2175 may be used to link clients against the generated executable; this
2176 behaviour makes it possible to skip a separate import library creation
2177 step (eg. \f(CW\*(C`dlltool\*(C'\fR for DLLs). This option is only available for
2178 the i386 PE and ELF targetted ports of the linker.
2179 .IP \fB\-pie\fR 4
2180 .IX Item "-pie"
2181 .PD 0
2182 .IP \fB\-\-pic\-executable\fR 4
2183 .IX Item "--pic-executable"
2184 .PD
2185 Create a position independent executable. This is currently only
2186 supported on ELF platforms. Position independent executables are
2187 relocated by the dynamic linker to the virtual address the OS chooses
2188 for them, which can vary between invocations. They are marked ET_DYN
2189 in the ELF file header, but differ from shared libraries in a number
2190 of ways. In particular, defined symbols in a PIE by default can not
2191 be overridden by another object as they can be in a shared library.
2192 .IP \fB\-no\-pie\fR 4
2193 .IX Item "-no-pie"
2194 Create a position dependent executable. This is the default.
2195 .IP \fB\-qmagic\fR 4
2196 .IX Item "-qmagic"
2197 This option is ignored for Linux compatibility.
2198 .IP \fB\-Qy\fR 4
2199 .IX Item "-Qy"
2200 This option is ignored for SVR4 compatibility.
2201 .IP \fB\-\-relax\fR 4
2202 .IX Item "--relax"
2203 .PD 0
2204 .IP \fB\-\-no\-relax\fR 4
2205 .IX Item "--no-relax"
2206 .PD
2207 An option with machine dependent effects.
2208 This option is only supported on a few targets.
2209 .Sp
2210 On some platforms the \fB\-\-relax\fR option performs target specific,
2211 global optimizations that become possible when the linker resolves
2212 addressing in the program, such as relaxing address modes,
2213 synthesizing new instructions, selecting shorter version of current
2214 instructions, and combining constant values.
2215 .Sp
2216 On some platforms these link time global optimizations may make symbolic
2217 debugging of the resulting executable impossible.
2218 This is known to be the case for the Matsushita MN10200 and MN10300
2219 family of processors.
2220 .Sp
2221 On platforms where the feature is supported, the option
2222 \&\fB\-\-no\-relax\fR will disable it.
2223 .Sp
2224 On platforms where the feature is not supported, both \fB\-\-relax\fR
2225 and \fB\-\-no\-relax\fR are accepted, but ignored.
2226 .IP \fB\-\-retain\-symbols\-file=\fR\fIfilename\fR 4
2227 .IX Item "--retain-symbols-file=filename"
2228 Retain \fIonly\fR the symbols listed in the file \fIfilename\fR,
2229 discarding all others. \fIfilename\fR is simply a flat file, with one
2230 symbol name per line. This option is especially useful in environments
2231 (such as VxWorks)
2232 where a large global symbol table is accumulated gradually, to conserve
2233 run-time memory.
2234 .Sp
2235 \&\fB\-\-retain\-symbols\-file\fR does \fInot\fR discard undefined symbols,
2236 or symbols needed for relocations.
2237 .Sp
2238 You may only specify \fB\-\-retain\-symbols\-file\fR once in the command
2239 line. It overrides \fB\-s\fR and \fB\-S\fR.
2240 .IP \fB\-rpath=\fR\fIdir\fR 4
2241 .IX Item "-rpath=dir"
2242 Add a directory to the runtime library search path. This is used when
2243 linking an ELF executable with shared objects. All \fB\-rpath\fR
2244 arguments are concatenated and passed to the runtime linker, which uses
2245 them to locate shared objects at runtime.
2246 .Sp
2247 The \fB\-rpath\fR option is also used when locating shared objects which
2248 are needed by shared objects explicitly included in the link; see the
2249 description of the \fB\-rpath\-link\fR option. Searching \fB\-rpath\fR
2250 in this way is only supported by native linkers and cross linkers which
2251 have been configured with the \fB\-\-with\-sysroot\fR option.
2252 .Sp
2253 If \fB\-rpath\fR is not used when linking an ELF executable, the
2254 contents of the environment variable \f(CW\*(C`LD_RUN_PATH\*(C'\fR will be used if it
2255 is defined.
2256 .Sp
2257 The \fB\-rpath\fR option may also be used on SunOS. By default, on
2258 SunOS, the linker will form a runtime search path out of all the
2259 \&\fB\-L\fR options it is given. If a \fB\-rpath\fR option is used, the
2260 runtime search path will be formed exclusively using the \fB\-rpath\fR
2261 options, ignoring the \fB\-L\fR options. This can be useful when using
2262 gcc, which adds many \fB\-L\fR options which may be on NFS mounted
2263 file systems.
2264 .Sp
2265 For compatibility with other ELF linkers, if the \fB\-R\fR option is
2266 followed by a directory name, rather than a file name, it is treated as
2267 the \fB\-rpath\fR option.
2268 .IP \fB\-rpath\-link=\fR\fIdir\fR 4
2269 .IX Item "-rpath-link=dir"
2270 When using ELF or SunOS, one shared library may require another. This
2271 happens when an \f(CW\*(C`ld \-shared\*(C'\fR link includes a shared library as one
2272 of the input files.
2273 .Sp
2274 When the linker encounters such a dependency when doing a non-shared,
2275 non-relocatable link, it will automatically try to locate the required
2276 shared library and include it in the link, if it is not included
2277 explicitly. In such a case, several directories are searched as
2278 described below. The \fB\-rpath\-link\fR option specifies the first
2279 set of directories to search. This option may specify a sequence of
2280 directory names either by providing a list of names separated by
2281 colons, or by appearing multiple times.
2282 .Sp
2283 The tokens \fR\f(CI$ORIGIN\fR\fI\fR and \fI\fR\f(CI$LIB\fR\fI\fR can appear in these search
2284 directories. They will be replaced by the full path to the directory
2285 containing the program or shared object in the case of \fI\fR\f(CI$ORIGIN\fR\fI\fR
2286 and either \fBlib\fR \- for 32\-bit binaries \- or \fBlib64\fR \- for
2287 64\-bit binaries \- in the case of \fI\fR\f(CI$LIB\fR\fI\fR.
2288 .Sp
2289 The alternative form of these tokens \- \fI${ORIGIN}\fR and
2290 \&\fI${LIB}\fR can also be used. The token \fR\f(CI$PLATFORM\fR\fI\fR is not
2291 supported.
2292 .Sp
2293 The \fB\-\-rpath\-link\fR option should be used with caution as it
2294 overrides the search path that may have been hard compiled into a
2295 shared library. In such a case it is possible to unintentionally use
2296 a different search path than the runtime linker would have used.
2297 .Sp
2298 When additional shared libraries are required, the linker will search
2299 directories in the order listed below in order to find them. Note
2300 however that this only applies to additional libraries needed to
2301 satisfy already included shared libraries. It does \fInot\fR
2302 apply to libraries that are included via the \fB\-l\fR command line
2303 option. Searches for \fB\-l\fR libraries are only conducted in
2304 directories specified by the \fB\-L\fR option.
2305 .RS 4
2306 .IP 1. 4
2307 Any directories specified by \fB\-rpath\-link\fR options.
2308 .IP 2. 4
2309 Any directories specified by \fB\-rpath\fR options. The difference
2310 between \fB\-rpath\fR and \fB\-rpath\-link\fR is that directories
2311 specified by \fB\-rpath\fR options are included in the executable and
2312 used at runtime, whereas the \fB\-rpath\-link\fR option is only effective
2313 at link time. Searching \fB\-rpath\fR in this way is only supported
2314 by native linkers and cross linkers which have been configured with
2315 the \fB\-\-with\-sysroot\fR option.
2316 .IP 3. 4
2317 On an ELF system, for native linkers, if the \fB\-rpath\fR and
2318 \&\fB\-rpath\-link\fR options were not used, search the contents of the
2319 environment variable \f(CW\*(C`LD_RUN_PATH\*(C'\fR.
2320 .IP 4. 4
2321 On SunOS, if the \fB\-rpath\fR option was not used, search any
2322 directories specified using \fB\-L\fR options.
2323 .IP 5. 4
2324 For a native linker, search the contents of the environment
2325 variable \f(CW\*(C`LD_LIBRARY_PATH\*(C'\fR.
2326 .IP 6. 4
2327 For a native ELF linker, the directories in \f(CW\*(C`DT_RUNPATH\*(C'\fR or
2328 \&\f(CW\*(C`DT_RPATH\*(C'\fR of a shared library are searched for shared
2329 libraries needed by it. The \f(CW\*(C`DT_RPATH\*(C'\fR entries are ignored if
2330 \&\f(CW\*(C`DT_RUNPATH\*(C'\fR entries exist.
2331 .IP 7. 4
2332 For a linker for a Linux system, if the file \fI/etc/ld.so.conf\fR
2333 exists, the list of directories found in that file. Note: the path
2334 to this file is prefixed with the \f(CW\*(C`sysroot\*(C'\fR value, if that is
2335 defined, and then any \f(CW\*(C`prefix\*(C'\fR string if the linker was
2336 configured with the \fB\-\-prefix=<path>\fR option.
2337 .IP 8. 4
2338 For a native linker on a FreeBSD system, any directories specified by
2339 the \f(CW\*(C`_PATH_ELF_HINTS\*(C'\fR macro defined in the \fIelf\-hints.h\fR
2340 header file.
2341 .IP 9. 4
2342 Any directories specified by a \f(CW\*(C`SEARCH_DIR\*(C'\fR command in a
2343 linker script given on the command line, including scripts specified
2344 by \fB\-T\fR (but not \fB\-dT\fR).
2345 .IP 10. 4
2346 The default directories, normally \fI/lib\fR and \fI/usr/lib\fR.
2347 .IP 11. 4
2348 Any directories specified by a plugin LDPT_SET_EXTRA_LIBRARY_PATH.
2349 .IP 12. 4
2350 Any directories specified by a \f(CW\*(C`SEARCH_DIR\*(C'\fR command in a default
2351 linker script.
2352 .RE
2353 .RS 4
2354 .Sp
2355 Note however on Linux based systems there is an additional caveat: If
2356 the \fB\-\-as\-needed\fR option is active \fIand\fR a shared library
2357 is located which would normally satisfy the search \fIand\fR this
2358 library does not have DT_NEEDED tag for \fIlibc.so\fR
2359 \&\fIand\fR there is a shared library later on in the set of search
2360 directories which also satisfies the search \fIand\fR
2361 this second shared library does have a DT_NEEDED tag for
2362 \&\fIlibc.so\fR \fIthen\fR the second library will be selected instead
2363 of the first.
2364 .Sp
2365 If the required shared library is not found, the linker will issue a
2366 warning and continue with the link.
2367 .RE
2368 .IP \fB\-\-section\-ordering\-file=\fR\fIscript\fR 4
2369 .IX Item "--section-ordering-file=script"
2370 This option is used to augment the current linker script with
2371 additional mapping of input sections to output sections. This file
2372 must use the same syntax for \f(CW\*(C`SECTIONS\*(C'\fR as is used in normal
2373 linker scripts, but it should not do anything other than place input
2374 sections into output sections. \f(CW@pxref\fR{SECTIONS}
2375 .Sp
2376 A second constraint on the section ordering script is that it can only
2377 reference output sections that are already defined by whichever linker
2378 script is currently in use. (Ie the default linker script or a script
2379 specified on the command line). The benefit of the section ordering
2380 script however is that the input sections are mapped to the start of
2381 the output sections, so that they can ensure the ordering of sections
2382 in the output section. For example, imagine that the default linker
2383 script looks like this:
2384 .Sp
2385 .Vb 4
2386 \& SECTIONS {
2387 \& .text : { *(.text.hot) ; *(.text .text.*) }
2388 \& .data : { *(.data.big) ; *(.data .data.*) }
2389 \& }
2390 .Ve
2391 .Sp
2392 Then if a section ordering file like this is used:
2393 .Sp
2394 .Vb 2
2395 \& .text : { *(.text.first) ; *(.text.z*) }
2396 \& .data : { foo.o(.data.first) ; *(.data.small) }
2397 .Ve
2398 .Sp
2399 This would be equivalent to a linker script like this:
2400 .Sp
2401 .Vb 4
2402 \& SECTIONS {
2403 \& .text : { *(.text.first) ; *(.text.z*) ; *(.text.hot) ; *(.text .text.*) }
2404 \& .data : { foo.o(.data.first) ; *(.data.small) ; *(.data.big) ; *(.data .data.*) }
2405 \& }
2406 .Ve
2407 .Sp
2408 The advantage of the section ordering file is that it can be used to
2409 order those sections that matter to the user without having to worry
2410 about any other sections, or memory regions, or anything else.
2411 .IP \fB\-shared\fR 4
2412 .IX Item "-shared"
2413 .PD 0
2414 .IP \fB\-Bshareable\fR 4
2415 .IX Item "-Bshareable"
2416 .PD
2417 Create a shared library. This is currently only supported on ELF, XCOFF
2418 and SunOS platforms. On SunOS, the linker will automatically create a
2419 shared library if the \fB\-e\fR option is not used and there are
2420 undefined symbols in the link.
2421 .IP \fB\-\-sort\-common\fR 4
2422 .IX Item "--sort-common"
2423 .PD 0
2424 .IP \fB\-\-sort\-common=ascending\fR 4
2425 .IX Item "--sort-common=ascending"
2426 .IP \fB\-\-sort\-common=descending\fR 4
2427 .IX Item "--sort-common=descending"
2428 .PD
2429 This option tells \fBld\fR to sort the common symbols by alignment in
2430 ascending or descending order when it places them in the appropriate output
2431 sections. The symbol alignments considered are sixteen-byte or larger,
2432 eight-byte, four-byte, two-byte, and one-byte. This is to prevent gaps
2433 between symbols due to alignment constraints. If no sorting order is
2434 specified, then descending order is assumed.
2435 .IP \fB\-\-sort\-section=name\fR 4
2436 .IX Item "--sort-section=name"
2437 This option will apply \f(CW\*(C`SORT_BY_NAME\*(C'\fR to all wildcard section
2438 patterns in the linker script.
2439 .IP \fB\-\-sort\-section=alignment\fR 4
2440 .IX Item "--sort-section=alignment"
2441 This option will apply \f(CW\*(C`SORT_BY_ALIGNMENT\*(C'\fR to all wildcard section
2442 patterns in the linker script.
2443 .IP \fB\-\-spare\-dynamic\-tags=\fR\fIcount\fR 4
2444 .IX Item "--spare-dynamic-tags=count"
2445 This option specifies the number of empty slots to leave in the
2446 \&.dynamic section of ELF shared objects. Empty slots may be needed by
2447 post processing tools, such as the prelinker. The default is 5.
2448 .IP \fB\-\-split\-by\-file[=\fR\fIsize\fR\fB]\fR 4
2449 .IX Item "--split-by-file[=size]"
2450 Similar to \fB\-\-split\-by\-reloc\fR but creates a new output section for
2451 each input file when \fIsize\fR is reached. \fIsize\fR defaults to a
2452 size of 1 if not given.
2453 .IP \fB\-\-split\-by\-reloc[=\fR\fIcount\fR\fB]\fR 4
2454 .IX Item "--split-by-reloc[=count]"
2455 Tries to creates extra sections in the output file so that no single
2456 output section in the file contains more than \fIcount\fR relocations.
2457 This is useful when generating huge relocatable files for downloading into
2458 certain real time kernels with the COFF object file format; since COFF
2459 cannot represent more than 65535 relocations in a single section. Note
2460 that this will fail to work with object file formats which do not
2461 support arbitrary sections. The linker will not split up individual
2462 input sections for redistribution, so if a single input section contains
2463 more than \fIcount\fR relocations one output section will contain that
2464 many relocations. \fIcount\fR defaults to a value of 32768.
2465 .IP \fB\-\-stats\fR 4
2466 .IX Item "--stats"
2467 Compute and display statistics about the operation of the linker, such
2468 as execution time and memory usage.
2469 .IP \fB\-\-sysroot=\fR\fIdirectory\fR 4
2470 .IX Item "--sysroot=directory"
2471 Use \fIdirectory\fR as the location of the sysroot, overriding the
2472 configure-time default. This option is only supported by linkers
2473 that were configured using \fB\-\-with\-sysroot\fR.
2474 .IP \fB\-\-task\-link\fR 4
2475 .IX Item "--task-link"
2476 This is used by COFF/PE based targets to create a task-linked object
2477 file where all of the global symbols have been converted to statics.
2478 .IP \fB\-\-traditional\-format\fR 4
2479 .IX Item "--traditional-format"
2480 For some targets, the output of \fBld\fR is different in some ways from
2481 the output of some existing linker. This switch requests \fBld\fR to
2482 use the traditional format instead.
2483 .Sp
2484 For example, on SunOS, \fBld\fR combines duplicate entries in the
2485 symbol string table. This can reduce the size of an output file with
2486 full debugging information by over 30 percent. Unfortunately, the SunOS
2487 \&\f(CW\*(C`dbx\*(C'\fR program can not read the resulting program (\f(CW\*(C`gdb\*(C'\fR has no
2488 trouble). The \fB\-\-traditional\-format\fR switch tells \fBld\fR to not
2489 combine duplicate entries.
2490 .IP \fB\-\-section\-start=\fR\fIsectionname\fR\fB=\fR\fIorg\fR 4
2491 .IX Item "--section-start=sectionname=org"
2492 Locate a section in the output file at the absolute
2493 address given by \fIorg\fR. You may use this option as many
2494 times as necessary to locate multiple sections in the command
2495 line.
2496 \&\fIorg\fR must be a single hexadecimal integer;
2497 for compatibility with other linkers, you may omit the leading
2498 \&\fB0x\fR usually associated with hexadecimal values. \fINote:\fR there
2499 should be no white space between \fIsectionname\fR, the equals
2500 sign ("\fB=\fR"), and \fIorg\fR.
2501 .IP \fB\-\-image\-base=\fR\fIorg\fR 4
2502 .IX Item "--image-base=org"
2503 When using ELF, same as \fB\-Ttext\-segment\fR, with both options effectively
2504 setting the base address of the ELF executable.
2505 .Sp
2506 When using PE, use \fIvalue\fR as the base address of your program or dll.
2507 This is the lowest memory location that will be used when your program or
2508 dll is loaded. To reduce the need to relocate and improve performance of
2509 your dlls, each should have a unique base address and not overlap any
2510 other dlls. The default is 0x400000 for executables, and 0x10000000
2511 for dlls.
2512 .IP \fB\-Tbss=\fR\fIorg\fR 4
2513 .IX Item "-Tbss=org"
2514 .PD 0
2515 .IP \fB\-Tdata=\fR\fIorg\fR 4
2516 .IX Item "-Tdata=org"
2517 .IP \fB\-Ttext=\fR\fIorg\fR 4
2518 .IX Item "-Ttext=org"
2519 .PD
2520 Same as \fB\-\-section\-start\fR, with \f(CW\*(C`.bss\*(C'\fR, \f(CW\*(C`.data\*(C'\fR or
2521 \&\f(CW\*(C`.text\*(C'\fR as the \fIsectionname\fR.
2522 .IP \fB\-Ttext\-segment=\fR\fIorg\fR 4
2523 .IX Item "-Ttext-segment=org"
2524 When creating an ELF executable, it will set the address of the first
2525 byte of the first segment. Note that when \fB\-pie\fR is used with
2526 \&\fB\-Ttext\-segment=\fR\fIorg\fR, the output executable is marked
2527 ET_EXEC so that the address of the first byte of the text segment will
2528 be guaranteed to be \fIorg\fR at run time.
2529 .IP \fB\-Trodata\-segment=\fR\fIorg\fR 4
2530 .IX Item "-Trodata-segment=org"
2531 When creating an ELF executable or shared object for a target where
2532 the read-only data is in its own segment separate from the executable
2533 text, it will set the address of the first byte of the read-only data segment.
2534 .IP \fB\-Tldata\-segment=\fR\fIorg\fR 4
2535 .IX Item "-Tldata-segment=org"
2536 When creating an ELF executable or shared object for x86\-64 medium memory
2537 model, it will set the address of the first byte of the ldata segment.
2538 .IP \fB\-\-unresolved\-symbols=\fR\fImethod\fR 4
2539 .IX Item "--unresolved-symbols=method"
2540 Determine how to handle unresolved symbols. There are four possible
2541 values for \fBmethod\fR:
2542 .RS 4
2543 .IP \fBignore-all\fR 4
2544 .IX Item "ignore-all"
2545 Do not report any unresolved symbols.
2546 .IP \fBreport-all\fR 4
2547 .IX Item "report-all"
2548 Report all unresolved symbols. This is the default.
2549 .IP \fBignore-in-object-files\fR 4
2550 .IX Item "ignore-in-object-files"
2551 Report unresolved symbols that are contained in shared libraries, but
2552 ignore them if they come from regular object files.
2553 .IP \fBignore-in-shared-libs\fR 4
2554 .IX Item "ignore-in-shared-libs"
2555 Report unresolved symbols that come from regular object files, but
2556 ignore them if they come from shared libraries. This can be useful
2557 when creating a dynamic binary and it is known that all the shared
2558 libraries that it should be referencing are included on the linker's
2559 command line.
2560 .RE
2561 .RS 4
2562 .Sp
2563 The behaviour for shared libraries on their own can also be controlled
2564 by the \fB\-\-[no\-]allow\-shlib\-undefined\fR option.
2565 .Sp
2566 Normally the linker will generate an error message for each reported
2567 unresolved symbol but the option \fB\-\-warn\-unresolved\-symbols\fR
2568 can change this to a warning.
2569 .RE
2570 .IP \fB\-\-dll\-verbose\fR 4
2571 .IX Item "--dll-verbose"
2572 .PD 0
2573 .IP \fB\-\-verbose[=\fR\fINUMBER\fR\fB]\fR 4
2574 .IX Item "--verbose[=NUMBER]"
2575 .PD
2576 Display the version number for \fBld\fR and list the linker emulations
2577 supported. Display which input files can and cannot be opened. Display
2578 the linker script being used by the linker. If the optional \fINUMBER\fR
2579 argument > 1, plugin symbol status will also be displayed.
2580 .IP \fB\-\-version\-script=\fR\fIversion-scriptfile\fR 4
2581 .IX Item "--version-script=version-scriptfile"
2582 Specify the name of a version script to the linker. This is typically
2583 used when creating shared libraries to specify additional information
2584 about the version hierarchy for the library being created. This option
2585 is only fully supported on ELF platforms which support shared libraries;
2586 see \fBVERSION\fR. It is partially supported on PE platforms, which can
2587 use version scripts to filter symbol visibility in auto-export mode: any
2588 symbols marked \fBlocal\fR in the version script will not be exported.
2589 .IP \fB\-\-warn\-common\fR 4
2590 .IX Item "--warn-common"
2591 Warn when a common symbol is combined with another common symbol or with
2592 a symbol definition. Unix linkers allow this somewhat sloppy practice,
2593 but linkers on some other operating systems do not. This option allows
2594 you to find potential problems from combining global symbols.
2595 Unfortunately, some C libraries use this practice, so you may get some
2596 warnings about symbols in the libraries as well as in your programs.
2597 .Sp
2598 There are three kinds of global symbols, illustrated here by C examples:
2599 .RS 4
2600 .IP "\fBint i = 1;\fR" 4
2601 .IX Item "int i = 1;"
2602 A definition, which goes in the initialized data section of the output
2603 file.
2604 .IP "\fBextern int i;\fR" 4
2605 .IX Item "extern int i;"
2606 An undefined reference, which does not allocate space.
2607 There must be either a definition or a common symbol for the
2608 variable somewhere.
2609 .IP "\fBint i;\fR" 4
2610 .IX Item "int i;"
2611 A common symbol. If there are only (one or more) common symbols for a
2612 variable, it goes in the uninitialized data area of the output file.
2613 The linker merges multiple common symbols for the same variable into a
2614 single symbol. If they are of different sizes, it picks the largest
2615 size. The linker turns a common symbol into a declaration, if there is
2616 a definition of the same variable.
2617 .RE
2618 .RS 4
2619 .Sp
2620 The \fB\-\-warn\-common\fR option can produce five kinds of warnings.
2621 Each warning consists of a pair of lines: the first describes the symbol
2622 just encountered, and the second describes the previous symbol
2623 encountered with the same name. One or both of the two symbols will be
2624 a common symbol.
2625 .IP 1. 4
2626 Turning a common symbol into a reference, because there is already a
2627 definition for the symbol.
2628 .Sp
2629 .Vb 3
2630 \& <file>(<section>): warning: common of \`<symbol>\*(Aq
2631 \& overridden by definition
2632 \& <file>(<section>): warning: defined here
2633 .Ve
2634 .IP 2. 4
2635 Turning a common symbol into a reference, because a later definition for
2636 the symbol is encountered. This is the same as the previous case,
2637 except that the symbols are encountered in a different order.
2638 .Sp
2639 .Vb 3
2640 \& <file>(<section>): warning: definition of \`<symbol>\*(Aq
2641 \& overriding common
2642 \& <file>(<section>): warning: common is here
2643 .Ve
2644 .IP 3. 4
2645 Merging a common symbol with a previous same-sized common symbol.
2646 .Sp
2647 .Vb 3
2648 \& <file>(<section>): warning: multiple common
2649 \& of \`<symbol>\*(Aq
2650 \& <file>(<section>): warning: previous common is here
2651 .Ve
2652 .IP 4. 4
2653 Merging a common symbol with a previous larger common symbol.
2654 .Sp
2655 .Vb 3
2656 \& <file>(<section>): warning: common of \`<symbol>\*(Aq
2657 \& overridden by larger common
2658 \& <file>(<section>): warning: larger common is here
2659 .Ve
2660 .IP 5. 4
2661 Merging a common symbol with a previous smaller common symbol. This is
2662 the same as the previous case, except that the symbols are
2663 encountered in a different order.
2664 .Sp
2665 .Vb 3
2666 \& <file>(<section>): warning: common of \`<symbol>\*(Aq
2667 \& overriding smaller common
2668 \& <file>(<section>): warning: smaller common is here
2669 .Ve
2670 .RE
2671 .RS 4
2672 .RE
2673 .IP \fB\-\-warn\-constructors\fR 4
2674 .IX Item "--warn-constructors"
2675 Warn if any global constructors are used. This is only useful for a few
2676 object file formats. For formats like COFF or ELF, the linker can not
2677 detect the use of global constructors.
2678 .IP \fB\-\-warn\-execstack\fR 4
2679 .IX Item "--warn-execstack"
2680 .PD 0
2681 .IP \fB\-\-warn\-execstack\-objects\fR 4
2682 .IX Item "--warn-execstack-objects"
2683 .IP \fB\-\-no\-warn\-execstack\fR 4
2684 .IX Item "--no-warn-execstack"
2685 .PD
2686 On ELF platforms the linker may generate warning messages if it is
2687 asked to create an output file that contains an executable stack.
2688 There are three possible states:
2689 .RS 4
2690 .IP 1. 4
2691 Do not generate any warnings.
2692 .IP 2. 4
2693 Always generate warnings, even if the executable stack is requested
2694 via the \fB\-z execstack\fR command line option.
2695 .IP 3. 4
2696 Only generate a warning if an object file requests an executable
2697 stack, but not if the \fB\-z execstack\fR option is used.
2698 .RE
2699 .RS 4
2700 .Sp
2701 The default state depends upon how the linker was configured when it
2702 was built. The \fB\-\-no\-warn\-execstack\fR option always puts the
2703 linker into the no-warnings state. The \fB\-\-warn\-execstack\fR
2704 option puts the linker into the warn-always state. The
2705 \&\fB\-\-warn\-execstack\-objects\fR option puts the linker into the
2706 warn-for-object-files-only state.
2707 .Sp
2708 Note: ELF format input files can specify that they need an executable
2709 stack by having a \fI.note.GNU\-stack\fR section with the executable
2710 bit set in its section flags. They can specify that they do not need
2711 an executable stack by having the same section, but without the
2712 executable flag bit set. If an input file does not have a
2713 \&\fI.note.GNU\-stack\fR section then the default behaviour is target
2714 specific. For some targets, then absence of such a section implies
2715 that an executable stack \fIis\fR required. This is often a problem
2716 for hand crafted assembler files.
2717 .RE
2718 .IP \fB\-\-error\-execstack\fR 4
2719 .IX Item "--error-execstack"
2720 .PD 0
2721 .IP \fB\-\-no\-error\-execstack\fR 4
2722 .IX Item "--no-error-execstack"
2723 .PD
2724 If the linker is going to generate a warning message about an
2725 executable stack then the \fB\-\-error\-execstack\fR option will
2726 instead change that warning into an error. Note \- this option does
2727 not change the linker's execstack warning generation state. Use
2728 \&\fB\-\-warn\-execstack\fR or \fB\-\-warn\-execstack\-objects\fR to set
2729 a specific warning state.
2730 .Sp
2731 The \fB\-\-no\-error\-execstack\fR option will restore the default
2732 behaviour of generating warning messages.
2733 .IP \fB\-\-warn\-multiple\-gp\fR 4
2734 .IX Item "--warn-multiple-gp"
2735 Warn if multiple global pointer values are required in the output file.
2736 This is only meaningful for certain processors, such as the Alpha.
2737 Specifically, some processors put large-valued constants in a special
2738 section. A special register (the global pointer) points into the middle
2739 of this section, so that constants can be loaded efficiently via a
2740 base-register relative addressing mode. Since the offset in
2741 base-register relative mode is fixed and relatively small (e.g., 16
2742 bits), this limits the maximum size of the constant pool. Thus, in
2743 large programs, it is often necessary to use multiple global pointer
2744 values in order to be able to address all possible constants. This
2745 option causes a warning to be issued whenever this case occurs.
2746 .IP \fB\-\-warn\-once\fR 4
2747 .IX Item "--warn-once"
2748 Only warn once for each undefined symbol, rather than once per module
2749 which refers to it.
2750 .IP \fB\-\-warn\-rwx\-segments\fR 4
2751 .IX Item "--warn-rwx-segments"
2752 .PD 0
2753 .IP \fB\-\-no\-warn\-rwx\-segments\fR 4
2754 .IX Item "--no-warn-rwx-segments"
2755 .PD
2756 Warn if the linker creates a loadable, non-zero sized segment that has
2757 all three of the read, write and execute permission flags set. Such a
2758 segment represents a potential security vulnerability. In addition
2759 warnings will be generated if a thread local storage segment is
2760 created with the execute permission flag set, regardless of whether or
2761 not it has the read and/or write flags set.
2762 .Sp
2763 These warnings are enabled by default. They can be disabled via the
2764 \&\fB\-\-no\-warn\-rwx\-segments\fR option and re-enabled via the
2765 \&\fB\-\-warn\-rwx\-segments\fR option.
2766 .IP \fB\-\-error\-rwx\-segments\fR 4
2767 .IX Item "--error-rwx-segments"
2768 .PD 0
2769 .IP \fB\-\-no\-error\-rwx\-segments\fR 4
2770 .IX Item "--no-error-rwx-segments"
2771 .PD
2772 If the linker is going to generate a warning message about an
2773 executable, writeable segment, or an executable TLS segment, then the
2774 \&\fB\-\-error\-rwx\-segments\fR option will turn this warning into an
2775 error instead. The \fB\-\-no\-error\-rwx\-segments\fR option will
2776 restore the default behaviour of just generating a warning message.
2777 .Sp
2778 Note \- the \fB\-\-error\-rwx\-segments\fR option does not by itself
2779 turn on warnings about these segments. These warnings are either
2780 enabled by default, if the linker was configured that way, or via the
2781 \&\fB\-\-warn\-rwx\-segments\fR command line option.
2782 .IP \fB\-\-warn\-section\-align\fR 4
2783 .IX Item "--warn-section-align"
2784 Warn if the address of an output section is changed because of
2785 alignment. Typically, the alignment will be set by an input section.
2786 The address will only be changed if it not explicitly specified; that
2787 is, if the \f(CW\*(C`SECTIONS\*(C'\fR command does not specify a start address for
2788 the section.
2789 .IP \fB\-\-warn\-textrel\fR 4
2790 .IX Item "--warn-textrel"
2791 Warn if the linker adds DT_TEXTREL to a position-independent executable
2792 or shared object.
2793 .IP \fB\-\-warn\-alternate\-em\fR 4
2794 .IX Item "--warn-alternate-em"
2795 Warn if an object has alternate ELF machine code.
2796 .IP \fB\-\-warn\-unresolved\-symbols\fR 4
2797 .IX Item "--warn-unresolved-symbols"
2798 If the linker is going to report an unresolved symbol (see the option
2799 \&\fB\-\-unresolved\-symbols\fR) it will normally generate an error.
2800 This option makes it generate a warning instead.
2801 .IP \fB\-\-error\-unresolved\-symbols\fR 4
2802 .IX Item "--error-unresolved-symbols"
2803 This restores the linker's default behaviour of generating errors when
2804 it is reporting unresolved symbols.
2805 .IP \fB\-\-whole\-archive\fR 4
2806 .IX Item "--whole-archive"
2807 For each archive mentioned on the command line after the
2808 \&\fB\-\-whole\-archive\fR option, include every object file in the archive
2809 in the link, rather than searching the archive for the required object
2810 files. This is normally used to turn an archive file into a shared
2811 library, forcing every object to be included in the resulting shared
2812 library. This option may be used more than once.
2813 .Sp
2814 Two notes when using this option from gcc: First, gcc doesn't know
2815 about this option, so you have to use \fB\-Wl,\-whole\-archive\fR.
2816 Second, don't forget to use \fB\-Wl,\-no\-whole\-archive\fR after your
2817 list of archives, because gcc will add its own list of archives to
2818 your link and you may not want this flag to affect those as well.
2819 .IP \fB\-\-wrap=\fR\fIsymbol\fR 4
2820 .IX Item "--wrap=symbol"
2821 Use a wrapper function for \fIsymbol\fR. Any undefined reference to
2822 \&\fIsymbol\fR will be resolved to \f(CW\*(C`_\|_wrap_\fR\f(CIsymbol\fR\f(CW\*(C'\fR. Any
2823 undefined reference to \f(CW\*(C`_\|_real_\fR\f(CIsymbol\fR\f(CW\*(C'\fR will be resolved to
2824 \&\fIsymbol\fR.
2825 .Sp
2826 This can be used to provide a wrapper for a system function. The
2827 wrapper function should be called \f(CW\*(C`_\|_wrap_\fR\f(CIsymbol\fR\f(CW\*(C'\fR. If it
2828 wishes to call the system function, it should call
2829 \&\f(CW\*(C`_\|_real_\fR\f(CIsymbol\fR\f(CW\*(C'\fR.
2830 .Sp
2831 Here is a trivial example:
2832 .Sp
2833 .Vb 6
2834 \& void *
2835 \& _\|_wrap_malloc (size_t c)
2836 \& {
2837 \& printf ("malloc called with %zu\en", c);
2838 \& return _\|_real_malloc (c);
2839 \& }
2840 .Ve
2841 .Sp
2842 If you link other code with this file using \fB\-\-wrap malloc\fR, then
2843 all calls to \f(CW\*(C`malloc\*(C'\fR will call the function \f(CW\*(C`_\|_wrap_malloc\*(C'\fR
2844 instead. The call to \f(CW\*(C`_\|_real_malloc\*(C'\fR in \f(CW\*(C`_\|_wrap_malloc\*(C'\fR will
2845 call the real \f(CW\*(C`malloc\*(C'\fR function.
2846 .Sp
2847 You may wish to provide a \f(CW\*(C`_\|_real_malloc\*(C'\fR function as well, so that
2848 links without the \fB\-\-wrap\fR option will succeed. If you do this,
2849 you should not put the definition of \f(CW\*(C`_\|_real_malloc\*(C'\fR in the same
2850 file as \f(CW\*(C`_\|_wrap_malloc\*(C'\fR; if you do, the assembler may resolve the
2851 call before the linker has a chance to wrap it to \f(CW\*(C`malloc\*(C'\fR.
2852 .Sp
2853 Only undefined references are replaced by the linker. So, translation unit
2854 internal references to \fIsymbol\fR are not resolved to
2855 \&\f(CW\*(C`_\|_wrap_\fR\f(CIsymbol\fR\f(CW\*(C'\fR. In the next example, the call to \f(CW\*(C`f\*(C'\fR in
2856 \&\f(CW\*(C`g\*(C'\fR is not resolved to \f(CW\*(C`_\|_wrap_f\*(C'\fR.
2857 .Sp
2858 .Vb 5
2859 \& int
2860 \& f (void)
2861 \& {
2862 \& return 123;
2863 \& }
2864 \&
2865 \& int
2866 \& g (void)
2867 \& {
2868 \& return f();
2869 \& }
2870 .Ve
2871 .IP \fB\-\-eh\-frame\-hdr\fR 4
2872 .IX Item "--eh-frame-hdr"
2873 .PD 0
2874 .IP \fB\-\-no\-eh\-frame\-hdr\fR 4
2875 .IX Item "--no-eh-frame-hdr"
2876 .PD
2877 Request (\fB\-\-eh\-frame\-hdr\fR) or suppress
2878 (\fB\-\-no\-eh\-frame\-hdr\fR) the creation of \f(CW\*(C`.eh_frame_hdr\*(C'\fR
2879 section and ELF \f(CW\*(C`PT_GNU_EH_FRAME\*(C'\fR segment header.
2880 .IP \fB\-\-no\-ld\-generated\-unwind\-info\fR 4
2881 .IX Item "--no-ld-generated-unwind-info"
2882 Request creation of \f(CW\*(C`.eh_frame\*(C'\fR unwind info for linker
2883 generated code sections like PLT. This option is on by default
2884 if linker generated unwind info is supported. This option also
2885 controls the generation of \f(CW\*(C`.sframe\*(C'\fR stack trace info for linker
2886 generated code sections like PLT.
2887 .IP \fB\-\-enable\-new\-dtags\fR 4
2888 .IX Item "--enable-new-dtags"
2889 .PD 0
2890 .IP \fB\-\-disable\-new\-dtags\fR 4
2891 .IX Item "--disable-new-dtags"
2892 .PD
2893 This linker can create the new dynamic tags in ELF. But the older ELF
2894 systems may not understand them. If you specify
2895 \&\fB\-\-enable\-new\-dtags\fR, the new dynamic tags will be created as needed
2896 and older dynamic tags will be omitted.
2897 If you specify \fB\-\-disable\-new\-dtags\fR, no new dynamic tags will be
2898 created. By default, the new dynamic tags are not created. Note that
2899 those options are only available for ELF systems.
2900 .IP \fB\-\-hash\-size=\fR\fInumber\fR 4
2901 .IX Item "--hash-size=number"
2902 Set the default size of the linker's hash tables to a prime number
2903 close to \fInumber\fR. Increasing this value can reduce the length of
2904 time it takes the linker to perform its tasks, at the expense of
2905 increasing the linker's memory requirements. Similarly reducing this
2906 value can reduce the memory requirements at the expense of speed.
2907 .IP \fB\-\-hash\-style=\fR\fIstyle\fR 4
2908 .IX Item "--hash-style=style"
2909 Set the type of linker's hash table(s). \fIstyle\fR can be either
2910 \&\f(CW\*(C`sysv\*(C'\fR for classic ELF \f(CW\*(C`.hash\*(C'\fR section, \f(CW\*(C`gnu\*(C'\fR for
2911 new style GNU \f(CW\*(C`.gnu.hash\*(C'\fR section or \f(CW\*(C`both\*(C'\fR for both
2912 the classic ELF \f(CW\*(C`.hash\*(C'\fR and new style GNU \f(CW\*(C`.gnu.hash\*(C'\fR
2913 hash tables. The default depends upon how the linker was configured,
2914 but for most Linux based systems it will be \f(CW\*(C`both\*(C'\fR.
2915 .IP \fB\-\-compress\-debug\-sections=none\fR 4
2916 .IX Item "--compress-debug-sections=none"
2917 .PD 0
2918 .IP \fB\-\-compress\-debug\-sections=zlib\fR 4
2919 .IX Item "--compress-debug-sections=zlib"
2920 .IP \fB\-\-compress\-debug\-sections=zlib\-gnu\fR 4
2921 .IX Item "--compress-debug-sections=zlib-gnu"
2922 .IP \fB\-\-compress\-debug\-sections=zlib\-gabi\fR 4
2923 .IX Item "--compress-debug-sections=zlib-gabi"
2924 .IP \fB\-\-compress\-debug\-sections=zstd\fR 4
2925 .IX Item "--compress-debug-sections=zstd"
2926 .PD
2927 On ELF platforms, these options control how DWARF debug sections are
2928 compressed using zlib.
2929 .Sp
2930 \&\fB\-\-compress\-debug\-sections=none\fR doesn't compress DWARF debug
2931 sections. \fB\-\-compress\-debug\-sections=zlib\-gnu\fR compresses
2932 DWARF debug sections and renames them to begin with \fB.zdebug\fR
2933 instead of \fB.debug\fR. \fB\-\-compress\-debug\-sections=zlib\-gabi\fR
2934 also compresses DWARF debug sections, but rather than renaming them it
2935 sets the SHF_COMPRESSED flag in the sections' headers.
2936 .Sp
2937 The \fB\-\-compress\-debug\-sections=zlib\fR option is an alias for
2938 \&\fB\-\-compress\-debug\-sections=zlib\-gabi\fR.
2939 .Sp
2940 \&\fB\-\-compress\-debug\-sections=zstd\fR compresses DWARF debug sections using
2941 zstd.
2942 .Sp
2943 Note that this option overrides any compression in input debug
2944 sections, so if a binary is linked with \fB\-\-compress\-debug\-sections=none\fR
2945 for example, then any compressed debug sections in input files will be
2946 uncompressed before they are copied into the output binary.
2947 .Sp
2948 The default compression behaviour varies depending upon the target
2949 involved and the configure options used to build the toolchain. The
2950 default can be determined by examining the output from the linker's
2951 \&\fB\-\-help\fR option.
2952 .IP \fB\-\-reduce\-memory\-overheads\fR 4
2953 .IX Item "--reduce-memory-overheads"
2954 This option reduces memory requirements at ld runtime, at the expense of
2955 linking speed. This was introduced to select the old O(n^2) algorithm
2956 for link map file generation, rather than the new O(n) algorithm which uses
2957 about 40% more memory for symbol storage.
2958 .Sp
2959 Another effect of the switch is to set the default hash table size to
2960 1021, which again saves memory at the cost of lengthening the linker's
2961 run time. This is not done however if the \fB\-\-hash\-size\fR switch
2962 has been used.
2963 .Sp
2964 The \fB\-\-reduce\-memory\-overheads\fR switch may be also be used to
2965 enable other tradeoffs in future versions of the linker.
2966 .IP \fB\-\-max\-cache\-size=\fR\fIsize\fR 4
2967 .IX Item "--max-cache-size=size"
2968 \&\fBld\fR normally caches the relocation information and symbol tables
2969 of input files in memory with the unlimited size. This option sets the
2970 maximum cache size to \fIsize\fR.
2971 .IP \fB\-\-build\-id\fR 4
2972 .IX Item "--build-id"
2973 .PD 0
2974 .IP \fB\-\-build\-id=\fR\fIstyle\fR 4
2975 .IX Item "--build-id=style"
2976 .PD
2977 Request the creation of a \f(CW\*(C`.note.gnu.build\-id\*(C'\fR ELF note section
2978 or a \f(CW\*(C`.buildid\*(C'\fR COFF section. The contents of the note are
2979 unique bits identifying this linked file. \fIstyle\fR can be
2980 \&\f(CW\*(C`uuid\*(C'\fR to use 128 random bits; \f(CW\*(C`sha1\*(C'\fR to use a 160\-bit
2981 SHA1 hash, \f(CW\*(C`md5\*(C'\fR to use a 128\-bit MD5 hash, or \f(CW\*(C`xx\*(C'\fR
2982 to use a 128\-bit XXHASH on the normative parts of the output
2983 contents; or \f(CW\*(C`0x\fR\f(CIhexstring\fR\f(CW\*(C'\fR to use a chosen bit string
2984 specified as an even number of hexadecimal digits (\f(CW\*(C`\-\*(C'\fR and
2985 \&\f(CW\*(C`:\*(C'\fR characters between digit pairs are ignored). If \fIstyle\fR
2986 is omitted, \f(CW\*(C`sha1\*(C'\fR is used.
2987 .Sp
2988 The \f(CW\*(C`md5\*(C'\fR, \f(CW\*(C`sha1\*(C'\fR, and \f(CW\*(C`xx\*(C'\fR styles produces an
2989 identifier that is always the same in an identical output file, but
2990 are almost certainly unique among all nonidentical output files. It
2991 is not intended to be compared as a checksum for the file's contents.
2992 A linked file may be changed later by other tools, but the build ID
2993 bit string identifying the original linked file does not change.
2994 .Sp
2995 Passing \f(CW\*(C`none\*(C'\fR for \fIstyle\fR disables the setting from any
2996 \&\f(CW\*(C`\-\-build\-id\*(C'\fR options earlier on the command line.
2997 .IP \fB\-\-package\-metadata=\fR\fIJSON\fR 4
2998 .IX Item "--package-metadata=JSON"
2999 Request the creation of a \f(CW\*(C`.note.package\*(C'\fR ELF note section. The
3000 contents of the note are in JSON format, as per the package metadata
3001 specification. For more information see:
3002 https://systemd.io/ELF_PACKAGE_METADATA/
3003 The JSON argument support percent-encoding and following %[string]
3004 (where string refers to the name in HTML's Named Character References)
3005 encoding: \fB%[comma]\fR for \fB,\fR, \fB%[lbrace]\fR for \fB{\fR,
3006 \&\fB%[quot]\fR for \fB"\fR, \fB%[rbrace]\fR for \fB}\fR, and
3007 \&\fB%[space]\fR for space character.
3008 If the JSON argument is missing/empty then this will disable the
3009 creation of the metadata note, if one had been enabled by an earlier
3010 occurrence of the \-\-package\-metadata option.
3011 If the linker has been built with libjansson, then the JSON string
3012 will be validated.
3013 .PP
3014 The i386 PE linker supports the \fB\-shared\fR option, which causes
3015 the output to be a dynamically linked library (DLL) instead of a
3016 normal executable. You should name the output \f(CW\*(C`*.dll\*(C'\fR when you
3017 use this option. In addition, the linker fully supports the standard
3018 \&\f(CW\*(C`*.def\*(C'\fR files, which may be specified on the linker command line
3019 like an object file (in fact, it should precede archives it exports
3020 symbols from, to ensure that they get linked in, just like a normal
3021 object file).
3022 .PP
3023 In addition to the options common to all targets, the i386 PE linker
3024 support additional command-line options that are specific to the i386
3025 PE target. Options that take values may be separated from their
3026 values by either a space or an equals sign.
3027 .IP \fB\-\-add\-stdcall\-alias\fR 4
3028 .IX Item "--add-stdcall-alias"
3029 If given, symbols with a stdcall suffix (@\fInn\fR) will be exported
3030 as-is and also with the suffix stripped.
3031 [This option is specific to the i386 PE targeted port of the linker]
3032 .IP "\fB\-\-base\-file\fR \fIfile\fR" 4
3033 .IX Item "--base-file file"
3034 Use \fIfile\fR as the name of a file in which to save the base
3035 addresses of all the relocations needed for generating DLLs with
3036 \&\fIdlltool\fR.
3037 [This is an i386 PE specific option]
3038 .IP \fB\-\-dll\fR 4
3039 .IX Item "--dll"
3040 Create a DLL instead of a regular executable. You may also use
3041 \&\fB\-shared\fR or specify a \f(CW\*(C`LIBRARY\*(C'\fR in a given \f(CW\*(C`.def\*(C'\fR
3042 file.
3043 [This option is specific to the i386 PE targeted port of the linker]
3044 .IP \fB\-\-enable\-long\-section\-names\fR 4
3045 .IX Item "--enable-long-section-names"
3046 .PD 0
3047 .IP \fB\-\-disable\-long\-section\-names\fR 4
3048 .IX Item "--disable-long-section-names"
3049 .PD
3050 The PE variants of the COFF object format add an extension that permits
3051 the use of section names longer than eight characters, the normal limit
3052 for COFF. By default, these names are only allowed in object files, as
3053 fully-linked executable images do not carry the COFF string table required
3054 to support the longer names. As a GNU extension, it is possible to
3055 allow their use in executable images as well, or to (probably pointlessly!)
3056 disallow it in object files, by using these two options. Executable images
3057 generated with these long section names are slightly non-standard, carrying
3058 as they do a string table, and may generate confusing output when examined
3059 with non-GNU PE-aware tools, such as file viewers and dumpers. However,
3060 GDB relies on the use of PE long section names to find Dwarf\-2 debug
3061 information sections in an executable image at runtime, and so if neither
3062 option is specified on the command-line, \fBld\fR will enable long
3063 section names, overriding the default and technically correct behaviour,
3064 when it finds the presence of debug information while linking an executable
3065 image and not stripping symbols.
3066 [This option is valid for all PE targeted ports of the linker]
3067 .IP \fB\-\-enable\-stdcall\-fixup\fR 4
3068 .IX Item "--enable-stdcall-fixup"
3069 .PD 0
3070 .IP \fB\-\-disable\-stdcall\-fixup\fR 4
3071 .IX Item "--disable-stdcall-fixup"
3072 .PD
3073 If the link finds a symbol that it cannot resolve, it will attempt to
3074 do "fuzzy linking" by looking for another defined symbol that differs
3075 only in the format of the symbol name (cdecl vs stdcall) and will
3076 resolve that symbol by linking to the match. For example, the
3077 undefined symbol \f(CW\*(C`_foo\*(C'\fR might be linked to the function
3078 \&\f(CW\*(C`_foo@12\*(C'\fR, or the undefined symbol \f(CW\*(C`_bar@16\*(C'\fR might be linked
3079 to the function \f(CW\*(C`_bar\*(C'\fR. When the linker does this, it prints a
3080 warning, since it normally should have failed to link, but sometimes
3081 import libraries generated from third-party dlls may need this feature
3082 to be usable. If you specify \fB\-\-enable\-stdcall\-fixup\fR, this
3083 feature is fully enabled and warnings are not printed. If you specify
3084 \&\fB\-\-disable\-stdcall\-fixup\fR, this feature is disabled and such
3085 mismatches are considered to be errors.
3086 [This option is specific to the i386 PE targeted port of the linker]
3087 .IP \fB\-\-leading\-underscore\fR 4
3088 .IX Item "--leading-underscore"
3089 .PD 0
3090 .IP \fB\-\-no\-leading\-underscore\fR 4
3091 .IX Item "--no-leading-underscore"
3092 .PD
3093 For most targets default symbol-prefix is an underscore and is defined
3094 in target's description. By this option it is possible to
3095 disable/enable the default underscore symbol-prefix.
3096 .IP \fB\-\-export\-all\-symbols\fR 4
3097 .IX Item "--export-all-symbols"
3098 If given, all global symbols in the objects used to build a DLL will
3099 be exported by the DLL. Note that this is the default if there
3100 otherwise wouldn't be any exported symbols. When symbols are
3101 explicitly exported via DEF files or implicitly exported via function
3102 attributes, the default is to not export anything else unless this
3103 option is given. Note that the symbols \f(CW\*(C`DllMain@12\*(C'\fR,
3104 \&\f(CW\*(C`DllEntryPoint@0\*(C'\fR, \f(CW\*(C`DllMainCRTStartup@12\*(C'\fR, and
3105 \&\f(CW\*(C`impure_ptr\*(C'\fR will not be automatically
3106 exported. Also, symbols imported from other DLLs will not be
3107 re-exported, nor will symbols specifying the DLL's internal layout
3108 such as those beginning with \f(CW\*(C`_head_\*(C'\fR or ending with
3109 \&\f(CW\*(C`_iname\*(C'\fR. In addition, no symbols from \f(CW\*(C`libgcc\*(C'\fR,
3110 \&\f(CW\*(C`libstd++\*(C'\fR, \f(CW\*(C`libmingw32\*(C'\fR, or \f(CW\*(C`crtX.o\*(C'\fR will be exported.
3111 Symbols whose names begin with \f(CW\*(C`_\|_rtti_\*(C'\fR or \f(CW\*(C`_\|_builtin_\*(C'\fR will
3112 not be exported, to help with C++ DLLs. Finally, there is an
3113 extensive list of cygwin-private symbols that are not exported
3114 (obviously, this applies on when building DLLs for cygwin targets).
3115 These cygwin-excludes are: \f(CW\*(C`_cygwin_dll_entry@12\*(C'\fR,
3116 \&\f(CW\*(C`_cygwin_crt0_common@8\*(C'\fR, \f(CW\*(C`_cygwin_noncygwin_dll_entry@12\*(C'\fR,
3117 \&\f(CW\*(C`_fmode\*(C'\fR, \f(CW\*(C`_impure_ptr\*(C'\fR, \f(CW\*(C`cygwin_attach_dll\*(C'\fR,
3118 \&\f(CW\*(C`cygwin_premain0\*(C'\fR, \f(CW\*(C`cygwin_premain1\*(C'\fR, \f(CW\*(C`cygwin_premain2\*(C'\fR,
3119 \&\f(CW\*(C`cygwin_premain3\*(C'\fR, and \f(CW\*(C`environ\*(C'\fR.
3120 [This option is specific to the i386 PE targeted port of the linker]
3121 .IP "\fB\-\-exclude\-symbols\fR \fIsymbol\fR\fB,\fR\fIsymbol\fR\fB,...\fR" 4
3122 .IX Item "--exclude-symbols symbol,symbol,..."
3123 Specifies a list of symbols which should not be automatically
3124 exported. The symbol names may be delimited by commas or colons.
3125 [This option is specific to the i386 PE targeted port of the linker]
3126 .IP \fB\-\-exclude\-all\-symbols\fR 4
3127 .IX Item "--exclude-all-symbols"
3128 Specifies no symbols should be automatically exported.
3129 [This option is specific to the i386 PE targeted port of the linker]
3130 .IP \fB\-\-file\-alignment\fR 4
3131 .IX Item "--file-alignment"
3132 Specify the file alignment. Sections in the file will always begin at
3133 file offsets which are multiples of this number. This defaults to
3134 512.
3135 [This option is specific to the i386 PE targeted port of the linker]
3136 .IP "\fB\-\-heap\fR \fIreserve\fR" 4
3137 .IX Item "--heap reserve"
3138 .PD 0
3139 .IP "\fB\-\-heap\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
3140 .IX Item "--heap reserve,commit"
3141 .PD
3142 Specify the number of bytes of memory to reserve (and optionally commit)
3143 to be used as heap for this program. The default is 1MB reserved, 4K
3144 committed.
3145 [This option is specific to the i386 PE targeted port of the linker]
3146 .IP \fB\-\-kill\-at\fR 4
3147 .IX Item "--kill-at"
3148 If given, the stdcall suffixes (@\fInn\fR) will be stripped from
3149 symbols before they are exported.
3150 [This option is specific to the i386 PE targeted port of the linker]
3151 .IP \fB\-\-large\-address\-aware\fR 4
3152 .IX Item "--large-address-aware"
3153 If given, the appropriate bit in the "Characteristics" field of the COFF
3154 header is set to indicate that this executable supports virtual addresses
3155 greater than 2 gigabytes. This should be used in conjunction with the /3GB
3156 or /USERVA=\fIvalue\fR megabytes switch in the "[operating systems]"
3157 section of the BOOT.INI. Otherwise, this bit has no effect.
3158 [This option is specific to PE targeted ports of the linker]
3159 .IP \fB\-\-disable\-large\-address\-aware\fR 4
3160 .IX Item "--disable-large-address-aware"
3161 Reverts the effect of a previous \fB\-\-large\-address\-aware\fR option.
3162 This is useful if \fB\-\-large\-address\-aware\fR is always set by the compiler
3163 driver (e.g. Cygwin gcc) and the executable does not support virtual
3164 addresses greater than 2 gigabytes.
3165 [This option is specific to PE targeted ports of the linker]
3166 .IP "\fB\-\-major\-image\-version\fR \fIvalue\fR" 4
3167 .IX Item "--major-image-version value"
3168 Sets the major number of the "image version". Defaults to 1.
3169 [This option is specific to the i386 PE targeted port of the linker]
3170 .IP "\fB\-\-major\-os\-version\fR \fIvalue\fR" 4
3171 .IX Item "--major-os-version value"
3172 Sets the major number of the "os version". Defaults to 4.
3173 [This option is specific to the i386 PE targeted port of the linker]
3174 .IP "\fB\-\-major\-subsystem\-version\fR \fIvalue\fR" 4
3175 .IX Item "--major-subsystem-version value"
3176 Sets the major number of the "subsystem version". Defaults to 4.
3177 [This option is specific to the i386 PE targeted port of the linker]
3178 .IP "\fB\-\-minor\-image\-version\fR \fIvalue\fR" 4
3179 .IX Item "--minor-image-version value"
3180 Sets the minor number of the "image version". Defaults to 0.
3181 [This option is specific to the i386 PE targeted port of the linker]
3182 .IP "\fB\-\-minor\-os\-version\fR \fIvalue\fR" 4
3183 .IX Item "--minor-os-version value"
3184 Sets the minor number of the "os version". Defaults to 0.
3185 [This option is specific to the i386 PE targeted port of the linker]
3186 .IP "\fB\-\-minor\-subsystem\-version\fR \fIvalue\fR" 4
3187 .IX Item "--minor-subsystem-version value"
3188 Sets the minor number of the "subsystem version". Defaults to 0.
3189 [This option is specific to the i386 PE targeted port of the linker]
3190 .IP "\fB\-\-output\-def\fR \fIfile\fR" 4
3191 .IX Item "--output-def file"
3192 The linker will create the file \fIfile\fR which will contain a DEF
3193 file corresponding to the DLL the linker is generating. This DEF file
3194 (which should be called \f(CW\*(C`*.def\*(C'\fR) may be used to create an import
3195 library with \f(CW\*(C`dlltool\*(C'\fR or may be used as a reference to
3196 automatically or implicitly exported symbols.
3197 [This option is specific to the i386 PE targeted port of the linker]
3198 .IP \fB\-\-enable\-auto\-image\-base\fR 4
3199 .IX Item "--enable-auto-image-base"
3200 .PD 0
3201 .IP \fB\-\-enable\-auto\-image\-base=\fR\fIvalue\fR 4
3202 .IX Item "--enable-auto-image-base=value"
3203 .PD
3204 Automatically choose the image base for DLLs, optionally starting with base
3205 \&\fIvalue\fR, unless one is specified using the \f(CW\*(C`\-\-image\-base\*(C'\fR argument.
3206 By using a hash generated from the dllname to create unique image bases
3207 for each DLL, in-memory collisions and relocations which can delay program
3208 execution are avoided.
3209 [This option is specific to the i386 PE targeted port of the linker]
3210 .IP \fB\-\-disable\-auto\-image\-base\fR 4
3211 .IX Item "--disable-auto-image-base"
3212 Do not automatically generate a unique image base. If there is no
3213 user-specified image base (\f(CW\*(C`\-\-image\-base\*(C'\fR) then use the platform
3214 default.
3215 [This option is specific to the i386 PE targeted port of the linker]
3216 .IP "\fB\-\-dll\-search\-prefix\fR \fIstring\fR" 4
3217 .IX Item "--dll-search-prefix string"
3218 When linking dynamically to a dll without an import library,
3219 search for \f(CW\*(C`<string><basename>.dll\*(C'\fR in preference to
3220 \&\f(CW\*(C`lib<basename>.dll\*(C'\fR. This behaviour allows easy distinction
3221 between DLLs built for the various "subplatforms": native, cygwin,
3222 uwin, pw, etc. For instance, cygwin DLLs typically use
3223 \&\f(CW\*(C`\-\-dll\-search\-prefix=cyg\*(C'\fR.
3224 [This option is specific to the i386 PE targeted port of the linker]
3225 .IP \fB\-\-enable\-auto\-import\fR 4
3226 .IX Item "--enable-auto-import"
3227 Do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to \f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for
3228 DATA imports from DLLs, thus making it possible to bypass the dllimport
3229 mechanism on the user side and to reference unmangled symbol names.
3230 [This option is specific to the i386 PE targeted port of the linker]
3231 .Sp
3232 The following remarks pertain to the original implementation of the
3233 feature and are obsolete nowadays for Cygwin and MinGW targets.
3234 .Sp
3235 Note: Use of the 'auto\-import' extension will cause the text section
3236 of the image file to be made writable. This does not conform to the
3237 PE-COFF format specification published by Microsoft.
3238 .Sp
3239 Note \- use of the 'auto\-import' extension will also cause read only
3240 data which would normally be placed into the .rdata section to be
3241 placed into the .data section instead. This is in order to work
3242 around a problem with consts that is described here:
3243 http://www.cygwin.com/ml/cygwin/2004\-09/msg01101.html
3244 .Sp
3245 Using 'auto\-import' generally will 'just work' \-\- but sometimes you may
3246 see this message:
3247 .Sp
3248 "variable '<var>' can't be auto-imported. Please read the
3249 documentation for ld's \f(CW\*(C`\-\-enable\-auto\-import\*(C'\fR for details."
3250 .Sp
3251 This message occurs when some (sub)expression accesses an address
3252 ultimately given by the sum of two constants (Win32 import tables only
3253 allow one). Instances where this may occur include accesses to member
3254 fields of struct variables imported from a DLL, as well as using a
3255 constant index into an array variable imported from a DLL. Any
3256 multiword variable (arrays, structs, long long, etc) may trigger
3257 this error condition. However, regardless of the exact data type
3258 of the offending exported variable, ld will always detect it, issue
3259 the warning, and exit.
3260 .Sp
3261 There are several ways to address this difficulty, regardless of the
3262 data type of the exported variable:
3263 .Sp
3264 One way is to use \-\-enable\-runtime\-pseudo\-reloc switch. This leaves the task
3265 of adjusting references in your client code for runtime environment, so
3266 this method works only when runtime environment supports this feature.
3267 .Sp
3268 A second solution is to force one of the 'constants' to be a variable \-\-
3269 that is, unknown and un-optimizable at compile time. For arrays,
3270 there are two possibilities: a) make the indexee (the array's address)
3271 a variable, or b) make the 'constant' index a variable. Thus:
3272 .Sp
3273 .Vb 3
3274 \& extern type extern_array[];
3275 \& extern_array[1] \-\->
3276 \& { volatile type *t=extern_array; t[1] }
3277 .Ve
3278 .Sp
3279 or
3280 .Sp
3281 .Vb 3
3282 \& extern type extern_array[];
3283 \& extern_array[1] \-\->
3284 \& { volatile int t=1; extern_array[t] }
3285 .Ve
3286 .Sp
3287 For structs (and most other multiword data types) the only option
3288 is to make the struct itself (or the long long, or the ...) variable:
3289 .Sp
3290 .Vb 3
3291 \& extern struct s extern_struct;
3292 \& extern_struct.field \-\->
3293 \& { volatile struct s *t=&extern_struct; t\->field }
3294 .Ve
3295 .Sp
3296 or
3297 .Sp
3298 .Vb 3
3299 \& extern long long extern_ll;
3300 \& extern_ll \-\->
3301 \& { volatile long long * local_ll=&extern_ll; *local_ll }
3302 .Ve
3303 .Sp
3304 A third method of dealing with this difficulty is to abandon
3305 \&'auto\-import' for the offending symbol and mark it with
3306 \&\f(CW\*(C`_\|_declspec(dllimport)\*(C'\fR. However, in practice that
3307 requires using compile-time #defines to indicate whether you are
3308 building a DLL, building client code that will link to the DLL, or
3309 merely building/linking to a static library. In making the choice
3310 between the various methods of resolving the 'direct address with
3311 constant offset' problem, you should consider typical real-world usage:
3312 .Sp
3313 Original:
3314 .Sp
3315 .Vb 7
3316 \& \-\-foo.h
3317 \& extern int arr[];
3318 \& \-\-foo.c
3319 \& #include "foo.h"
3320 \& void main(int argc, char **argv){
3321 \& printf("%d\en",arr[1]);
3322 \& }
3323 .Ve
3324 .Sp
3325 Solution 1:
3326 .Sp
3327 .Vb 9
3328 \& \-\-foo.h
3329 \& extern int arr[];
3330 \& \-\-foo.c
3331 \& #include "foo.h"
3332 \& void main(int argc, char **argv){
3333 \& /* This workaround is for win32 and cygwin; do not "optimize" */
3334 \& volatile int *parr = arr;
3335 \& printf("%d\en",parr[1]);
3336 \& }
3337 .Ve
3338 .Sp
3339 Solution 2:
3340 .Sp
3341 .Vb 10
3342 \& \-\-foo.h
3343 \& /* Note: auto\-export is assumed (no _\|_declspec(dllexport)) */
3344 \& #if (defined(_WIN32) || defined(_\|_CYGWIN_\|_)) && \e
3345 \& !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
3346 \& #define FOO_IMPORT _\|_declspec(dllimport)
3347 \& #else
3348 \& #define FOO_IMPORT
3349 \& #endif
3350 \& extern FOO_IMPORT int arr[];
3351 \& \-\-foo.c
3352 \& #include "foo.h"
3353 \& void main(int argc, char **argv){
3354 \& printf("%d\en",arr[1]);
3355 \& }
3356 .Ve
3357 .Sp
3358 A fourth way to avoid this problem is to re-code your
3359 library to use a functional interface rather than a data interface
3360 for the offending variables (e.g. \fBset_foo()\fR and \fBget_foo()\fR accessor
3361 functions).
3362 .IP \fB\-\-disable\-auto\-import\fR 4
3363 .IX Item "--disable-auto-import"
3364 Do not attempt to do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to
3365 \&\f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for DATA imports from DLLs.
3366 [This option is specific to the i386 PE targeted port of the linker]
3367 .IP \fB\-\-enable\-runtime\-pseudo\-reloc\fR 4
3368 .IX Item "--enable-runtime-pseudo-reloc"
3369 If your code contains expressions described in \-\-enable\-auto\-import section,
3370 that is, DATA imports from DLL with non-zero offset, this switch will create
3371 a vector of 'runtime pseudo relocations' which can be used by runtime
3372 environment to adjust references to such data in your client code.
3373 [This option is specific to the i386 PE targeted port of the linker]
3374 .IP \fB\-\-disable\-runtime\-pseudo\-reloc\fR 4
3375 .IX Item "--disable-runtime-pseudo-reloc"
3376 Do not create pseudo relocations for non-zero offset DATA imports from DLLs.
3377 [This option is specific to the i386 PE targeted port of the linker]
3378 .IP \fB\-\-enable\-extra\-pe\-debug\fR 4
3379 .IX Item "--enable-extra-pe-debug"
3380 Show additional debug info related to auto-import symbol thunking.
3381 [This option is specific to the i386 PE targeted port of the linker]
3382 .IP \fB\-\-section\-alignment\fR 4
3383 .IX Item "--section-alignment"
3384 Sets the section alignment. Sections in memory will always begin at
3385 addresses which are a multiple of this number. Defaults to 0x1000.
3386 [This option is specific to the i386 PE targeted port of the linker]
3387 .IP "\fB\-\-stack\fR \fIreserve\fR" 4
3388 .IX Item "--stack reserve"
3389 .PD 0
3390 .IP "\fB\-\-stack\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
3391 .IX Item "--stack reserve,commit"
3392 .PD
3393 Specify the number of bytes of memory to reserve (and optionally commit)
3394 to be used as stack for this program. The default is 2MB reserved, 4K
3395 committed.
3396 [This option is specific to the i386 PE targeted port of the linker]
3397 .IP "\fB\-\-subsystem\fR \fIwhich\fR" 4
3398 .IX Item "--subsystem which"
3399 .PD 0
3400 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR" 4
3401 .IX Item "--subsystem which:major"
3402 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR\fB.\fR\fIminor\fR" 4
3403 .IX Item "--subsystem which:major.minor"
3404 .PD
3405 Specifies the subsystem under which your program will execute. The
3406 legal values for \fIwhich\fR are \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`windows\*(C'\fR,
3407 \&\f(CW\*(C`console\*(C'\fR, \f(CW\*(C`posix\*(C'\fR, and \f(CW\*(C`xbox\*(C'\fR. You may optionally set
3408 the subsystem version also. Numeric values are also accepted for
3409 \&\fIwhich\fR.
3410 [This option is specific to the i386 PE targeted port of the linker]
3411 .Sp
3412 The following options set flags in the \f(CW\*(C`DllCharacteristics\*(C'\fR field
3413 of the PE file header:
3414 [These options are specific to PE targeted ports of the linker]
3415 .IP \fB\-\-high\-entropy\-va\fR 4
3416 .IX Item "--high-entropy-va"
3417 .PD 0
3418 .IP \fB\-\-disable\-high\-entropy\-va\fR 4
3419 .IX Item "--disable-high-entropy-va"
3420 .PD
3421 Image is compatible with 64\-bit address space layout randomization
3422 (ASLR). This option is enabled by default for 64\-bit PE images.
3423 .Sp
3424 This option also implies \fB\-\-dynamicbase\fR and
3425 \&\fB\-\-enable\-reloc\-section\fR.
3426 .IP \fB\-\-dynamicbase\fR 4
3427 .IX Item "--dynamicbase"
3428 .PD 0
3429 .IP \fB\-\-disable\-dynamicbase\fR 4
3430 .IX Item "--disable-dynamicbase"
3431 .PD
3432 The image base address may be relocated using address space layout
3433 randomization (ASLR). This feature was introduced with MS Windows
3434 Vista for i386 PE targets. This option is enabled by default but
3435 can be disabled via the \fB\-\-disable\-dynamicbase\fR option.
3436 This option also implies \fB\-\-enable\-reloc\-section\fR.
3437 .IP \fB\-\-forceinteg\fR 4
3438 .IX Item "--forceinteg"
3439 .PD 0
3440 .IP \fB\-\-disable\-forceinteg\fR 4
3441 .IX Item "--disable-forceinteg"
3442 .PD
3443 Code integrity checks are enforced. This option is disabled by
3444 default.
3445 .IP \fB\-\-nxcompat\fR 4
3446 .IX Item "--nxcompat"
3447 .PD 0
3448 .IP \fB\-\-disable\-nxcompat\fR 4
3449 .IX Item "--disable-nxcompat"
3450 .PD
3451 The image is compatible with the Data Execution Prevention.
3452 This feature was introduced with MS Windows XP SP2 for i386 PE
3453 targets. The option is enabled by default.
3454 .IP \fB\-\-no\-isolation\fR 4
3455 .IX Item "--no-isolation"
3456 .PD 0
3457 .IP \fB\-\-disable\-no\-isolation\fR 4
3458 .IX Item "--disable-no-isolation"
3459 .PD
3460 Although the image understands isolation, do not isolate the image.
3461 This option is disabled by default.
3462 .IP \fB\-\-no\-seh\fR 4
3463 .IX Item "--no-seh"
3464 .PD 0
3465 .IP \fB\-\-disable\-no\-seh\fR 4
3466 .IX Item "--disable-no-seh"
3467 .PD
3468 The image does not use SEH. No SE handler may be called from
3469 this image. This option is disabled by default.
3470 .IP \fB\-\-no\-bind\fR 4
3471 .IX Item "--no-bind"
3472 .PD 0
3473 .IP \fB\-\-disable\-no\-bind\fR 4
3474 .IX Item "--disable-no-bind"
3475 .PD
3476 Do not bind this image. This option is disabled by default.
3477 .IP \fB\-\-wdmdriver\fR 4
3478 .IX Item "--wdmdriver"
3479 .PD 0
3480 .IP \fB\-\-disable\-wdmdriver\fR 4
3481 .IX Item "--disable-wdmdriver"
3482 .PD
3483 The driver uses the MS Windows Driver Model. This option is disabled
3484 by default.
3485 .IP \fB\-\-tsaware\fR 4
3486 .IX Item "--tsaware"
3487 .PD 0
3488 .IP \fB\-\-disable\-tsaware\fR 4
3489 .IX Item "--disable-tsaware"
3490 .PD
3491 The image is Terminal Server aware. This option is disabled by
3492 default.
3493 .IP \fB\-\-insert\-timestamp\fR 4
3494 .IX Item "--insert-timestamp"
3495 .PD 0
3496 .IP \fB\-\-no\-insert\-timestamp\fR 4
3497 .IX Item "--no-insert-timestamp"
3498 .PD
3499 Insert a real timestamp into the image. This is the default behaviour
3500 as it matches legacy code and it means that the image will work with
3501 other, proprietary tools. The problem with this default is that it
3502 will result in slightly different images being produced each time the
3503 same sources are linked. The option \fB\-\-no\-insert\-timestamp\fR
3504 can be used to insert a zero value for the timestamp, this ensuring
3505 that binaries produced from identical sources will compare
3506 identically.
3507 .Sp
3508 If \fB\-\-insert\-timestamp\fR is active then the time inserted is
3509 either the time that the linking takes place or, if the
3510 \&\f(CW\*(C`SOURCE_DATE_EPOCH\*(C'\fR environment variable is defined, the number
3511 of seconds since Unix epoch as specified by that variable.
3512 .IP \fB\-\-enable\-reloc\-section\fR 4
3513 .IX Item "--enable-reloc-section"
3514 .PD 0
3515 .IP \fB\-\-disable\-reloc\-section\fR 4
3516 .IX Item "--disable-reloc-section"
3517 .PD
3518 Create the base relocation table, which is necessary if the image
3519 is loaded at a different image base than specified in the PE header.
3520 This option is enabled by default.
3521 .PP
3522 The C6X uClinux target uses a binary format called DSBT to support shared
3523 libraries. Each shared library in the system needs to have a unique index;
3524 all executables use an index of 0.
3525 .IP "\fB\-\-dsbt\-size\fR \fIsize\fR" 4
3526 .IX Item "--dsbt-size size"
3527 This option sets the number of entries in the DSBT of the current executable
3528 or shared library to \fIsize\fR. The default is to create a table with 64
3529 entries.
3530 .IP "\fB\-\-dsbt\-index\fR \fIindex\fR" 4
3531 .IX Item "--dsbt-index index"
3532 This option sets the DSBT index of the current executable or shared library
3533 to \fIindex\fR. The default is 0, which is appropriate for generating
3534 executables. If a shared library is generated with a DSBT index of 0, the
3535 \&\f(CW\*(C`R_C6000_DSBT_INDEX\*(C'\fR relocs are copied into the output file.
3536 .Sp
3537 The \fB\-\-no\-merge\-exidx\-entries\fR switch disables the merging of adjacent
3538 exidx entries in frame unwind info.
3539 .IP \fB\-\-branch\-stub\fR 4
3540 .IX Item "--branch-stub"
3541 This option enables linker branch relaxation by inserting branch stub
3542 sections when needed to extend the range of branches. This option is
3543 usually not required since C\-SKY supports branch and call instructions that
3544 can access the full memory range and branch relaxation is normally handled by
3545 the compiler or assembler.
3546 .IP \fB\-\-stub\-group\-size=\fR\fIN\fR 4
3547 .IX Item "--stub-group-size=N"
3548 This option allows finer control of linker branch stub creation.
3549 It sets the maximum size of a group of input sections that can
3550 be handled by one stub section. A negative value of \fIN\fR locates
3551 stub sections after their branches, while a positive value allows stub
3552 sections to appear either before or after the branches. Values of
3553 \&\fB1\fR or \fB\-1\fR indicate that the
3554 linker should choose suitable defaults.
3555 .PP
3556 The 68HC11 and 68HC12 linkers support specific options to control the
3557 memory bank switching mapping and trampoline code generation.
3558 .IP \fB\-\-no\-trampoline\fR 4
3559 .IX Item "--no-trampoline"
3560 This option disables the generation of trampoline. By default a trampoline
3561 is generated for each far function which is called using a \f(CW\*(C`jsr\*(C'\fR
3562 instruction (this happens when a pointer to a far function is taken).
3563 .IP "\fB\-\-bank\-window\fR \fIname\fR" 4
3564 .IX Item "--bank-window name"
3565 This option indicates to the linker the name of the memory region in
3566 the \fBMEMORY\fR specification that describes the memory bank window.
3567 The definition of such region is then used by the linker to compute
3568 paging and addresses within the memory window.
3569 .PP
3570 The following options are supported to control handling of GOT generation
3571 when linking for 68K targets.
3572 .IP \fB\-\-got=\fR\fItype\fR 4
3573 .IX Item "--got=type"
3574 This option tells the linker which GOT generation scheme to use.
3575 \&\fItype\fR should be one of \fBsingle\fR, \fBnegative\fR,
3576 \&\fBmultigot\fR or \fBtarget\fR. For more information refer to the
3577 Info entry for \fIld\fR.
3578 .PP
3579 The following options are supported to control microMIPS instruction
3580 generation and branch relocation checks for ISA mode transitions when
3581 linking for MIPS targets.
3582 .IP \fB\-\-insn32\fR 4
3583 .IX Item "--insn32"
3584 .PD 0
3585 .IP \fB\-\-no\-insn32\fR 4
3586 .IX Item "--no-insn32"
3587 .PD
3588 These options control the choice of microMIPS instructions used in code
3589 generated by the linker, such as that in the PLT or lazy binding stubs,
3590 or in relaxation. If \fB\-\-insn32\fR is used, then the linker only uses
3591 32\-bit instruction encodings. By default or if \fB\-\-no\-insn32\fR is
3592 used, all instruction encodings are used, including 16\-bit ones where
3593 possible.
3594 .IP \fB\-\-ignore\-branch\-isa\fR 4
3595 .IX Item "--ignore-branch-isa"
3596 .PD 0
3597 .IP \fB\-\-no\-ignore\-branch\-isa\fR 4
3598 .IX Item "--no-ignore-branch-isa"
3599 .PD
3600 These options control branch relocation checks for invalid ISA mode
3601 transitions. If \fB\-\-ignore\-branch\-isa\fR is used, then the linker
3602 accepts any branch relocations and any ISA mode transition required
3603 is lost in relocation calculation, except for some cases of \f(CW\*(C`BAL\*(C'\fR
3604 instructions which meet relaxation conditions and are converted to
3605 equivalent \f(CW\*(C`JALX\*(C'\fR instructions as the associated relocation is
3606 calculated. By default or if \fB\-\-no\-ignore\-branch\-isa\fR is used
3607 a check is made causing the loss of an ISA mode transition to produce
3608 an error.
3609 .IP \fB\-\-compact\-branches\fR 4
3610 .IX Item "--compact-branches"
3611 .PD 0
3612 .IP \fB\-\-no\-compact\-branches\fR 4
3613 .IX Item "--no-compact-branches"
3614 .PD
3615 These options control the generation of compact instructions by the linker
3616 in the PLT entries for MIPS R6.
3617 .PP
3618 For the pdp11\-aout target, three variants of the output format can be
3619 produced as selected by the following options. The default variant
3620 for pdp11\-aout is the \fB\-\-omagic\fR option, whereas for other
3621 targets \fB\-\-nmagic\fR is the default. The \fB\-\-imagic\fR option is
3622 defined only for the pdp11\-aout target, while the others are described
3623 here as they apply to the pdp11\-aout target.
3624 .IP \fB\-N\fR 4
3625 .IX Item "-N"
3626 .PD 0
3627 .IP \fB\-\-omagic\fR 4
3628 .IX Item "--omagic"
3629 .PD
3630 Mark the output as \f(CW\*(C`OMAGIC\*(C'\fR (0407) in the \fIa.out\fR header to
3631 indicate that the text segment is not to be write-protected and
3632 shared. Since the text and data sections are both readable and
3633 writable, the data section is allocated immediately contiguous after
3634 the text segment. This is the oldest format for PDP11 executable
3635 programs and is the default for \fBld\fR on PDP11 Unix systems
3636 from the beginning through 2.11BSD.
3637 .IP \fB\-n\fR 4
3638 .IX Item "-n"
3639 .PD 0
3640 .IP \fB\-\-nmagic\fR 4
3641 .IX Item "--nmagic"
3642 .PD
3643 Mark the output as \f(CW\*(C`NMAGIC\*(C'\fR (0410) in the \fIa.out\fR header to
3644 indicate that when the output file is executed, the text portion will
3645 be read-only and shareable among all processes executing the same
3646 file. This involves moving the data areas up to the first possible 8K
3647 byte page boundary following the end of the text. This option creates
3648 a \fIpure executable\fR format.
3649 .IP \fB\-z\fR 4
3650 .IX Item "-z"
3651 .PD 0
3652 .IP \fB\-\-imagic\fR 4
3653 .IX Item "--imagic"
3654 .PD
3655 Mark the output as \f(CW\*(C`IMAGIC\*(C'\fR (0411) in the \fIa.out\fR header to
3656 indicate that when the output file is executed, the program text and
3657 data areas will be loaded into separate address spaces using the split
3658 instruction and data space feature of the memory management unit in
3659 larger models of the PDP11. This doubles the address space available
3660 to the program. The text segment is again pure, write-protected, and
3661 shareable. The only difference in the output format between this
3662 option and the others, besides the magic number, is that both the text
3663 and data sections start at location 0. The \fB\-z\fR option selected
3664 this format in 2.11BSD. This option creates a \fIseparate
3665 executable\fR format.
3666 .IP \fB\-\-no\-omagic\fR 4
3667 .IX Item "--no-omagic"
3668 Equivalent to \fB\-\-nmagic\fR for pdp11\-aout.
3669 .SH ENVIRONMENT
3670 .IX Header "ENVIRONMENT"
3671 You can change the behaviour of \fBld\fR with the environment variables
3672 \&\f(CW\*(C`GNUTARGET\*(C'\fR,
3673 \&\f(CW\*(C`LDEMULATION\*(C'\fR and \f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR.
3674 .PP
3675 \&\f(CW\*(C`GNUTARGET\*(C'\fR determines the input-file object format if you don't
3676 use \fB\-b\fR (or its synonym \fB\-\-format\fR). Its value should be one
3677 of the BFD names for an input format. If there is no
3678 \&\f(CW\*(C`GNUTARGET\*(C'\fR in the environment, \fBld\fR uses the natural format
3679 of the target. If \f(CW\*(C`GNUTARGET\*(C'\fR is set to \f(CW\*(C`default\*(C'\fR then BFD
3680 attempts to discover the input format by examining binary input files;
3681 this method often succeeds, but there are potential ambiguities, since
3682 there is no method of ensuring that the magic number used to specify
3683 object-file formats is unique. However, the configuration procedure for
3684 BFD on each system places the conventional format for that system first
3685 in the search-list, so ambiguities are resolved in favor of convention.
3686 .PP
3687 \&\f(CW\*(C`LDEMULATION\*(C'\fR determines the default emulation if you don't use the
3688 \&\fB\-m\fR option. The emulation can affect various aspects of linker
3689 behaviour, particularly the default linker script. You can list the
3690 available emulations with the \fB\-\-verbose\fR or \fB\-V\fR options. If
3691 the \fB\-m\fR option is not used, and the \f(CW\*(C`LDEMULATION\*(C'\fR environment
3692 variable is not defined, the default emulation depends upon how the
3693 linker was configured.
3694 .PP
3695 Normally, the linker will default to demangling symbols. However, if
3696 \&\f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR is set in the environment, then it will
3697 default to not demangling symbols. This environment variable is used in
3698 a similar fashion by the \f(CW\*(C`gcc\*(C'\fR linker wrapper program. The default
3699 may be overridden by the \fB\-\-demangle\fR and \fB\-\-no\-demangle\fR
3700 options.
3701 .PP
3702 If the PE/COFF specific \fB\-\-insert\-timestamp\fR is active and the
3703 \&\fBSOURCE_DATE_EPOCH\fR environment variable is defined, then the
3704 timestamp value in this variable will be inserted into the COFF header
3705 instead of the current time.
3706 .SH "SEE ALSO"
3707 .IX Header "SEE ALSO"
3708 \&\fBar\fR\|(1), \fBnm\fR\|(1), \fBobjcopy\fR\|(1), \fBobjdump\fR\|(1), \fBreadelf\fR\|(1) and
3709 the Info entries for \fIbinutils\fR and
3710 \&\fIld\fR.
3711 .SH COPYRIGHT
3712 .IX Header "COPYRIGHT"
3713 Copyright (c) 1991\-2025 Free Software Foundation, Inc.
3714 .PP
3715 Permission is granted to copy, distribute and/or modify this document
3716 under the terms of the GNU Free Documentation License, Version 1.3
3717 or any later version published by the Free Software Foundation;
3718 with no Invariant Sections, with no Front-Cover Texts, and with no
3719 Back-Cover Texts. A copy of the license is included in the
3720 section entitled "GNU Free Documentation License".