Merge branch 'vendor/OPENSSL'
[dragonfly.git] / contrib / binutils-2.21 / ld / ld.1
1 .\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
29 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
30 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
31 .\" nothing in troff, for use with C<>.
32 .tr \(*W-
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" Escape single quotes in literal strings from groff's Unicode transform.
52 .ie \n(.g .ds Aq \(aq
53 .el       .ds Aq '
54 .\"
55 .\" If the F register is turned on, we'll generate index entries on stderr for
56 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
57 .\" entries marked with X<> in POD.  Of course, you'll have to process the
58 .\" output yourself in some meaningful fashion.
59 .ie \nF \{\
60 .    de IX
61 .    tm Index:\\$1\t\\n%\t"\\$2"
62 ..
63 .    nr % 0
64 .    rr F
65 .\}
66 .el \{\
67 .    de IX
68 ..
69 .\}
70 .\"
71 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
72 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
73 .    \" fudge factors for nroff and troff
74 .if n \{\
75 .    ds #H 0
76 .    ds #V .8m
77 .    ds #F .3m
78 .    ds #[ \f1
79 .    ds #] \fP
80 .\}
81 .if t \{\
82 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
83 .    ds #V .6m
84 .    ds #F 0
85 .    ds #[ \&
86 .    ds #] \&
87 .\}
88 .    \" simple accents for nroff and troff
89 .if n \{\
90 .    ds ' \&
91 .    ds ` \&
92 .    ds ^ \&
93 .    ds , \&
94 .    ds ~ ~
95 .    ds /
96 .\}
97 .if t \{\
98 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
99 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
100 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
101 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
102 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
103 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
104 .\}
105 .    \" troff and (daisy-wheel) nroff accents
106 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
107 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
108 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
109 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
110 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
111 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
112 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
113 .ds ae a\h'-(\w'a'u*4/10)'e
114 .ds Ae A\h'-(\w'A'u*4/10)'E
115 .    \" corrections for vroff
116 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
117 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
118 .    \" for low resolution devices (crt and lpr)
119 .if \n(.H>23 .if \n(.V>19 \
120 \{\
121 .    ds : e
122 .    ds 8 ss
123 .    ds o a
124 .    ds d- d\h'-1'\(ga
125 .    ds D- D\h'-1'\(hy
126 .    ds th \o'bp'
127 .    ds Th \o'LP'
128 .    ds ae ae
129 .    ds Ae AE
130 .\}
131 .rm #[ #] #H #V #F C
132 .\" ========================================================================
133 .\"
134 .IX Title "LD 1"
135 .TH LD 1 "2011-06-27" "binutils-2.21.1" "GNU Development Tools"
136 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
137 .\" way too many mistakes in technical documents.
138 .if n .ad l
139 .nh
140 .SH "NAME"
141 ld \- The GNU linker
142 .SH "SYNOPSIS"
143 .IX Header "SYNOPSIS"
144 ld [\fBoptions\fR] \fIobjfile\fR ...
145 .SH "DESCRIPTION"
146 .IX Header "DESCRIPTION"
147 \&\fBld\fR combines a number of object and archive files, relocates
148 their data and ties up symbol references. Usually the last step in
149 compiling a program is to run \fBld\fR.
150 .PP
151 \&\fBld\fR accepts Linker Command Language files written in
152 a superset of \s-1AT&T\s0's Link Editor Command Language syntax,
153 to provide explicit and total control over the linking process.
154 .PP
155 This man page does not describe the command language; see the
156 \&\fBld\fR entry in \f(CW\*(C`info\*(C'\fR for full details on the command
157 language and on other aspects of the \s-1GNU\s0 linker.
158 .PP
159 This version of \fBld\fR uses the general purpose \s-1BFD\s0 libraries
160 to operate on object files. This allows \fBld\fR to read, combine, and
161 write object files in many different formats\-\-\-for example, \s-1COFF\s0 or
162 \&\f(CW\*(C`a.out\*(C'\fR.  Different formats may be linked together to produce any
163 available kind of object file.
164 .PP
165 Aside from its flexibility, the \s-1GNU\s0 linker is more helpful than other
166 linkers in providing diagnostic information.  Many linkers abandon
167 execution immediately upon encountering an error; whenever possible,
168 \&\fBld\fR continues executing, allowing you to identify other errors
169 (or, in some cases, to get an output file in spite of the error).
170 .PP
171 The \s-1GNU\s0 linker \fBld\fR is meant to cover a broad range of situations,
172 and to be as compatible as possible with other linkers.  As a result,
173 you have many choices to control its behavior.
174 .SH "OPTIONS"
175 .IX Header "OPTIONS"
176 The linker supports a plethora of command-line options, but in actual
177 practice few of them are used in any particular context.
178 For instance, a frequent use of \fBld\fR is to link standard Unix
179 object files on a standard, supported Unix system.  On such a system, to
180 link a file \f(CW\*(C`hello.o\*(C'\fR:
181 .PP
182 .Vb 1
183 \&        ld \-o <output> /lib/crt0.o hello.o \-lc
184 .Ve
185 .PP
186 This tells \fBld\fR to produce a file called \fIoutput\fR as the
187 result of linking the file \f(CW\*(C`/lib/crt0.o\*(C'\fR with \f(CW\*(C`hello.o\*(C'\fR and
188 the library \f(CW\*(C`libc.a\*(C'\fR, which will come from the standard search
189 directories.  (See the discussion of the \fB\-l\fR option below.)
190 .PP
191 Some of the command-line options to \fBld\fR may be specified at any
192 point in the command line.  However, options which refer to files, such
193 as \fB\-l\fR or \fB\-T\fR, cause the file to be read at the point at
194 which the option appears in the command line, relative to the object
195 files and other file options.  Repeating non-file options with a
196 different argument will either have no further effect, or override prior
197 occurrences (those further to the left on the command line) of that
198 option.  Options which may be meaningfully specified more than once are
199 noted in the descriptions below.
200 .PP
201 Non-option arguments are object files or archives which are to be linked
202 together.  They may follow, precede, or be mixed in with command-line
203 options, except that an object file argument may not be placed between
204 an option and its argument.
205 .PP
206 Usually the linker is invoked with at least one object file, but you can
207 specify other forms of binary input files using \fB\-l\fR, \fB\-R\fR,
208 and the script command language.  If \fIno\fR binary input files at all
209 are specified, the linker does not produce any output, and issues the
210 message \fBNo input files\fR.
211 .PP
212 If the linker cannot recognize the format of an object file, it will
213 assume that it is a linker script.  A script specified in this way
214 augments the main linker script used for the link (either the default
215 linker script or the one specified by using \fB\-T\fR).  This feature
216 permits the linker to link against a file which appears to be an object
217 or an archive, but actually merely defines some symbol values, or uses
218 \&\f(CW\*(C`INPUT\*(C'\fR or \f(CW\*(C`GROUP\*(C'\fR to load other objects.  Specifying a
219 script in this way merely augments the main linker script, with the
220 extra commands placed after the main script; use the \fB\-T\fR option
221 to replace the default linker script entirely, but note the effect of
222 the \f(CW\*(C`INSERT\*(C'\fR command.
223 .PP
224 For options whose names are a single letter,
225 option arguments must either follow the option letter without intervening
226 whitespace, or be given as separate arguments immediately following the
227 option that requires them.
228 .PP
229 For options whose names are multiple letters, either one dash or two can
230 precede the option name; for example, \fB\-trace\-symbol\fR and
231 \&\fB\-\-trace\-symbol\fR are equivalent.  Note\-\-\-there is one exception to
232 this rule.  Multiple letter options that start with a lower case 'o' can
233 only be preceded by two dashes.  This is to reduce confusion with the
234 \&\fB\-o\fR option.  So for example \fB\-omagic\fR sets the output file
235 name to \fBmagic\fR whereas \fB\-\-omagic\fR sets the \s-1NMAGIC\s0 flag on the
236 output.
237 .PP
238 Arguments to multiple-letter options must either be separated from the
239 option name by an equals sign, or be given as separate arguments
240 immediately following the option that requires them.  For example,
241 \&\fB\-\-trace\-symbol foo\fR and \fB\-\-trace\-symbol=foo\fR are equivalent.
242 Unique abbreviations of the names of multiple-letter options are
243 accepted.
244 .PP
245 Note\-\-\-if the linker is being invoked indirectly, via a compiler driver
246 (e.g. \fBgcc\fR) then all the linker command line options should be
247 prefixed by \fB\-Wl,\fR (or whatever is appropriate for the particular
248 compiler driver) like this:
249 .PP
250 .Vb 1
251 \&          gcc \-Wl,\-\-start\-group foo.o bar.o \-Wl,\-\-end\-group
252 .Ve
253 .PP
254 This is important, because otherwise the compiler driver program may
255 silently drop the linker options, resulting in a bad link.  Confusion
256 may also arise when passing options that require values through a
257 driver, as the use of a space between option and argument acts as
258 a separator, and causes the driver to pass only the option to the linker
259 and the argument to the compiler.  In this case, it is simplest to use
260 the joined forms of both single\- and multiple-letter options, such as:
261 .PP
262 .Vb 1
263 \&          gcc foo.o bar.o \-Wl,\-eENTRY \-Wl,\-Map=a.map
264 .Ve
265 .PP
266 Here is a table of the generic command line switches accepted by the \s-1GNU\s0
267 linker:
268 .IP "\fB@\fR\fIfile\fR" 4
269 .IX Item "@file"
270 Read command-line options from \fIfile\fR.  The options read are
271 inserted in place of the original @\fIfile\fR option.  If \fIfile\fR
272 does not exist, or cannot be read, then the option will be treated
273 literally, and not removed.
274 .Sp
275 Options in \fIfile\fR are separated by whitespace.  A whitespace
276 character may be included in an option by surrounding the entire
277 option in either single or double quotes.  Any character (including a
278 backslash) may be included by prefixing the character to be included
279 with a backslash.  The \fIfile\fR may itself contain additional
280 @\fIfile\fR options; any such options will be processed recursively.
281 .IP "\fB\-a\fR \fIkeyword\fR" 4
282 .IX Item "-a keyword"
283 This option is supported for \s-1HP/UX\s0 compatibility.  The \fIkeyword\fR
284 argument must be one of the strings \fBarchive\fR, \fBshared\fR, or
285 \&\fBdefault\fR.  \fB\-aarchive\fR is functionally equivalent to
286 \&\fB\-Bstatic\fR, and the other two keywords are functionally equivalent
287 to \fB\-Bdynamic\fR.  This option may be used any number of times.
288 .IP "\fB\-\-audit\fR \fI\s-1AUDITLIB\s0\fR" 4
289 .IX Item "--audit AUDITLIB"
290 Adds \fI\s-1AUDITLIB\s0\fR to the \f(CW\*(C`DT_AUDIT\*(C'\fR entry of the dynamic section.
291 \&\fI\s-1AUDITLIB\s0\fR is not checked for existence, nor will it use the \s-1DT_SONAME\s0
292 specified in the library.  If specified multiple times \f(CW\*(C`DT_AUDIT\*(C'\fR
293 will contain a colon separated list of audit interfaces to use. If the linker
294 finds an object with an audit entry while searching for shared libraries,
295 it will add a corresponding \f(CW\*(C`DT_DEPAUDIT\*(C'\fR entry in the output file.  
296 This option is only meaningful on \s-1ELF\s0 platforms supporting the rtld-audit
297 interface.
298 .IP "\fB\-A\fR \fIarchitecture\fR" 4
299 .IX Item "-A architecture"
300 .PD 0
301 .IP "\fB\-\-architecture=\fR\fIarchitecture\fR" 4
302 .IX Item "--architecture=architecture"
303 .PD
304 In the current release of \fBld\fR, this option is useful only for the
305 Intel 960 family of architectures.  In that \fBld\fR configuration, the
306 \&\fIarchitecture\fR argument identifies the particular architecture in
307 the 960 family, enabling some safeguards and modifying the
308 archive-library search path.
309 .Sp
310 Future releases of \fBld\fR may support similar functionality for
311 other architecture families.
312 .IP "\fB\-b\fR \fIinput-format\fR" 4
313 .IX Item "-b input-format"
314 .PD 0
315 .IP "\fB\-\-format=\fR\fIinput-format\fR" 4
316 .IX Item "--format=input-format"
317 .PD
318 \&\fBld\fR may be configured to support more than one kind of object
319 file.  If your \fBld\fR is configured this way, you can use the
320 \&\fB\-b\fR option to specify the binary format for input object files
321 that follow this option on the command line.  Even when \fBld\fR is
322 configured to support alternative object formats, you don't usually need
323 to specify this, as \fBld\fR should be configured to expect as a
324 default input format the most usual format on each machine.
325 \&\fIinput-format\fR is a text string, the name of a particular format
326 supported by the \s-1BFD\s0 libraries.  (You can list the available binary
327 formats with \fBobjdump \-i\fR.)
328 .Sp
329 You may want to use this option if you are linking files with an unusual
330 binary format.  You can also use \fB\-b\fR to switch formats explicitly (when
331 linking object files of different formats), by including
332 \&\fB\-b\fR \fIinput-format\fR before each group of object files in a
333 particular format.
334 .Sp
335 The default format is taken from the environment variable
336 \&\f(CW\*(C`GNUTARGET\*(C'\fR.
337 .Sp
338 You can also define the input format from a script, using the command
339 \&\f(CW\*(C`TARGET\*(C'\fR;
340 .IP "\fB\-c\fR \fIMRI-commandfile\fR" 4
341 .IX Item "-c MRI-commandfile"
342 .PD 0
343 .IP "\fB\-\-mri\-script=\fR\fIMRI-commandfile\fR" 4
344 .IX Item "--mri-script=MRI-commandfile"
345 .PD
346 For compatibility with linkers produced by \s-1MRI\s0, \fBld\fR accepts script
347 files written in an alternate, restricted command language, described in
348 the \s-1MRI\s0 Compatible Script Files section of \s-1GNU\s0 ld documentation.
349 Introduce \s-1MRI\s0 script files with
350 the option \fB\-c\fR; use the \fB\-T\fR option to run linker
351 scripts written in the general-purpose \fBld\fR scripting language.
352 If \fIMRI-cmdfile\fR does not exist, \fBld\fR looks for it in the directories
353 specified by any \fB\-L\fR options.
354 .IP "\fB\-d\fR" 4
355 .IX Item "-d"
356 .PD 0
357 .IP "\fB\-dc\fR" 4
358 .IX Item "-dc"
359 .IP "\fB\-dp\fR" 4
360 .IX Item "-dp"
361 .PD
362 These three options are equivalent; multiple forms are supported for
363 compatibility with other linkers.  They assign space to common symbols
364 even if a relocatable output file is specified (with \fB\-r\fR).  The
365 script command \f(CW\*(C`FORCE_COMMON_ALLOCATION\*(C'\fR has the same effect.
366 .IP "\fB\-\-depaudit\fR \fI\s-1AUDITLIB\s0\fR" 4
367 .IX Item "--depaudit AUDITLIB"
368 .PD 0
369 .IP "\fB\-P\fR \fI\s-1AUDITLIB\s0\fR" 4
370 .IX Item "-P AUDITLIB"
371 .PD
372 Adds \fI\s-1AUDITLIB\s0\fR to the \f(CW\*(C`DT_DEPAUDIT\*(C'\fR entry of the dynamic section.
373 \&\fI\s-1AUDITLIB\s0\fR is not checked for existence, nor will it use the \s-1DT_SONAME\s0
374 specified in the library.  If specified multiple times \f(CW\*(C`DT_DEPAUDIT\*(C'\fR
375 will contain a colon separated list of audit interfaces to use.  This
376 option is only meaningful on \s-1ELF\s0 platforms supporting the rtld-audit interface.
377 The \-P option is provided for Solaris compatibility.
378 .IP "\fB\-e\fR \fIentry\fR" 4
379 .IX Item "-e entry"
380 .PD 0
381 .IP "\fB\-\-entry=\fR\fIentry\fR" 4
382 .IX Item "--entry=entry"
383 .PD
384 Use \fIentry\fR as the explicit symbol for beginning execution of your
385 program, rather than the default entry point.  If there is no symbol
386 named \fIentry\fR, the linker will try to parse \fIentry\fR as a number,
387 and use that as the entry address (the number will be interpreted in
388 base 10; you may use a leading \fB0x\fR for base 16, or a leading
389 \&\fB0\fR for base 8).
390 .IP "\fB\-\-exclude\-libs\fR \fIlib\fR\fB,\fR\fIlib\fR\fB,...\fR" 4
391 .IX Item "--exclude-libs lib,lib,..."
392 Specifies a list of archive libraries from which symbols should not be automatically
393 exported.  The library names may be delimited by commas or colons.  Specifying
394 \&\f(CW\*(C`\-\-exclude\-libs ALL\*(C'\fR excludes symbols in all archive libraries from
395 automatic export.  This option is available only for the i386 \s-1PE\s0 targeted
396 port of the linker and for \s-1ELF\s0 targeted ports.  For i386 \s-1PE\s0, symbols
397 explicitly listed in a .def file are still exported, regardless of this
398 option.  For \s-1ELF\s0 targeted ports, symbols affected by this option will
399 be treated as hidden.
400 .IP "\fB\-\-exclude\-modules\-for\-implib\fR \fImodule\fR\fB,\fR\fImodule\fR\fB,...\fR" 4
401 .IX Item "--exclude-modules-for-implib module,module,..."
402 Specifies a list of object files or archive members, from which symbols
403 should not be automatically exported, but which should be copied wholesale
404 into the import library being generated during the link.  The module names
405 may be delimited by commas or colons, and must match exactly the filenames
406 used by \fBld\fR to open the files; for archive members, this is simply
407 the member name, but for object files the name listed must include and
408 match precisely any path used to specify the input file on the linker's
409 command-line.  This option is available only for the i386 \s-1PE\s0 targeted port
410 of the linker.  Symbols explicitly listed in a .def file are still exported,
411 regardless of this option.
412 .IP "\fB\-E\fR" 4
413 .IX Item "-E"
414 .PD 0
415 .IP "\fB\-\-export\-dynamic\fR" 4
416 .IX Item "--export-dynamic"
417 .IP "\fB\-\-no\-export\-dynamic\fR" 4
418 .IX Item "--no-export-dynamic"
419 .PD
420 When creating a dynamically linked executable, using the \fB\-E\fR
421 option or the \fB\-\-export\-dynamic\fR option causes the linker to add
422 all symbols to the dynamic symbol table.  The dynamic symbol table is the
423 set of symbols which are visible from dynamic objects at run time.
424 .Sp
425 If you do not use either of these options (or use the
426 \&\fB\-\-no\-export\-dynamic\fR option to restore the default behavior), the
427 dynamic symbol table will normally contain only those symbols which are
428 referenced by some dynamic object mentioned in the link.
429 .Sp
430 If you use \f(CW\*(C`dlopen\*(C'\fR to load a dynamic object which needs to refer
431 back to the symbols defined by the program, rather than some other
432 dynamic object, then you will probably need to use this option when
433 linking the program itself.
434 .Sp
435 You can also use the dynamic list to control what symbols should
436 be added to the dynamic symbol table if the output format supports it.
437 See the description of \fB\-\-dynamic\-list\fR.
438 .Sp
439 Note that this option is specific to \s-1ELF\s0 targeted ports.  \s-1PE\s0 targets
440 support a similar function to export all symbols from a \s-1DLL\s0 or \s-1EXE\s0; see
441 the description of \fB\-\-export\-all\-symbols\fR below.
442 .IP "\fB\-EB\fR" 4
443 .IX Item "-EB"
444 Link big-endian objects.  This affects the default output format.
445 .IP "\fB\-EL\fR" 4
446 .IX Item "-EL"
447 Link little-endian objects.  This affects the default output format.
448 .IP "\fB\-f\fR \fIname\fR" 4
449 .IX Item "-f name"
450 .PD 0
451 .IP "\fB\-\-auxiliary=\fR\fIname\fR" 4
452 .IX Item "--auxiliary=name"
453 .PD
454 When creating an \s-1ELF\s0 shared object, set the internal \s-1DT_AUXILIARY\s0 field
455 to the specified name.  This tells the dynamic linker that the symbol
456 table of the shared object should be used as an auxiliary filter on the
457 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 \s-1DT_AUXILIARY\s0 field.  If
461 the dynamic linker resolves any symbols from the filter object, it will
462 first check whether there is a definition in the shared object
463 \&\fIname\fR.  If there is one, it will be used instead of the definition
464 in the filter object.  The shared object \fIname\fR need not exist.
465 Thus the shared object \fIname\fR may be used to provide an alternative
466 implementation of certain functions, perhaps for debugging or for
467 machine specific performance.
468 .Sp
469 This option may be specified more than once.  The \s-1DT_AUXILIARY\s0 entries
470 will be created in the order in which they appear on the command line.
471 .IP "\fB\-F\fR \fIname\fR" 4
472 .IX Item "-F name"
473 .PD 0
474 .IP "\fB\-\-filter=\fR\fIname\fR" 4
475 .IX Item "--filter=name"
476 .PD
477 When creating an \s-1ELF\s0 shared object, set the internal \s-1DT_FILTER\s0 field to
478 the specified name.  This tells the dynamic linker that the symbol table
479 of the shared object which is being created should be used as a filter
480 on the symbol table of the shared object \fIname\fR.
481 .Sp
482 If you later link a program against this filter object, then, when you
483 run the program, the dynamic linker will see the \s-1DT_FILTER\s0 field.  The
484 dynamic linker will resolve symbols according to the symbol table of the
485 filter object as usual, but it will actually link to the definitions
486 found in the shared object \fIname\fR.  Thus the filter object can be
487 used to select a subset of the symbols provided by the object
488 \&\fIname\fR.
489 .Sp
490 Some older linkers used the \fB\-F\fR option throughout a compilation
491 toolchain for specifying object-file format for both input and output
492 object files.
493 The \s-1GNU\s0 linker uses other mechanisms for this purpose: the
494 \&\fB\-b\fR, \fB\-\-format\fR, \fB\-\-oformat\fR options, the
495 \&\f(CW\*(C`TARGET\*(C'\fR command in linker scripts, and the \f(CW\*(C`GNUTARGET\*(C'\fR
496 environment variable.
497 The \s-1GNU\s0 linker will ignore the \fB\-F\fR option when not
498 creating an \s-1ELF\s0 shared object.
499 .IP "\fB\-fini=\fR\fIname\fR" 4
500 .IX Item "-fini=name"
501 When creating an \s-1ELF\s0 executable or shared object, call \s-1NAME\s0 when the
502 executable or shared object is unloaded, by setting \s-1DT_FINI\s0 to the
503 address of the function.  By default, the linker uses \f(CW\*(C`_fini\*(C'\fR as
504 the function to call.
505 .IP "\fB\-g\fR" 4
506 .IX Item "-g"
507 Ignored.  Provided for compatibility with other tools.
508 .IP "\fB\-G\fR \fIvalue\fR" 4
509 .IX Item "-G value"
510 .PD 0
511 .IP "\fB\-\-gpsize=\fR\fIvalue\fR" 4
512 .IX Item "--gpsize=value"
513 .PD
514 Set the maximum size of objects to be optimized using the \s-1GP\s0 register to
515 \&\fIsize\fR.  This is only meaningful for object file formats such as
516 \&\s-1MIPS\s0 \s-1ECOFF\s0 which supports putting large and small objects into different
517 sections.  This is ignored for other object file formats.
518 .IP "\fB\-h\fR \fIname\fR" 4
519 .IX Item "-h name"
520 .PD 0
521 .IP "\fB\-soname=\fR\fIname\fR" 4
522 .IX Item "-soname=name"
523 .PD
524 When creating an \s-1ELF\s0 shared object, set the internal \s-1DT_SONAME\s0 field to
525 the specified name.  When an executable is linked with a shared object
526 which has a \s-1DT_SONAME\s0 field, then when the executable is run the dynamic
527 linker will attempt to load the shared object specified by the \s-1DT_SONAME\s0
528 field rather than the using the file name given to the linker.
529 .IP "\fB\-i\fR" 4
530 .IX Item "-i"
531 Perform an incremental link (same as option \fB\-r\fR).
532 .IP "\fB\-init=\fR\fIname\fR" 4
533 .IX Item "-init=name"
534 When creating an \s-1ELF\s0 executable or shared object, call \s-1NAME\s0 when the
535 executable or shared object is loaded, by setting \s-1DT_INIT\s0 to the address
536 of the function.  By default, the linker uses \f(CW\*(C`_init\*(C'\fR as the
537 function to call.
538 .IP "\fB\-l\fR \fInamespec\fR" 4
539 .IX Item "-l namespec"
540 .PD 0
541 .IP "\fB\-\-library=\fR\fInamespec\fR" 4
542 .IX Item "--library=namespec"
543 .PD
544 Add the archive or object file specified by \fInamespec\fR to the
545 list of files to link.  This option may be used any number of times.
546 If \fInamespec\fR is of the form \fI:\fIfilename\fI\fR, \fBld\fR
547 will search the library path for a file called \fIfilename\fR, otherwise it
548 will search the library path for a file called \fIlib\fInamespec\fI.a\fR.
549 .Sp
550 On systems which support shared libraries, \fBld\fR may also search for
551 files other than \fIlib\fInamespec\fI.a\fR.  Specifically, on \s-1ELF\s0
552 and SunOS systems, \fBld\fR will search a directory for a library
553 called \fIlib\fInamespec\fI.so\fR before searching for one called
554 \&\fIlib\fInamespec\fI.a\fR.  (By convention, a \f(CW\*(C`.so\*(C'\fR extension
555 indicates a shared library.)  Note that this behavior does not apply
556 to \fI:\fIfilename\fI\fR, which always specifies a file called
557 \&\fIfilename\fR.
558 .Sp
559 The linker will search an archive only once, at the location where it is
560 specified on the command line.  If the archive defines a symbol which
561 was undefined in some object which appeared before the archive on the
562 command line, the linker will include the appropriate file(s) from the
563 archive.  However, an undefined symbol in an object appearing later on
564 the command line will not cause the linker to search the archive again.
565 .Sp
566 See the \fB\-(\fR option for a way to force the linker to search
567 archives multiple times.
568 .Sp
569 You may list the same archive multiple times on the command line.
570 .Sp
571 This type of archive searching is standard for Unix linkers.  However,
572 if you are using \fBld\fR on \s-1AIX\s0, note that it is different from the
573 behaviour of the \s-1AIX\s0 linker.
574 .IP "\fB\-L\fR \fIsearchdir\fR" 4
575 .IX Item "-L searchdir"
576 .PD 0
577 .IP "\fB\-\-library\-path=\fR\fIsearchdir\fR" 4
578 .IX Item "--library-path=searchdir"
579 .PD
580 Add path \fIsearchdir\fR to the list of paths that \fBld\fR will search
581 for archive libraries and \fBld\fR control scripts.  You may use this
582 option any number of times.  The directories are searched in the order
583 in which they are specified on the command line.  Directories specified
584 on the command line are searched before the default directories.  All
585 \&\fB\-L\fR options apply to all \fB\-l\fR options, regardless of the
586 order in which the options appear.  \fB\-L\fR options do not affect
587 how \fBld\fR searches for a linker script unless \fB\-T\fR
588 option is specified.
589 .Sp
590 If \fIsearchdir\fR begins with \f(CW\*(C`=\*(C'\fR, then the \f(CW\*(C`=\*(C'\fR will be replaced
591 by the \fIsysroot prefix\fR, a path specified when the linker is configured.
592 .Sp
593 The default set of paths searched (without being specified with
594 \&\fB\-L\fR) depends on which emulation mode \fBld\fR is using, and in
595 some cases also on how it was configured.
596 .Sp
597 The paths can also be specified in a link script with the
598 \&\f(CW\*(C`SEARCH_DIR\*(C'\fR command.  Directories specified this way are searched
599 at the point in which the linker script appears in the command line.
600 .IP "\fB\-m\fR \fIemulation\fR" 4
601 .IX Item "-m emulation"
602 Emulate the \fIemulation\fR linker.  You can list the available
603 emulations with the \fB\-\-verbose\fR or \fB\-V\fR options.
604 .Sp
605 If the \fB\-m\fR option is not used, the emulation is taken from the
606 \&\f(CW\*(C`LDEMULATION\*(C'\fR environment variable, if that is defined.
607 .Sp
608 Otherwise, the default emulation depends upon how the linker was
609 configured.
610 .IP "\fB\-M\fR" 4
611 .IX Item "-M"
612 .PD 0
613 .IP "\fB\-\-print\-map\fR" 4
614 .IX Item "--print-map"
615 .PD
616 Print a link map to the standard output.  A link map provides
617 information about the link, including the following:
618 .RS 4
619 .IP "\(bu" 4
620 Where object files are mapped into memory.
621 .IP "\(bu" 4
622 How common symbols are allocated.
623 .IP "\(bu" 4
624 All archive members included in the link, with a mention of the symbol
625 which caused the archive member to be brought in.
626 .IP "\(bu" 4
627 The values assigned to symbols.
628 .Sp
629 Note \- symbols whose values are computed by an expression which
630 involves a reference to a previous value of the same symbol may not
631 have correct result displayed in the link map.  This is because the
632 linker discards intermediate results and only retains the final value
633 of an expression.  Under such circumstances the linker will display
634 the final value enclosed by square brackets.  Thus for example a
635 linker script containing:
636 .Sp
637 .Vb 3
638 \&           foo = 1
639 \&           foo = foo * 4
640 \&           foo = foo + 8
641 .Ve
642 .Sp
643 will produce the following output in the link map if the \fB\-M\fR
644 option is used:
645 .Sp
646 .Vb 3
647 \&           0x00000001                foo = 0x1
648 \&           [0x0000000c]                foo = (foo * 0x4)
649 \&           [0x0000000c]                foo = (foo + 0x8)
650 .Ve
651 .Sp
652 See \fBExpressions\fR for more information about expressions in linker
653 scripts.
654 .RE
655 .RS 4
656 .RE
657 .IP "\fB\-n\fR" 4
658 .IX Item "-n"
659 .PD 0
660 .IP "\fB\-\-nmagic\fR" 4
661 .IX Item "--nmagic"
662 .PD
663 Turn off page alignment of sections, and disable linking against shared
664 libraries.  If the output format supports Unix style magic numbers,
665 mark the output as \f(CW\*(C`NMAGIC\*(C'\fR.
666 .IP "\fB\-N\fR" 4
667 .IX Item "-N"
668 .PD 0
669 .IP "\fB\-\-omagic\fR" 4
670 .IX Item "--omagic"
671 .PD
672 Set the text and data sections to be readable and writable.  Also, do
673 not page-align the data segment, and disable linking against shared
674 libraries.  If the output format supports Unix style magic numbers,
675 mark the output as \f(CW\*(C`OMAGIC\*(C'\fR. Note: Although a writable text section
676 is allowed for PE-COFF targets, it does not conform to the format
677 specification published by Microsoft.
678 .IP "\fB\-\-no\-omagic\fR" 4
679 .IX Item "--no-omagic"
680 This option negates most of the effects of the \fB\-N\fR option.  It
681 sets the text section to be read-only, and forces the data segment to
682 be page-aligned.  Note \- this option does not enable linking against
683 shared libraries.  Use \fB\-Bdynamic\fR for this.
684 .IP "\fB\-o\fR \fIoutput\fR" 4
685 .IX Item "-o output"
686 .PD 0
687 .IP "\fB\-\-output=\fR\fIoutput\fR" 4
688 .IX Item "--output=output"
689 .PD
690 Use \fIoutput\fR as the name for the program produced by \fBld\fR; if this
691 option is not specified, the name \fIa.out\fR is used by default.  The
692 script command \f(CW\*(C`OUTPUT\*(C'\fR can also specify the output file name.
693 .IP "\fB\-O\fR \fIlevel\fR" 4
694 .IX Item "-O level"
695 If \fIlevel\fR is a numeric values greater than zero \fBld\fR optimizes
696 the output.  This might take significantly longer and therefore probably
697 should only be enabled for the final binary.  At the moment this
698 option only affects \s-1ELF\s0 shared library generation.  Future releases of
699 the linker may make more use of this option.  Also currently there is
700 no difference in the linker's behaviour for different non-zero values
701 of this option.  Again this may change with future releases.
702 .IP "\fB\-q\fR" 4
703 .IX Item "-q"
704 .PD 0
705 .IP "\fB\-\-emit\-relocs\fR" 4
706 .IX Item "--emit-relocs"
707 .PD
708 Leave relocation sections and contents in fully linked executables.
709 Post link analysis and optimization tools may need this information in
710 order to perform correct modifications of executables.  This results
711 in larger executables.
712 .Sp
713 This option is currently only supported on \s-1ELF\s0 platforms.
714 .IP "\fB\-\-force\-dynamic\fR" 4
715 .IX Item "--force-dynamic"
716 Force the output file to have dynamic sections.  This option is specific
717 to VxWorks targets.
718 .IP "\fB\-r\fR" 4
719 .IX Item "-r"
720 .PD 0
721 .IP "\fB\-\-relocatable\fR" 4
722 .IX Item "--relocatable"
723 .PD
724 Generate relocatable output\-\-\-i.e., generate an output file that can in
725 turn serve as input to \fBld\fR.  This is often called \fIpartial
726 linking\fR.  As a side effect, in environments that support standard Unix
727 magic numbers, this option also sets the output file's magic number to
728 \&\f(CW\*(C`OMAGIC\*(C'\fR.
729 If this option is not specified, an absolute file is produced.  When
730 linking \*(C+ programs, this option \fIwill not\fR resolve references to
731 constructors; to do that, use \fB\-Ur\fR.
732 .Sp
733 When an input file does not have the same format as the output file,
734 partial linking is only supported if that input file does not contain any
735 relocations.  Different output formats can have further restrictions; for
736 example some \f(CW\*(C`a.out\*(C'\fR\-based formats do not support partial linking
737 with input files in other formats at all.
738 .Sp
739 This option does the same thing as \fB\-i\fR.
740 .IP "\fB\-R\fR \fIfilename\fR" 4
741 .IX Item "-R filename"
742 .PD 0
743 .IP "\fB\-\-just\-symbols=\fR\fIfilename\fR" 4
744 .IX Item "--just-symbols=filename"
745 .PD
746 Read symbol names and their addresses from \fIfilename\fR, but do not
747 relocate it or include it in the output.  This allows your output file
748 to refer symbolically to absolute locations of memory defined in other
749 programs.  You may use this option more than once.
750 .Sp
751 For compatibility with other \s-1ELF\s0 linkers, if the \fB\-R\fR option is
752 followed by a directory name, rather than a file name, it is treated as
753 the \fB\-rpath\fR option.
754 .IP "\fB\-s\fR" 4
755 .IX Item "-s"
756 .PD 0
757 .IP "\fB\-\-strip\-all\fR" 4
758 .IX Item "--strip-all"
759 .PD
760 Omit all symbol information from the output file.
761 .IP "\fB\-S\fR" 4
762 .IX Item "-S"
763 .PD 0
764 .IP "\fB\-\-strip\-debug\fR" 4
765 .IX Item "--strip-debug"
766 .PD
767 Omit debugger symbol information (but not all symbols) from the output file.
768 .IP "\fB\-t\fR" 4
769 .IX Item "-t"
770 .PD 0
771 .IP "\fB\-\-trace\fR" 4
772 .IX Item "--trace"
773 .PD
774 Print the names of the input files as \fBld\fR processes them.
775 .IP "\fB\-T\fR \fIscriptfile\fR" 4
776 .IX Item "-T scriptfile"
777 .PD 0
778 .IP "\fB\-\-script=\fR\fIscriptfile\fR" 4
779 .IX Item "--script=scriptfile"
780 .PD
781 Use \fIscriptfile\fR as the linker script.  This script replaces
782 \&\fBld\fR's default linker script (rather than adding to it), so
783 \&\fIcommandfile\fR must specify everything necessary to describe the
784 output file.    If \fIscriptfile\fR does not exist in
785 the current directory, \f(CW\*(C`ld\*(C'\fR looks for it in the directories
786 specified by any preceding \fB\-L\fR options.  Multiple \fB\-T\fR
787 options accumulate.
788 .IP "\fB\-dT\fR \fIscriptfile\fR" 4
789 .IX Item "-dT scriptfile"
790 .PD 0
791 .IP "\fB\-\-default\-script=\fR\fIscriptfile\fR" 4
792 .IX Item "--default-script=scriptfile"
793 .PD
794 Use \fIscriptfile\fR as the default linker script.
795 .Sp
796 This option is similar to the \fB\-\-script\fR option except that
797 processing of the script is delayed until after the rest of the
798 command line has been processed.  This allows options placed after the
799 \&\fB\-\-default\-script\fR option on the command line to affect the
800 behaviour of the linker script, which can be important when the linker
801 command line cannot be directly controlled by the user.  (eg because
802 the command line is being constructed by another tool, such as
803 \&\fBgcc\fR).
804 .IP "\fB\-u\fR \fIsymbol\fR" 4
805 .IX Item "-u symbol"
806 .PD 0
807 .IP "\fB\-\-undefined=\fR\fIsymbol\fR" 4
808 .IX Item "--undefined=symbol"
809 .PD
810 Force \fIsymbol\fR to be entered in the output file as an undefined
811 symbol.  Doing this may, for example, trigger linking of additional
812 modules from standard libraries.  \fB\-u\fR may be repeated with
813 different option arguments to enter additional undefined symbols.  This
814 option is equivalent to the \f(CW\*(C`EXTERN\*(C'\fR linker script command.
815 .IP "\fB\-Ur\fR" 4
816 .IX Item "-Ur"
817 For anything other than \*(C+ programs, this option is equivalent to
818 \&\fB\-r\fR: it generates relocatable output\-\-\-i.e., an output file that can in
819 turn serve as input to \fBld\fR.  When linking \*(C+ programs, \fB\-Ur\fR
820 \&\fIdoes\fR resolve references to constructors, unlike \fB\-r\fR.
821 It does not work to use \fB\-Ur\fR on files that were themselves linked
822 with \fB\-Ur\fR; once the constructor table has been built, it cannot
823 be added to.  Use \fB\-Ur\fR only for the last partial link, and
824 \&\fB\-r\fR for the others.
825 .IP "\fB\-\-unique[=\fR\fI\s-1SECTION\s0\fR\fB]\fR" 4
826 .IX Item "--unique[=SECTION]"
827 Creates a separate output section for every input section matching
828 \&\fI\s-1SECTION\s0\fR, or if the optional wildcard \fI\s-1SECTION\s0\fR argument is
829 missing, for every orphan input section.  An orphan section is one not
830 specifically mentioned in a linker script.  You may use this option
831 multiple times on the command line;  It prevents the normal merging of
832 input sections with the same name, overriding output section assignments
833 in a linker script.
834 .IP "\fB\-v\fR" 4
835 .IX Item "-v"
836 .PD 0
837 .IP "\fB\-\-version\fR" 4
838 .IX Item "--version"
839 .IP "\fB\-V\fR" 4
840 .IX Item "-V"
841 .PD
842 Display the version number for \fBld\fR.  The \fB\-V\fR option also
843 lists the supported emulations.
844 .IP "\fB\-x\fR" 4
845 .IX Item "-x"
846 .PD 0
847 .IP "\fB\-\-discard\-all\fR" 4
848 .IX Item "--discard-all"
849 .PD
850 Delete all local symbols.
851 .IP "\fB\-X\fR" 4
852 .IX Item "-X"
853 .PD 0
854 .IP "\fB\-\-discard\-locals\fR" 4
855 .IX Item "--discard-locals"
856 .PD
857 Delete all temporary local symbols.  (These symbols start with
858 system-specific local label prefixes, typically \fB.L\fR for \s-1ELF\s0 systems
859 or \fBL\fR for traditional a.out systems.)
860 .IP "\fB\-y\fR \fIsymbol\fR" 4
861 .IX Item "-y symbol"
862 .PD 0
863 .IP "\fB\-\-trace\-symbol=\fR\fIsymbol\fR" 4
864 .IX Item "--trace-symbol=symbol"
865 .PD
866 Print the name of each linked file in which \fIsymbol\fR appears.  This
867 option may be given any number of times.  On many systems it is necessary
868 to prepend an underscore.
869 .Sp
870 This option is useful when you have an undefined symbol in your link but
871 don't know where the reference is coming from.
872 .IP "\fB\-Y\fR \fIpath\fR" 4
873 .IX Item "-Y path"
874 Add \fIpath\fR to the default library search path.  This option exists
875 for Solaris compatibility.
876 .IP "\fB\-z\fR \fIkeyword\fR" 4
877 .IX Item "-z keyword"
878 The recognized keywords are:
879 .RS 4
880 .IP "\fBcombreloc\fR" 4
881 .IX Item "combreloc"
882 Combines multiple reloc sections and sorts them to make dynamic symbol
883 lookup caching possible.
884 .IP "\fBdefs\fR" 4
885 .IX Item "defs"
886 Disallows undefined symbols in object files.  Undefined symbols in
887 shared libraries are still allowed.
888 .IP "\fBexecstack\fR" 4
889 .IX Item "execstack"
890 Marks the object as requiring executable stack.
891 .IP "\fBinitfirst\fR" 4
892 .IX Item "initfirst"
893 This option is only meaningful when building a shared object.
894 It marks the object so that its runtime initialization will occur
895 before the runtime initialization of any other objects brought into
896 the process at the same time.  Similarly the runtime finalization of
897 the object will occur after the runtime finalization of any other
898 objects.
899 .IP "\fBinterpose\fR" 4
900 .IX Item "interpose"
901 Marks the object that its symbol table interposes before all symbols
902 but the primary executable.
903 .IP "\fBlazy\fR" 4
904 .IX Item "lazy"
905 When generating an executable or shared library, mark it to tell the
906 dynamic linker to defer function call resolution to the point when
907 the function is called (lazy binding), rather than at load time.
908 Lazy binding is the default.
909 .IP "\fBloadfltr\fR" 4
910 .IX Item "loadfltr"
911 Marks  the object that its filters be processed immediately at
912 runtime.
913 .IP "\fBmuldefs\fR" 4
914 .IX Item "muldefs"
915 Allows multiple definitions.
916 .IP "\fBnocombreloc\fR" 4
917 .IX Item "nocombreloc"
918 Disables multiple reloc sections combining.
919 .IP "\fBnocopyreloc\fR" 4
920 .IX Item "nocopyreloc"
921 Disables production of copy relocs.
922 .IP "\fBnodefaultlib\fR" 4
923 .IX Item "nodefaultlib"
924 Marks the object that the search for dependencies of this object will
925 ignore any default library search paths.
926 .IP "\fBnodelete\fR" 4
927 .IX Item "nodelete"
928 Marks the object shouldn't be unloaded at runtime.
929 .IP "\fBnodlopen\fR" 4
930 .IX Item "nodlopen"
931 Marks the object not available to \f(CW\*(C`dlopen\*(C'\fR.
932 .IP "\fBnodump\fR" 4
933 .IX Item "nodump"
934 Marks the object can not be dumped by \f(CW\*(C`dldump\*(C'\fR.
935 .IP "\fBnoexecstack\fR" 4
936 .IX Item "noexecstack"
937 Marks the object as not requiring executable stack.
938 .IP "\fBnorelro\fR" 4
939 .IX Item "norelro"
940 Don't create an \s-1ELF\s0 \f(CW\*(C`PT_GNU_RELRO\*(C'\fR segment header in the object.
941 .IP "\fBnow\fR" 4
942 .IX Item "now"
943 When generating an executable or shared library, mark it to tell the
944 dynamic linker to resolve all symbols when the program is started, or
945 when the shared library is linked to using dlopen, instead of
946 deferring function call resolution to the point when the function is
947 first called.
948 .IP "\fBorigin\fR" 4
949 .IX Item "origin"
950 Marks the object may contain \f(CW$ORIGIN\fR.
951 .IP "\fBrelro\fR" 4
952 .IX Item "relro"
953 Create an \s-1ELF\s0 \f(CW\*(C`PT_GNU_RELRO\*(C'\fR segment header in the object.
954 .IP "\fBmax\-page\-size=\fR\fIvalue\fR" 4
955 .IX Item "max-page-size=value"
956 Set the emulation maximum page size to \fIvalue\fR.
957 .IP "\fBcommon\-page\-size=\fR\fIvalue\fR" 4
958 .IX Item "common-page-size=value"
959 Set the emulation common page size to \fIvalue\fR.
960 .RE
961 .RS 4
962 .Sp
963 Other keywords are ignored for Solaris compatibility.
964 .RE
965 .IP "\fB\-(\fR \fIarchives\fR \fB\-)\fR" 4
966 .IX Item "-( archives -)"
967 .PD 0
968 .IP "\fB\-\-start\-group\fR \fIarchives\fR \fB\-\-end\-group\fR" 4
969 .IX Item "--start-group archives --end-group"
970 .PD
971 The \fIarchives\fR should be a list of archive files.  They may be
972 either explicit file names, or \fB\-l\fR options.
973 .Sp
974 The specified archives are searched repeatedly until no new undefined
975 references are created.  Normally, an archive is searched only once in
976 the order that it is specified on the command line.  If a symbol in that
977 archive is needed to resolve an undefined symbol referred to by an
978 object in an archive that appears later on the command line, the linker
979 would not be able to resolve that reference.  By grouping the archives,
980 they all be searched repeatedly until all possible references are
981 resolved.
982 .Sp
983 Using this option has a significant performance cost.  It is best to use
984 it only when there are unavoidable circular references between two or
985 more archives.
986 .IP "\fB\-\-accept\-unknown\-input\-arch\fR" 4
987 .IX Item "--accept-unknown-input-arch"
988 .PD 0
989 .IP "\fB\-\-no\-accept\-unknown\-input\-arch\fR" 4
990 .IX Item "--no-accept-unknown-input-arch"
991 .PD
992 Tells the linker to accept input files whose architecture cannot be
993 recognised.  The assumption is that the user knows what they are doing
994 and deliberately wants to link in these unknown input files.  This was
995 the default behaviour of the linker, before release 2.14.  The default
996 behaviour from release 2.14 onwards is to reject such input files, and
997 so the \fB\-\-accept\-unknown\-input\-arch\fR option has been added to
998 restore the old behaviour.
999 .IP "\fB\-\-as\-needed\fR" 4
1000 .IX Item "--as-needed"
1001 .PD 0
1002 .IP "\fB\-\-no\-as\-needed\fR" 4
1003 .IX Item "--no-as-needed"
1004 .PD
1005 This option affects \s-1ELF\s0 \s-1DT_NEEDED\s0 tags for dynamic libraries mentioned
1006 on the command line after the \fB\-\-as\-needed\fR option.  Normally
1007 the linker will add a \s-1DT_NEEDED\s0 tag for each dynamic library mentioned
1008 on the command line, regardless of whether the library is actually
1009 needed or not.  \fB\-\-as\-needed\fR causes a \s-1DT_NEEDED\s0 tag to only be
1010 emitted for a library that satisfies an undefined symbol reference
1011 from a regular object file or, if the library is not found in the
1012 \&\s-1DT_NEEDED\s0 lists of other libraries linked up to that point, an
1013 undefined symbol reference from another dynamic library.
1014 \&\fB\-\-no\-as\-needed\fR restores the default behaviour.
1015 .IP "\fB\-\-add\-needed\fR" 4
1016 .IX Item "--add-needed"
1017 .PD 0
1018 .IP "\fB\-\-no\-add\-needed\fR" 4
1019 .IX Item "--no-add-needed"
1020 .PD
1021 These two options have been deprecated because of the similarity of
1022 their names to the \fB\-\-as\-needed\fR and \fB\-\-no\-as\-needed\fR
1023 options.  They have been replaced by \fB\-\-copy\-dt\-needed\-entries\fR
1024 and \fB\-\-no\-copy\-dt\-needed\-entries\fR.
1025 .IP "\fB\-assert\fR \fIkeyword\fR" 4
1026 .IX Item "-assert keyword"
1027 This option is ignored for SunOS compatibility.
1028 .IP "\fB\-Bdynamic\fR" 4
1029 .IX Item "-Bdynamic"
1030 .PD 0
1031 .IP "\fB\-dy\fR" 4
1032 .IX Item "-dy"
1033 .IP "\fB\-call_shared\fR" 4
1034 .IX Item "-call_shared"
1035 .PD
1036 Link against dynamic libraries.  This is only meaningful on platforms
1037 for which shared libraries are supported.  This option is normally the
1038 default on such platforms.  The different variants of this option are
1039 for compatibility with various systems.  You may use this option
1040 multiple times on the command line: it affects library searching for
1041 \&\fB\-l\fR options which follow it.
1042 .IP "\fB\-Bgroup\fR" 4
1043 .IX Item "-Bgroup"
1044 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
1045 section.  This causes the runtime linker to handle lookups in this
1046 object and its dependencies to be performed only inside the group.
1047 \&\fB\-\-unresolved\-symbols=report\-all\fR is implied.  This option is
1048 only meaningful on \s-1ELF\s0 platforms which support shared libraries.
1049 .IP "\fB\-Bstatic\fR" 4
1050 .IX Item "-Bstatic"
1051 .PD 0
1052 .IP "\fB\-dn\fR" 4
1053 .IX Item "-dn"
1054 .IP "\fB\-non_shared\fR" 4
1055 .IX Item "-non_shared"
1056 .IP "\fB\-static\fR" 4
1057 .IX Item "-static"
1058 .PD
1059 Do not link against shared libraries.  This is only meaningful on
1060 platforms for which shared libraries are supported.  The different
1061 variants of this option are for compatibility with various systems.  You
1062 may use this option multiple times on the command line: it affects
1063 library searching for \fB\-l\fR options which follow it.  This
1064 option also implies \fB\-\-unresolved\-symbols=report\-all\fR.  This
1065 option can be used with \fB\-shared\fR.  Doing so means that a
1066 shared library is being created but that all of the library's external
1067 references must be resolved by pulling in entries from static
1068 libraries.
1069 .IP "\fB\-Bsymbolic\fR" 4
1070 .IX Item "-Bsymbolic"
1071 When creating a shared library, bind references to global symbols to the
1072 definition within the shared library, if any.  Normally, it is possible
1073 for a program linked against a shared library to override the definition
1074 within the shared library.  This option is only meaningful on \s-1ELF\s0
1075 platforms which support shared libraries.
1076 .IP "\fB\-Bsymbolic\-functions\fR" 4
1077 .IX Item "-Bsymbolic-functions"
1078 When creating a shared library, bind references to global function
1079 symbols to the definition within the shared library, if any.
1080 This option is only meaningful on \s-1ELF\s0 platforms which support shared
1081 libraries.
1082 .IP "\fB\-\-dynamic\-list=\fR\fIdynamic-list-file\fR" 4
1083 .IX Item "--dynamic-list=dynamic-list-file"
1084 Specify the name of a dynamic list file to the linker.  This is
1085 typically used when creating shared libraries to specify a list of
1086 global symbols whose references shouldn't be bound to the definition
1087 within the shared library, or creating dynamically linked executables
1088 to specify a list of symbols which should be added to the symbol table
1089 in the executable.  This option is only meaningful on \s-1ELF\s0 platforms
1090 which support shared libraries.
1091 .Sp
1092 The format of the dynamic list is the same as the version node without
1093 scope and node name.  See \fB\s-1VERSION\s0\fR for more information.
1094 .IP "\fB\-\-dynamic\-list\-data\fR" 4
1095 .IX Item "--dynamic-list-data"
1096 Include all global data symbols to the dynamic list.
1097 .IP "\fB\-\-dynamic\-list\-cpp\-new\fR" 4
1098 .IX Item "--dynamic-list-cpp-new"
1099 Provide the builtin dynamic list for \*(C+ operator new and delete.  It
1100 is mainly useful for building shared libstdc++.
1101 .IP "\fB\-\-dynamic\-list\-cpp\-typeinfo\fR" 4
1102 .IX Item "--dynamic-list-cpp-typeinfo"
1103 Provide the builtin dynamic list for \*(C+ runtime type identification.
1104 .IP "\fB\-\-check\-sections\fR" 4
1105 .IX Item "--check-sections"
1106 .PD 0
1107 .IP "\fB\-\-no\-check\-sections\fR" 4
1108 .IX Item "--no-check-sections"
1109 .PD
1110 Asks the linker \fInot\fR to check section addresses after they have
1111 been assigned to see if there are any overlaps.  Normally the linker will
1112 perform this check, and if it finds any overlaps it will produce
1113 suitable error messages.  The linker does know about, and does make
1114 allowances for sections in overlays.  The default behaviour can be
1115 restored by using the command line switch \fB\-\-check\-sections\fR.
1116 Section overlap is not usually checked for relocatable links.  You can
1117 force checking in that case by using the \fB\-\-check\-sections\fR
1118 option.
1119 .IP "\fB\-\-copy\-dt\-needed\-entries\fR" 4
1120 .IX Item "--copy-dt-needed-entries"
1121 .PD 0
1122 .IP "\fB\-\-no\-copy\-dt\-needed\-entries\fR" 4
1123 .IX Item "--no-copy-dt-needed-entries"
1124 .PD
1125 This option affects the treatment of dynamic libraries referred to 
1126 by \s-1DT_NEEDED\s0 tags \fIinside\fR \s-1ELF\s0 dynamic libraries mentioned on the
1127 command line.  Normally the linker will add a \s-1DT_NEEDED\s0 tag to the
1128 output binary for each library mentioned in a \s-1DT_NEEDED\s0 tag in an
1129 input dynamic library.  With \fB\-\-no\-copy\-dt\-needed\-entries\fR
1130 specified on the command line however any dynamic libraries that
1131 follow it will have their \s-1DT_NEEDED\s0 entries ignored.  The default
1132 behaviour can be restored with \fB\-\-copy\-dt\-needed\-entries\fR.
1133 .Sp
1134 This option also has an effect on the resolution of symbols in dynamic
1135 libraries.  With the default setting dynamic libraries mentioned on
1136 the command line will be recursively searched, following their
1137 \&\s-1DT_NEEDED\s0 tags to other libraries, in order to resolve symbols
1138 required by the output binary.  With
1139 \&\fB\-\-no\-copy\-dt\-needed\-entries\fR specified however the searching
1140 of dynamic libraries that follow it will stop with the dynamic
1141 library itself.  No \s-1DT_NEEDED\s0 links will be traversed to resolve
1142 symbols.
1143 .IP "\fB\-\-cref\fR" 4
1144 .IX Item "--cref"
1145 Output a cross reference table.  If a linker map file is being
1146 generated, the cross reference table is printed to the map file.
1147 Otherwise, it is printed on the standard output.
1148 .Sp
1149 The format of the table is intentionally simple, so that it may be
1150 easily processed by a script if necessary.  The symbols are printed out,
1151 sorted by name.  For each symbol, a list of file names is given.  If the
1152 symbol is defined, the first file listed is the location of the
1153 definition.  The remaining files contain references to the symbol.
1154 .IP "\fB\-\-no\-define\-common\fR" 4
1155 .IX Item "--no-define-common"
1156 This option inhibits the assignment of addresses to common symbols.
1157 The script command \f(CW\*(C`INHIBIT_COMMON_ALLOCATION\*(C'\fR has the same effect.
1158 .Sp
1159 The \fB\-\-no\-define\-common\fR option allows decoupling
1160 the decision to assign addresses to Common symbols from the choice
1161 of the output file type; otherwise a non-Relocatable output type
1162 forces assigning addresses to Common symbols.
1163 Using \fB\-\-no\-define\-common\fR allows Common symbols that are referenced
1164 from a shared library to be assigned addresses only in the main program.
1165 This eliminates the unused duplicate space in the shared library,
1166 and also prevents any possible confusion over resolving to the wrong
1167 duplicate when there are many dynamic modules with specialized search
1168 paths for runtime symbol resolution.
1169 .IP "\fB\-\-defsym=\fR\fIsymbol\fR\fB=\fR\fIexpression\fR" 4
1170 .IX Item "--defsym=symbol=expression"
1171 Create a global symbol in the output file, containing the absolute
1172 address given by \fIexpression\fR.  You may use this option as many
1173 times as necessary to define multiple symbols in the command line.  A
1174 limited form of arithmetic is supported for the \fIexpression\fR in this
1175 context: you may give a hexadecimal constant or the name of an existing
1176 symbol, or use \f(CW\*(C`+\*(C'\fR and \f(CW\*(C`\-\*(C'\fR to add or subtract hexadecimal
1177 constants or symbols.  If you need more elaborate expressions, consider
1178 using the linker command language from a script.  \fINote:\fR there should be no white
1179 space between \fIsymbol\fR, the equals sign ("\fB=\fR"), and
1180 \&\fIexpression\fR.
1181 .IP "\fB\-\-demangle[=\fR\fIstyle\fR\fB]\fR" 4
1182 .IX Item "--demangle[=style]"
1183 .PD 0
1184 .IP "\fB\-\-no\-demangle\fR" 4
1185 .IX Item "--no-demangle"
1186 .PD
1187 These options control whether to demangle symbol names in error messages
1188 and other output.  When the linker is told to demangle, it tries to
1189 present symbol names in a readable fashion: it strips leading
1190 underscores if they are used by the object file format, and converts \*(C+
1191 mangled symbol names into user readable names.  Different compilers have
1192 different mangling styles.  The optional demangling style argument can be used
1193 to choose an appropriate demangling style for your compiler.  The linker will
1194 demangle by default unless the environment variable \fB\s-1COLLECT_NO_DEMANGLE\s0\fR
1195 is set.  These options may be used to override the default.
1196 .IP "\fB\-I\fR\fIfile\fR" 4
1197 .IX Item "-Ifile"
1198 .PD 0
1199 .IP "\fB\-\-dynamic\-linker=\fR\fIfile\fR" 4
1200 .IX Item "--dynamic-linker=file"
1201 .PD
1202 Set the name of the dynamic linker.  This is only meaningful when
1203 generating dynamically linked \s-1ELF\s0 executables.  The default dynamic
1204 linker is normally correct; don't use this unless you know what you are
1205 doing.
1206 .IP "\fB\-\-fatal\-warnings\fR" 4
1207 .IX Item "--fatal-warnings"
1208 .PD 0
1209 .IP "\fB\-\-no\-fatal\-warnings\fR" 4
1210 .IX Item "--no-fatal-warnings"
1211 .PD
1212 Treat all warnings as errors.  The default behaviour can be restored
1213 with the option \fB\-\-no\-fatal\-warnings\fR.
1214 .IP "\fB\-\-force\-exe\-suffix\fR" 4
1215 .IX Item "--force-exe-suffix"
1216 Make sure that an output file has a .exe suffix.
1217 .Sp
1218 If a successfully built fully linked output file does not have a
1219 \&\f(CW\*(C`.exe\*(C'\fR or \f(CW\*(C`.dll\*(C'\fR suffix, this option forces the linker to copy
1220 the output file to one of the same name with a \f(CW\*(C`.exe\*(C'\fR suffix. This
1221 option is useful when using unmodified Unix makefiles on a Microsoft
1222 Windows host, since some versions of Windows won't run an image unless
1223 it ends in a \f(CW\*(C`.exe\*(C'\fR suffix.
1224 .IP "\fB\-\-gc\-sections\fR" 4
1225 .IX Item "--gc-sections"
1226 .PD 0
1227 .IP "\fB\-\-no\-gc\-sections\fR" 4
1228 .IX Item "--no-gc-sections"
1229 .PD
1230 Enable garbage collection of unused input sections.  It is ignored on
1231 targets that do not support this option.  The default behaviour (of not
1232 performing this garbage collection) can be restored by specifying
1233 \&\fB\-\-no\-gc\-sections\fR on the command line.
1234 .Sp
1235 \&\fB\-\-gc\-sections\fR decides which input sections are used by
1236 examining symbols and relocations.  The section containing the entry
1237 symbol and all sections containing symbols undefined on the
1238 command-line will be kept, as will sections containing symbols
1239 referenced by dynamic objects.  Note that when building shared
1240 libraries, the linker must assume that any visible symbol is
1241 referenced.  Once this initial set of sections has been determined,
1242 the linker recursively marks as used any section referenced by their
1243 relocations.  See \fB\-\-entry\fR and \fB\-\-undefined\fR.
1244 .Sp
1245 This option can be set when doing a partial link (enabled with option
1246 \&\fB\-r\fR).  In this case the root of symbols kept must be explicitly 
1247 specified either by an \fB\-\-entry\fR or \fB\-\-undefined\fR option or by
1248 a \f(CW\*(C`ENTRY\*(C'\fR command in the linker script.
1249 .IP "\fB\-\-print\-gc\-sections\fR" 4
1250 .IX Item "--print-gc-sections"
1251 .PD 0
1252 .IP "\fB\-\-no\-print\-gc\-sections\fR" 4
1253 .IX Item "--no-print-gc-sections"
1254 .PD
1255 List all sections removed by garbage collection.  The listing is
1256 printed on stderr.  This option is only effective if garbage
1257 collection has been enabled via the \fB\-\-gc\-sections\fR) option.  The
1258 default behaviour (of not listing the sections that are removed) can
1259 be restored by specifying \fB\-\-no\-print\-gc\-sections\fR on the command
1260 line.
1261 .IP "\fB\-\-help\fR" 4
1262 .IX Item "--help"
1263 Print a summary of the command-line options on the standard output and exit.
1264 .IP "\fB\-\-target\-help\fR" 4
1265 .IX Item "--target-help"
1266 Print a summary of all target specific options on the standard output and exit.
1267 .IP "\fB\-Map=\fR\fImapfile\fR" 4
1268 .IX Item "-Map=mapfile"
1269 Print a link map to the file \fImapfile\fR.  See the description of the
1270 \&\fB\-M\fR option, above.
1271 .IP "\fB\-\-no\-keep\-memory\fR" 4
1272 .IX Item "--no-keep-memory"
1273 \&\fBld\fR normally optimizes for speed over memory usage by caching the
1274 symbol tables of input files in memory.  This option tells \fBld\fR to
1275 instead optimize for memory usage, by rereading the symbol tables as
1276 necessary.  This may be required if \fBld\fR runs out of memory space
1277 while linking a large executable.
1278 .IP "\fB\-\-no\-undefined\fR" 4
1279 .IX Item "--no-undefined"
1280 .PD 0
1281 .IP "\fB\-z defs\fR" 4
1282 .IX Item "-z defs"
1283 .PD
1284 Report unresolved symbol references from regular object files.  This
1285 is done even if the linker is creating a non-symbolic shared library.
1286 The switch \fB\-\-[no\-]allow\-shlib\-undefined\fR controls the
1287 behaviour for reporting unresolved references found in shared
1288 libraries being linked in.
1289 .IP "\fB\-\-allow\-multiple\-definition\fR" 4
1290 .IX Item "--allow-multiple-definition"
1291 .PD 0
1292 .IP "\fB\-z muldefs\fR" 4
1293 .IX Item "-z muldefs"
1294 .PD
1295 Normally when a symbol is defined multiple times, the linker will
1296 report a fatal error. These options allow multiple definitions and the
1297 first definition will be used.
1298 .IP "\fB\-\-allow\-shlib\-undefined\fR" 4
1299 .IX Item "--allow-shlib-undefined"
1300 .PD 0
1301 .IP "\fB\-\-no\-allow\-shlib\-undefined\fR" 4
1302 .IX Item "--no-allow-shlib-undefined"
1303 .PD
1304 Allows or disallows undefined symbols in shared libraries.
1305 This switch is similar to \fB\-\-no\-undefined\fR except that it
1306 determines the behaviour when the undefined symbols are in a
1307 shared library rather than a regular object file.  It does not affect
1308 how undefined symbols in regular object files are handled.
1309 .Sp
1310 The default behaviour is to report errors for any undefined symbols
1311 referenced in shared libraries if the linker is being used to create
1312 an executable, but to allow them if the linker is being used to create
1313 a shared library.
1314 .Sp
1315 The reasons for allowing undefined symbol references in shared
1316 libraries specified at link time are that:
1317 .RS 4
1318 .IP "\(bu" 4
1319 A shared library specified at link time may not be the same as the one
1320 that is available at load time, so the symbol might actually be
1321 resolvable at load time.
1322 .IP "\(bu" 4
1323 There are some operating systems, eg BeOS and \s-1HPPA\s0, where undefined
1324 symbols in shared libraries are normal.
1325 .Sp
1326 The BeOS kernel for example patches shared libraries at load time to
1327 select whichever function is most appropriate for the current
1328 architecture.  This is used, for example, to dynamically select an
1329 appropriate memset function.
1330 .RE
1331 .RS 4
1332 .RE
1333 .IP "\fB\-\-no\-undefined\-version\fR" 4
1334 .IX Item "--no-undefined-version"
1335 Normally when a symbol has an undefined version, the linker will ignore
1336 it. This option disallows symbols with undefined version and a fatal error
1337 will be issued instead.
1338 .IP "\fB\-\-default\-symver\fR" 4
1339 .IX Item "--default-symver"
1340 Create and use a default symbol version (the soname) for unversioned
1341 exported symbols.
1342 .IP "\fB\-\-default\-imported\-symver\fR" 4
1343 .IX Item "--default-imported-symver"
1344 Create and use a default symbol version (the soname) for unversioned
1345 imported symbols.
1346 .IP "\fB\-\-no\-warn\-mismatch\fR" 4
1347 .IX Item "--no-warn-mismatch"
1348 Normally \fBld\fR will give an error if you try to link together input
1349 files that are mismatched for some reason, perhaps because they have
1350 been compiled for different processors or for different endiannesses.
1351 This option tells \fBld\fR that it should silently permit such possible
1352 errors.  This option should only be used with care, in cases when you
1353 have taken some special action that ensures that the linker errors are
1354 inappropriate.
1355 .IP "\fB\-\-no\-warn\-search\-mismatch\fR" 4
1356 .IX Item "--no-warn-search-mismatch"
1357 Normally \fBld\fR will give a warning if it finds an incompatible
1358 library during a library search.  This option silences the warning.
1359 .IP "\fB\-\-no\-whole\-archive\fR" 4
1360 .IX Item "--no-whole-archive"
1361 Turn off the effect of the \fB\-\-whole\-archive\fR option for subsequent
1362 archive files.
1363 .IP "\fB\-\-noinhibit\-exec\fR" 4
1364 .IX Item "--noinhibit-exec"
1365 Retain the executable output file whenever it is still usable.
1366 Normally, the linker will not produce an output file if it encounters
1367 errors during the link process; it exits without writing an output file
1368 when it issues any error whatsoever.
1369 .IP "\fB\-nostdlib\fR" 4
1370 .IX Item "-nostdlib"
1371 Only search library directories explicitly specified on the
1372 command line.  Library directories specified in linker scripts
1373 (including linker scripts specified on the command line) are ignored.
1374 .IP "\fB\-\-oformat=\fR\fIoutput-format\fR" 4
1375 .IX Item "--oformat=output-format"
1376 \&\fBld\fR may be configured to support more than one kind of object
1377 file.  If your \fBld\fR is configured this way, you can use the
1378 \&\fB\-\-oformat\fR option to specify the binary format for the output
1379 object file.  Even when \fBld\fR is configured to support alternative
1380 object formats, you don't usually need to specify this, as \fBld\fR
1381 should be configured to produce as a default output format the most
1382 usual format on each machine.  \fIoutput-format\fR is a text string, the
1383 name of a particular format supported by the \s-1BFD\s0 libraries.  (You can
1384 list the available binary formats with \fBobjdump \-i\fR.)  The script
1385 command \f(CW\*(C`OUTPUT_FORMAT\*(C'\fR can also specify the output format, but
1386 this option overrides it.
1387 .IP "\fB\-pie\fR" 4
1388 .IX Item "-pie"
1389 .PD 0
1390 .IP "\fB\-\-pic\-executable\fR" 4
1391 .IX Item "--pic-executable"
1392 .PD
1393 Create a position independent executable.  This is currently only supported on
1394 \&\s-1ELF\s0 platforms.  Position independent executables are similar to shared
1395 libraries in that they are relocated by the dynamic linker to the virtual
1396 address the \s-1OS\s0 chooses for them (which can vary between invocations).  Like
1397 normal dynamically linked executables they can be executed and symbols
1398 defined in the executable cannot be overridden by shared libraries.
1399 .IP "\fB\-qmagic\fR" 4
1400 .IX Item "-qmagic"
1401 This option is ignored for Linux compatibility.
1402 .IP "\fB\-Qy\fR" 4
1403 .IX Item "-Qy"
1404 This option is ignored for \s-1SVR4\s0 compatibility.
1405 .IP "\fB\-\-relax\fR" 4
1406 .IX Item "--relax"
1407 .PD 0
1408 .IP "\fB\-\-no\-relax\fR" 4
1409 .IX Item "--no-relax"
1410 .PD
1411 An option with machine dependent effects.
1412 This option is only supported on a few targets.
1413 .Sp
1414 On some platforms the \fB\-\-relax\fR option performs target specific,
1415 global optimizations that become possible when the linker resolves
1416 addressing in the program, such as relaxing address modes,
1417 synthesizing new instructions, selecting shorter version of current
1418 instructions, and combinig constant values.
1419 .Sp
1420 On some platforms these link time global optimizations may make symbolic
1421 debugging of the resulting executable impossible.
1422 This is known to be the case for the Matsushita \s-1MN10200\s0 and \s-1MN10300\s0
1423 family of processors.
1424 .Sp
1425 On platforms where this is not supported, \fB\-\-relax\fR is accepted,
1426 but ignored.
1427 .Sp
1428 On platforms where \fB\-\-relax\fR is accepted the option
1429 \&\fB\-\-no\-relax\fR can be used to disable the feature.
1430 .IP "\fB\-\-retain\-symbols\-file=\fR\fIfilename\fR" 4
1431 .IX Item "--retain-symbols-file=filename"
1432 Retain \fIonly\fR the symbols listed in the file \fIfilename\fR,
1433 discarding all others.  \fIfilename\fR is simply a flat file, with one
1434 symbol name per line.  This option is especially useful in environments
1435 (such as VxWorks)
1436 where a large global symbol table is accumulated gradually, to conserve
1437 run-time memory.
1438 .Sp
1439 \&\fB\-\-retain\-symbols\-file\fR does \fInot\fR discard undefined symbols,
1440 or symbols needed for relocations.
1441 .Sp
1442 You may only specify \fB\-\-retain\-symbols\-file\fR once in the command
1443 line.  It overrides \fB\-s\fR and \fB\-S\fR.
1444 .IP "\fB\-rpath=\fR\fIdir\fR" 4
1445 .IX Item "-rpath=dir"
1446 Add a directory to the runtime library search path.  This is used when
1447 linking an \s-1ELF\s0 executable with shared objects.  All \fB\-rpath\fR
1448 arguments are concatenated and passed to the runtime linker, which uses
1449 them to locate shared objects at runtime.  The \fB\-rpath\fR option is
1450 also used when locating shared objects which are needed by shared
1451 objects explicitly included in the link; see the description of the
1452 \&\fB\-rpath\-link\fR option.  If \fB\-rpath\fR is not used when linking an
1453 \&\s-1ELF\s0 executable, the contents of the environment variable
1454 \&\f(CW\*(C`LD_RUN_PATH\*(C'\fR will be used if it is defined.
1455 .Sp
1456 The \fB\-rpath\fR option may also be used on SunOS.  By default, on
1457 SunOS, the linker will form a runtime search patch out of all the
1458 \&\fB\-L\fR options it is given.  If a \fB\-rpath\fR option is used, the
1459 runtime search path will be formed exclusively using the \fB\-rpath\fR
1460 options, ignoring the \fB\-L\fR options.  This can be useful when using
1461 gcc, which adds many \fB\-L\fR options which may be on \s-1NFS\s0 mounted
1462 file systems.
1463 .Sp
1464 For compatibility with other \s-1ELF\s0 linkers, if the \fB\-R\fR option is
1465 followed by a directory name, rather than a file name, it is treated as
1466 the \fB\-rpath\fR option.
1467 .IP "\fB\-rpath\-link=\fR\fIdir\fR" 4
1468 .IX Item "-rpath-link=dir"
1469 When using \s-1ELF\s0 or SunOS, one shared library may require another.  This
1470 happens when an \f(CW\*(C`ld \-shared\*(C'\fR link includes a shared library as one
1471 of the input files.
1472 .Sp
1473 When the linker encounters such a dependency when doing a non-shared,
1474 non-relocatable link, it will automatically try to locate the required
1475 shared library and include it in the link, if it is not included
1476 explicitly.  In such a case, the \fB\-rpath\-link\fR option
1477 specifies the first set of directories to search.  The
1478 \&\fB\-rpath\-link\fR option may specify a sequence of directory names
1479 either by specifying a list of names separated by colons, or by
1480 appearing multiple times.
1481 .Sp
1482 This option should be used with caution as it overrides the search path
1483 that may have been hard compiled into a shared library. In such a case it
1484 is possible to use unintentionally a different search path than the
1485 runtime linker would do.
1486 .Sp
1487 The linker uses the following search paths to locate required shared
1488 libraries:
1489 .RS 4
1490 .IP "1." 4
1491 Any directories specified by \fB\-rpath\-link\fR options.
1492 .IP "2." 4
1493 Any directories specified by \fB\-rpath\fR options.  The difference
1494 between \fB\-rpath\fR and \fB\-rpath\-link\fR is that directories
1495 specified by \fB\-rpath\fR options are included in the executable and
1496 used at runtime, whereas the \fB\-rpath\-link\fR option is only effective
1497 at link time. Searching \fB\-rpath\fR in this way is only supported
1498 by native linkers and cross linkers which have been configured with
1499 the \fB\-\-with\-sysroot\fR option.
1500 .IP "3." 4
1501 On an \s-1ELF\s0 system, for native linkers, if the \fB\-rpath\fR and
1502 \&\fB\-rpath\-link\fR options were not used, search the contents of the
1503 environment variable \f(CW\*(C`LD_RUN_PATH\*(C'\fR.
1504 .IP "4." 4
1505 On SunOS, if the \fB\-rpath\fR option was not used, search any
1506 directories specified using \fB\-L\fR options.
1507 .IP "5." 4
1508 For a native linker, the search the contents of the environment
1509 variable \f(CW\*(C`LD_LIBRARY_PATH\*(C'\fR.
1510 .IP "6." 4
1511 For a native \s-1ELF\s0 linker, the directories in \f(CW\*(C`DT_RUNPATH\*(C'\fR or
1512 \&\f(CW\*(C`DT_RPATH\*(C'\fR of a shared library are searched for shared
1513 libraries needed by it. The \f(CW\*(C`DT_RPATH\*(C'\fR entries are ignored if
1514 \&\f(CW\*(C`DT_RUNPATH\*(C'\fR entries exist.
1515 .IP "7." 4
1516 The default directories, normally \fI/lib\fR and \fI/usr/lib\fR.
1517 .IP "8." 4
1518 For a native linker on an \s-1ELF\s0 system, if the file \fI/etc/ld.so.conf\fR
1519 exists, the list of directories found in that file.
1520 .RE
1521 .RS 4
1522 .Sp
1523 If the required shared library is not found, the linker will issue a
1524 warning and continue with the link.
1525 .RE
1526 .IP "\fB\-shared\fR" 4
1527 .IX Item "-shared"
1528 .PD 0
1529 .IP "\fB\-Bshareable\fR" 4
1530 .IX Item "-Bshareable"
1531 .PD
1532 Create a shared library.  This is currently only supported on \s-1ELF\s0, \s-1XCOFF\s0
1533 and SunOS platforms.  On SunOS, the linker will automatically create a
1534 shared library if the \fB\-e\fR option is not used and there are
1535 undefined symbols in the link.
1536 .IP "\fB\-\-sort\-common\fR" 4
1537 .IX Item "--sort-common"
1538 .PD 0
1539 .IP "\fB\-\-sort\-common=ascending\fR" 4
1540 .IX Item "--sort-common=ascending"
1541 .IP "\fB\-\-sort\-common=descending\fR" 4
1542 .IX Item "--sort-common=descending"
1543 .PD
1544 This option tells \fBld\fR to sort the common symbols by alignment in
1545 ascending or descending order when it places them in the appropriate output
1546 sections.  The symbol alignments considered are sixteen-byte or larger,
1547 eight-byte, four-byte, two-byte, and one-byte. This is to prevent gaps
1548 between symbols due to alignment constraints.  If no sorting order is
1549 specified, then descending order is assumed.
1550 .IP "\fB\-\-sort\-section=name\fR" 4
1551 .IX Item "--sort-section=name"
1552 This option will apply \f(CW\*(C`SORT_BY_NAME\*(C'\fR to all wildcard section
1553 patterns in the linker script.
1554 .IP "\fB\-\-sort\-section=alignment\fR" 4
1555 .IX Item "--sort-section=alignment"
1556 This option will apply \f(CW\*(C`SORT_BY_ALIGNMENT\*(C'\fR to all wildcard section
1557 patterns in the linker script.
1558 .IP "\fB\-\-split\-by\-file[=\fR\fIsize\fR\fB]\fR" 4
1559 .IX Item "--split-by-file[=size]"
1560 Similar to \fB\-\-split\-by\-reloc\fR but creates a new output section for
1561 each input file when \fIsize\fR is reached.  \fIsize\fR defaults to a
1562 size of 1 if not given.
1563 .IP "\fB\-\-split\-by\-reloc[=\fR\fIcount\fR\fB]\fR" 4
1564 .IX Item "--split-by-reloc[=count]"
1565 Tries to creates extra sections in the output file so that no single
1566 output section in the file contains more than \fIcount\fR relocations.
1567 This is useful when generating huge relocatable files for downloading into
1568 certain real time kernels with the \s-1COFF\s0 object file format; since \s-1COFF\s0
1569 cannot represent more than 65535 relocations in a single section.  Note
1570 that this will fail to work with object file formats which do not
1571 support arbitrary sections.  The linker will not split up individual
1572 input sections for redistribution, so if a single input section contains
1573 more than \fIcount\fR relocations one output section will contain that
1574 many relocations.  \fIcount\fR defaults to a value of 32768.
1575 .IP "\fB\-\-stats\fR" 4
1576 .IX Item "--stats"
1577 Compute and display statistics about the operation of the linker, such
1578 as execution time and memory usage.
1579 .IP "\fB\-\-sysroot=\fR\fIdirectory\fR" 4
1580 .IX Item "--sysroot=directory"
1581 Use \fIdirectory\fR as the location of the sysroot, overriding the
1582 configure-time default.  This option is only supported by linkers
1583 that were configured using \fB\-\-with\-sysroot\fR.
1584 .IP "\fB\-\-traditional\-format\fR" 4
1585 .IX Item "--traditional-format"
1586 For some targets, the output of \fBld\fR is different in some ways from
1587 the output of some existing linker.  This switch requests \fBld\fR to
1588 use the traditional format instead.
1589 .Sp
1590 For example, on SunOS, \fBld\fR combines duplicate entries in the
1591 symbol string table.  This can reduce the size of an output file with
1592 full debugging information by over 30 percent.  Unfortunately, the SunOS
1593 \&\f(CW\*(C`dbx\*(C'\fR program can not read the resulting program (\f(CW\*(C`gdb\*(C'\fR has no
1594 trouble).  The \fB\-\-traditional\-format\fR switch tells \fBld\fR to not
1595 combine duplicate entries.
1596 .IP "\fB\-\-section\-start=\fR\fIsectionname\fR\fB=\fR\fIorg\fR" 4
1597 .IX Item "--section-start=sectionname=org"
1598 Locate a section in the output file at the absolute
1599 address given by \fIorg\fR.  You may use this option as many
1600 times as necessary to locate multiple sections in the command
1601 line.
1602 \&\fIorg\fR must be a single hexadecimal integer;
1603 for compatibility with other linkers, you may omit the leading
1604 \&\fB0x\fR usually associated with hexadecimal values.  \fINote:\fR there
1605 should be no white space between \fIsectionname\fR, the equals
1606 sign ("\fB=\fR"), and \fIorg\fR.
1607 .IP "\fB\-Tbss=\fR\fIorg\fR" 4
1608 .IX Item "-Tbss=org"
1609 .PD 0
1610 .IP "\fB\-Tdata=\fR\fIorg\fR" 4
1611 .IX Item "-Tdata=org"
1612 .IP "\fB\-Ttext=\fR\fIorg\fR" 4
1613 .IX Item "-Ttext=org"
1614 .PD
1615 Same as \fB\-\-section\-start\fR, with \f(CW\*(C`.bss\*(C'\fR, \f(CW\*(C`.data\*(C'\fR or
1616 \&\f(CW\*(C`.text\*(C'\fR as the \fIsectionname\fR.
1617 .IP "\fB\-Ttext\-segment=\fR\fIorg\fR" 4
1618 .IX Item "-Ttext-segment=org"
1619 When creating an \s-1ELF\s0 executable or shared object, it will set the address
1620 of the first byte of the text segment.
1621 .IP "\fB\-\-unresolved\-symbols=\fR\fImethod\fR" 4
1622 .IX Item "--unresolved-symbols=method"
1623 Determine how to handle unresolved symbols.  There are four possible
1624 values for \fBmethod\fR:
1625 .RS 4
1626 .IP "\fBignore-all\fR" 4
1627 .IX Item "ignore-all"
1628 Do not report any unresolved symbols.
1629 .IP "\fBreport-all\fR" 4
1630 .IX Item "report-all"
1631 Report all unresolved symbols.  This is the default.
1632 .IP "\fBignore-in-object-files\fR" 4
1633 .IX Item "ignore-in-object-files"
1634 Report unresolved symbols that are contained in shared libraries, but
1635 ignore them if they come from regular object files.
1636 .IP "\fBignore-in-shared-libs\fR" 4
1637 .IX Item "ignore-in-shared-libs"
1638 Report unresolved symbols that come from regular object files, but
1639 ignore them if they come from shared libraries.  This can be useful
1640 when creating a dynamic binary and it is known that all the shared
1641 libraries that it should be referencing are included on the linker's
1642 command line.
1643 .RE
1644 .RS 4
1645 .Sp
1646 The behaviour for shared libraries on their own can also be controlled
1647 by the \fB\-\-[no\-]allow\-shlib\-undefined\fR option.
1648 .Sp
1649 Normally the linker will generate an error message for each reported
1650 unresolved symbol but the option \fB\-\-warn\-unresolved\-symbols\fR
1651 can change this to a warning.
1652 .RE
1653 .IP "\fB\-\-dll\-verbose\fR" 4
1654 .IX Item "--dll-verbose"
1655 .PD 0
1656 .IP "\fB\-\-verbose[=\fR\fI\s-1NUMBER\s0\fR\fB]\fR" 4
1657 .IX Item "--verbose[=NUMBER]"
1658 .PD
1659 Display the version number for \fBld\fR and list the linker emulations
1660 supported.  Display which input files can and cannot be opened.  Display
1661 the linker script being used by the linker. If the optional \fI\s-1NUMBER\s0\fR
1662 argument > 1, plugin symbol status will also be displayed.
1663 .IP "\fB\-\-version\-script=\fR\fIversion-scriptfile\fR" 4
1664 .IX Item "--version-script=version-scriptfile"
1665 Specify the name of a version script to the linker.  This is typically
1666 used when creating shared libraries to specify additional information
1667 about the version hierarchy for the library being created.  This option
1668 is only fully supported on \s-1ELF\s0 platforms which support shared libraries;
1669 see \fB\s-1VERSION\s0\fR.  It is partially supported on \s-1PE\s0 platforms, which can
1670 use version scripts to filter symbol visibility in auto-export mode: any
1671 symbols marked \fBlocal\fR in the version script will not be exported.
1672 .IP "\fB\-\-warn\-common\fR" 4
1673 .IX Item "--warn-common"
1674 Warn when a common symbol is combined with another common symbol or with
1675 a symbol definition.  Unix linkers allow this somewhat sloppy practise,
1676 but linkers on some other operating systems do not.  This option allows
1677 you to find potential problems from combining global symbols.
1678 Unfortunately, some C libraries use this practise, so you may get some
1679 warnings about symbols in the libraries as well as in your programs.
1680 .Sp
1681 There are three kinds of global symbols, illustrated here by C examples:
1682 .RS 4
1683 .IP "\fBint i = 1;\fR" 4
1684 .IX Item "int i = 1;"
1685 A definition, which goes in the initialized data section of the output
1686 file.
1687 .IP "\fBextern int i;\fR" 4
1688 .IX Item "extern int i;"
1689 An undefined reference, which does not allocate space.
1690 There must be either a definition or a common symbol for the
1691 variable somewhere.
1692 .IP "\fBint i;\fR" 4
1693 .IX Item "int i;"
1694 A common symbol.  If there are only (one or more) common symbols for a
1695 variable, it goes in the uninitialized data area of the output file.
1696 The linker merges multiple common symbols for the same variable into a
1697 single symbol.  If they are of different sizes, it picks the largest
1698 size.  The linker turns a common symbol into a declaration, if there is
1699 a definition of the same variable.
1700 .RE
1701 .RS 4
1702 .Sp
1703 The \fB\-\-warn\-common\fR option can produce five kinds of warnings.
1704 Each warning consists of a pair of lines: the first describes the symbol
1705 just encountered, and the second describes the previous symbol
1706 encountered with the same name.  One or both of the two symbols will be
1707 a common symbol.
1708 .IP "1." 4
1709 Turning a common symbol into a reference, because there is already a
1710 definition for the symbol.
1711 .Sp
1712 .Vb 3
1713 \&        <file>(<section>): warning: common of \`<symbol>\*(Aq
1714 \&           overridden by definition
1715 \&        <file>(<section>): warning: defined here
1716 .Ve
1717 .IP "2." 4
1718 Turning a common symbol into a reference, because a later definition for
1719 the symbol is encountered.  This is the same as the previous case,
1720 except that the symbols are encountered in a different order.
1721 .Sp
1722 .Vb 3
1723 \&        <file>(<section>): warning: definition of \`<symbol>\*(Aq
1724 \&           overriding common
1725 \&        <file>(<section>): warning: common is here
1726 .Ve
1727 .IP "3." 4
1728 Merging a common symbol with a previous same-sized common symbol.
1729 .Sp
1730 .Vb 3
1731 \&        <file>(<section>): warning: multiple common
1732 \&           of \`<symbol>\*(Aq
1733 \&        <file>(<section>): warning: previous common is here
1734 .Ve
1735 .IP "4." 4
1736 Merging a common symbol with a previous larger common symbol.
1737 .Sp
1738 .Vb 3
1739 \&        <file>(<section>): warning: common of \`<symbol>\*(Aq
1740 \&           overridden by larger common
1741 \&        <file>(<section>): warning: larger common is here
1742 .Ve
1743 .IP "5." 4
1744 Merging a common symbol with a previous smaller common symbol.  This is
1745 the same as the previous case, except that the symbols are
1746 encountered in a different order.
1747 .Sp
1748 .Vb 3
1749 \&        <file>(<section>): warning: common of \`<symbol>\*(Aq
1750 \&           overriding smaller common
1751 \&        <file>(<section>): warning: smaller common is here
1752 .Ve
1753 .RE
1754 .RS 4
1755 .RE
1756 .IP "\fB\-\-warn\-constructors\fR" 4
1757 .IX Item "--warn-constructors"
1758 Warn if any global constructors are used.  This is only useful for a few
1759 object file formats.  For formats like \s-1COFF\s0 or \s-1ELF\s0, the linker can not
1760 detect the use of global constructors.
1761 .IP "\fB\-\-warn\-multiple\-gp\fR" 4
1762 .IX Item "--warn-multiple-gp"
1763 Warn if multiple global pointer values are required in the output file.
1764 This is only meaningful for certain processors, such as the Alpha.
1765 Specifically, some processors put large-valued constants in a special
1766 section.  A special register (the global pointer) points into the middle
1767 of this section, so that constants can be loaded efficiently via a
1768 base-register relative addressing mode.  Since the offset in
1769 base-register relative mode is fixed and relatively small (e.g., 16
1770 bits), this limits the maximum size of the constant pool.  Thus, in
1771 large programs, it is often necessary to use multiple global pointer
1772 values in order to be able to address all possible constants.  This
1773 option causes a warning to be issued whenever this case occurs.
1774 .IP "\fB\-\-warn\-once\fR" 4
1775 .IX Item "--warn-once"
1776 Only warn once for each undefined symbol, rather than once per module
1777 which refers to it.
1778 .IP "\fB\-\-warn\-section\-align\fR" 4
1779 .IX Item "--warn-section-align"
1780 Warn if the address of an output section is changed because of
1781 alignment.  Typically, the alignment will be set by an input section.
1782 The address will only be changed if it not explicitly specified; that
1783 is, if the \f(CW\*(C`SECTIONS\*(C'\fR command does not specify a start address for
1784 the section.
1785 .IP "\fB\-\-warn\-shared\-textrel\fR" 4
1786 .IX Item "--warn-shared-textrel"
1787 Warn if the linker adds a \s-1DT_TEXTREL\s0 to a shared object.
1788 .IP "\fB\-\-warn\-alternate\-em\fR" 4
1789 .IX Item "--warn-alternate-em"
1790 Warn if an object has alternate \s-1ELF\s0 machine code.
1791 .IP "\fB\-\-warn\-unresolved\-symbols\fR" 4
1792 .IX Item "--warn-unresolved-symbols"
1793 If the linker is going to report an unresolved symbol (see the option
1794 \&\fB\-\-unresolved\-symbols\fR) it will normally generate an error.
1795 This option makes it generate a warning instead.
1796 .IP "\fB\-\-error\-unresolved\-symbols\fR" 4
1797 .IX Item "--error-unresolved-symbols"
1798 This restores the linker's default behaviour of generating errors when
1799 it is reporting unresolved symbols.
1800 .IP "\fB\-\-whole\-archive\fR" 4
1801 .IX Item "--whole-archive"
1802 For each archive mentioned on the command line after the
1803 \&\fB\-\-whole\-archive\fR option, include every object file in the archive
1804 in the link, rather than searching the archive for the required object
1805 files.  This is normally used to turn an archive file into a shared
1806 library, forcing every object to be included in the resulting shared
1807 library.  This option may be used more than once.
1808 .Sp
1809 Two notes when using this option from gcc: First, gcc doesn't know
1810 about this option, so you have to use \fB\-Wl,\-whole\-archive\fR.
1811 Second, don't forget to use \fB\-Wl,\-no\-whole\-archive\fR after your
1812 list of archives, because gcc will add its own list of archives to
1813 your link and you may not want this flag to affect those as well.
1814 .IP "\fB\-\-wrap=\fR\fIsymbol\fR" 4
1815 .IX Item "--wrap=symbol"
1816 Use a wrapper function for \fIsymbol\fR.  Any undefined reference to
1817 \&\fIsymbol\fR will be resolved to \f(CW\*(C`_\|_wrap_\f(CIsymbol\f(CW\*(C'\fR.  Any
1818 undefined reference to \f(CW\*(C`_\|_real_\f(CIsymbol\f(CW\*(C'\fR will be resolved to
1819 \&\fIsymbol\fR.
1820 .Sp
1821 This can be used to provide a wrapper for a system function.  The
1822 wrapper function should be called \f(CW\*(C`_\|_wrap_\f(CIsymbol\f(CW\*(C'\fR.  If it
1823 wishes to call the system function, it should call
1824 \&\f(CW\*(C`_\|_real_\f(CIsymbol\f(CW\*(C'\fR.
1825 .Sp
1826 Here is a trivial example:
1827 .Sp
1828 .Vb 6
1829 \&        void *
1830 \&        _\|_wrap_malloc (size_t c)
1831 \&        {
1832 \&          printf ("malloc called with %zu\en", c);
1833 \&          return _\|_real_malloc (c);
1834 \&        }
1835 .Ve
1836 .Sp
1837 If you link other code with this file using \fB\-\-wrap malloc\fR, then
1838 all calls to \f(CW\*(C`malloc\*(C'\fR will call the function \f(CW\*(C`_\|_wrap_malloc\*(C'\fR
1839 instead.  The call to \f(CW\*(C`_\|_real_malloc\*(C'\fR in \f(CW\*(C`_\|_wrap_malloc\*(C'\fR will
1840 call the real \f(CW\*(C`malloc\*(C'\fR function.
1841 .Sp
1842 You may wish to provide a \f(CW\*(C`_\|_real_malloc\*(C'\fR function as well, so that
1843 links without the \fB\-\-wrap\fR option will succeed.  If you do this,
1844 you should not put the definition of \f(CW\*(C`_\|_real_malloc\*(C'\fR in the same
1845 file as \f(CW\*(C`_\|_wrap_malloc\*(C'\fR; if you do, the assembler may resolve the
1846 call before the linker has a chance to wrap it to \f(CW\*(C`malloc\*(C'\fR.
1847 .IP "\fB\-\-eh\-frame\-hdr\fR" 4
1848 .IX Item "--eh-frame-hdr"
1849 Request creation of \f(CW\*(C`.eh_frame_hdr\*(C'\fR section and \s-1ELF\s0
1850 \&\f(CW\*(C`PT_GNU_EH_FRAME\*(C'\fR segment header.
1851 .IP "\fB\-\-enable\-new\-dtags\fR" 4
1852 .IX Item "--enable-new-dtags"
1853 .PD 0
1854 .IP "\fB\-\-disable\-new\-dtags\fR" 4
1855 .IX Item "--disable-new-dtags"
1856 .PD
1857 This linker can create the new dynamic tags in \s-1ELF\s0. But the older \s-1ELF\s0
1858 systems may not understand them. If you specify
1859 \&\fB\-\-enable\-new\-dtags\fR, the dynamic tags will be created as needed.
1860 If you specify \fB\-\-disable\-new\-dtags\fR, no new dynamic tags will be
1861 created. By default, the new dynamic tags are not created. Note that
1862 those options are only available for \s-1ELF\s0 systems.
1863 .IP "\fB\-\-hash\-size=\fR\fInumber\fR" 4
1864 .IX Item "--hash-size=number"
1865 Set the default size of the linker's hash tables to a prime number
1866 close to \fInumber\fR.  Increasing this value can reduce the length of
1867 time it takes the linker to perform its tasks, at the expense of
1868 increasing the linker's memory requirements.  Similarly reducing this
1869 value can reduce the memory requirements at the expense of speed.
1870 .IP "\fB\-\-hash\-style=\fR\fIstyle\fR" 4
1871 .IX Item "--hash-style=style"
1872 Set the type of linker's hash table(s).  \fIstyle\fR can be either
1873 \&\f(CW\*(C`sysv\*(C'\fR for classic \s-1ELF\s0 \f(CW\*(C`.hash\*(C'\fR section, \f(CW\*(C`gnu\*(C'\fR for
1874 new style \s-1GNU\s0 \f(CW\*(C`.gnu.hash\*(C'\fR section or \f(CW\*(C`both\*(C'\fR for both
1875 the classic \s-1ELF\s0 \f(CW\*(C`.hash\*(C'\fR and new style \s-1GNU\s0 \f(CW\*(C`.gnu.hash\*(C'\fR
1876 hash tables.  The default is \f(CW\*(C`sysv\*(C'\fR.
1877 .IP "\fB\-\-reduce\-memory\-overheads\fR" 4
1878 .IX Item "--reduce-memory-overheads"
1879 This option reduces memory requirements at ld runtime, at the expense of
1880 linking speed.  This was introduced to select the old O(n^2) algorithm
1881 for link map file generation, rather than the new O(n) algorithm which uses
1882 about 40% more memory for symbol storage.
1883 .Sp
1884 Another effect of the switch is to set the default hash table size to
1885 1021, which again saves memory at the cost of lengthening the linker's
1886 run time.  This is not done however if the \fB\-\-hash\-size\fR switch
1887 has been used.
1888 .Sp
1889 The \fB\-\-reduce\-memory\-overheads\fR switch may be also be used to
1890 enable other tradeoffs in future versions of the linker.
1891 .IP "\fB\-\-build\-id\fR" 4
1892 .IX Item "--build-id"
1893 .PD 0
1894 .IP "\fB\-\-build\-id=\fR\fIstyle\fR" 4
1895 .IX Item "--build-id=style"
1896 .PD
1897 Request creation of \f(CW\*(C`.note.gnu.build\-id\*(C'\fR \s-1ELF\s0 note section.
1898 The contents of the note are unique bits identifying this linked
1899 file.  \fIstyle\fR can be \f(CW\*(C`uuid\*(C'\fR to use 128 random bits,
1900 \&\f(CW\*(C`sha1\*(C'\fR to use a 160\-bit \s-1SHA1\s0 hash on the normative
1901 parts of the output contents, \f(CW\*(C`md5\*(C'\fR to use a 128\-bit
1902 \&\s-1MD5\s0 hash on the normative parts of the output contents, or
1903 \&\f(CW\*(C`0x\f(CIhexstring\f(CW\*(C'\fR to use a chosen bit string specified as
1904 an even number of hexadecimal digits (\f(CW\*(C`\-\*(C'\fR and \f(CW\*(C`:\*(C'\fR
1905 characters between digit pairs are ignored).  If \fIstyle\fR is
1906 omitted, \f(CW\*(C`sha1\*(C'\fR is used.
1907 .Sp
1908 The \f(CW\*(C`md5\*(C'\fR and \f(CW\*(C`sha1\*(C'\fR styles produces an identifier
1909 that is always the same in an identical output file, but will be
1910 unique among all nonidentical output files.  It is not intended
1911 to be compared as a checksum for the file's contents.  A linked
1912 file may be changed later by other tools, but the build \s-1ID\s0 bit
1913 string identifying the original linked file does not change.
1914 .Sp
1915 Passing \f(CW\*(C`none\*(C'\fR for \fIstyle\fR disables the setting from any
1916 \&\f(CW\*(C`\-\-build\-id\*(C'\fR options earlier on the command line.
1917 .PP
1918 The i386 \s-1PE\s0 linker supports the \fB\-shared\fR option, which causes
1919 the output to be a dynamically linked library (\s-1DLL\s0) instead of a
1920 normal executable.  You should name the output \f(CW\*(C`*.dll\*(C'\fR when you
1921 use this option.  In addition, the linker fully supports the standard
1922 \&\f(CW\*(C`*.def\*(C'\fR files, which may be specified on the linker command line
1923 like an object file (in fact, it should precede archives it exports
1924 symbols from, to ensure that they get linked in, just like a normal
1925 object file).
1926 .PP
1927 In addition to the options common to all targets, the i386 \s-1PE\s0 linker
1928 support additional command line options that are specific to the i386
1929 \&\s-1PE\s0 target.  Options that take values may be separated from their
1930 values by either a space or an equals sign.
1931 .IP "\fB\-\-add\-stdcall\-alias\fR" 4
1932 .IX Item "--add-stdcall-alias"
1933 If given, symbols with a stdcall suffix (@\fInn\fR) will be exported
1934 as-is and also with the suffix stripped.
1935 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
1936 .IP "\fB\-\-base\-file\fR \fIfile\fR" 4
1937 .IX Item "--base-file file"
1938 Use \fIfile\fR as the name of a file in which to save the base
1939 addresses of all the relocations needed for generating DLLs with
1940 \&\fIdlltool\fR.
1941 [This is an i386 \s-1PE\s0 specific option]
1942 .IP "\fB\-\-dll\fR" 4
1943 .IX Item "--dll"
1944 Create a \s-1DLL\s0 instead of a regular executable.  You may also use
1945 \&\fB\-shared\fR or specify a \f(CW\*(C`LIBRARY\*(C'\fR in a given \f(CW\*(C`.def\*(C'\fR
1946 file.
1947 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
1948 .IP "\fB\-\-enable\-long\-section\-names\fR" 4
1949 .IX Item "--enable-long-section-names"
1950 .PD 0
1951 .IP "\fB\-\-disable\-long\-section\-names\fR" 4
1952 .IX Item "--disable-long-section-names"
1953 .PD
1954 The \s-1PE\s0 variants of the Coff object format add an extension that permits
1955 the use of section names longer than eight characters, the normal limit
1956 for Coff.  By default, these names are only allowed in object files, as
1957 fully-linked executable images do not carry the Coff string table required
1958 to support the longer names.  As a \s-1GNU\s0 extension, it is possible to
1959 allow their use in executable images as well, or to (probably pointlessly!)
1960 disallow it in object files, by using these two options.  Executable images
1961 generated with these long section names are slightly non-standard, carrying
1962 as they do a string table, and may generate confusing output when examined
1963 with non-GNU PE-aware tools, such as file viewers and dumpers.  However, 
1964 \&\s-1GDB\s0 relies on the use of \s-1PE\s0 long section names to find Dwarf\-2 debug 
1965 information sections in an executable image at runtime, and so if neither
1966 option is specified on the command-line, \fBld\fR will enable long
1967 section names, overriding the default and technically correct behaviour,
1968 when it finds the presence of debug information while linking an executable
1969 image and not stripping symbols.
1970 [This option is valid for all \s-1PE\s0 targeted ports of the linker]
1971 .IP "\fB\-\-enable\-stdcall\-fixup\fR" 4
1972 .IX Item "--enable-stdcall-fixup"
1973 .PD 0
1974 .IP "\fB\-\-disable\-stdcall\-fixup\fR" 4
1975 .IX Item "--disable-stdcall-fixup"
1976 .PD
1977 If the link finds a symbol that it cannot resolve, it will attempt to
1978 do \*(L"fuzzy linking\*(R" by looking for another defined symbol that differs
1979 only in the format of the symbol name (cdecl vs stdcall) and will
1980 resolve that symbol by linking to the match.  For example, the
1981 undefined symbol \f(CW\*(C`_foo\*(C'\fR might be linked to the function
1982 \&\f(CW\*(C`_foo@12\*(C'\fR, or the undefined symbol \f(CW\*(C`_bar@16\*(C'\fR might be linked
1983 to the function \f(CW\*(C`_bar\*(C'\fR.  When the linker does this, it prints a
1984 warning, since it normally should have failed to link, but sometimes
1985 import libraries generated from third-party dlls may need this feature
1986 to be usable.  If you specify \fB\-\-enable\-stdcall\-fixup\fR, this
1987 feature is fully enabled and warnings are not printed.  If you specify
1988 \&\fB\-\-disable\-stdcall\-fixup\fR, this feature is disabled and such
1989 mismatches are considered to be errors.
1990 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
1991 .IP "\fB\-\-leading\-underscore\fR" 4
1992 .IX Item "--leading-underscore"
1993 .PD 0
1994 .IP "\fB\-\-no\-leading\-underscore\fR" 4
1995 .IX Item "--no-leading-underscore"
1996 .PD
1997 For most targets default symbol-prefix is an underscore and is defined
1998 in target's description. By this option it is possible to
1999 disable/enable the default underscore symbol-prefix.
2000 .IP "\fB\-\-export\-all\-symbols\fR" 4
2001 .IX Item "--export-all-symbols"
2002 If given, all global symbols in the objects used to build a \s-1DLL\s0 will
2003 be exported by the \s-1DLL\s0.  Note that this is the default if there
2004 otherwise wouldn't be any exported symbols.  When symbols are
2005 explicitly exported via \s-1DEF\s0 files or implicitly exported via function
2006 attributes, the default is to not export anything else unless this
2007 option is given.  Note that the symbols \f(CW\*(C`DllMain@12\*(C'\fR,
2008 \&\f(CW\*(C`DllEntryPoint@0\*(C'\fR, \f(CW\*(C`DllMainCRTStartup@12\*(C'\fR, and
2009 \&\f(CW\*(C`impure_ptr\*(C'\fR will not be automatically
2010 exported.  Also, symbols imported from other DLLs will not be
2011 re-exported, nor will symbols specifying the \s-1DLL\s0's internal layout
2012 such as those beginning with \f(CW\*(C`_head_\*(C'\fR or ending with
2013 \&\f(CW\*(C`_iname\*(C'\fR.  In addition, no symbols from \f(CW\*(C`libgcc\*(C'\fR,
2014 \&\f(CW\*(C`libstd++\*(C'\fR, \f(CW\*(C`libmingw32\*(C'\fR, or \f(CW\*(C`crtX.o\*(C'\fR will be exported.
2015 Symbols whose names begin with \f(CW\*(C`_\|_rtti_\*(C'\fR or \f(CW\*(C`_\|_builtin_\*(C'\fR will
2016 not be exported, to help with \*(C+ DLLs.  Finally, there is an
2017 extensive list of cygwin-private symbols that are not exported
2018 (obviously, this applies on when building DLLs for cygwin targets).
2019 These cygwin-excludes are: \f(CW\*(C`_cygwin_dll_entry@12\*(C'\fR,
2020 \&\f(CW\*(C`_cygwin_crt0_common@8\*(C'\fR, \f(CW\*(C`_cygwin_noncygwin_dll_entry@12\*(C'\fR,
2021 \&\f(CW\*(C`_fmode\*(C'\fR, \f(CW\*(C`_impure_ptr\*(C'\fR, \f(CW\*(C`cygwin_attach_dll\*(C'\fR,
2022 \&\f(CW\*(C`cygwin_premain0\*(C'\fR, \f(CW\*(C`cygwin_premain1\*(C'\fR, \f(CW\*(C`cygwin_premain2\*(C'\fR,
2023 \&\f(CW\*(C`cygwin_premain3\*(C'\fR, and \f(CW\*(C`environ\*(C'\fR.
2024 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2025 .IP "\fB\-\-exclude\-symbols\fR \fIsymbol\fR\fB,\fR\fIsymbol\fR\fB,...\fR" 4
2026 .IX Item "--exclude-symbols symbol,symbol,..."
2027 Specifies a list of symbols which should not be automatically
2028 exported.  The symbol names may be delimited by commas or colons.
2029 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2030 .IP "\fB\-\-exclude\-all\-symbols\fR" 4
2031 .IX Item "--exclude-all-symbols"
2032 Specifies no symbols should be automatically exported.
2033 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2034 .IP "\fB\-\-file\-alignment\fR" 4
2035 .IX Item "--file-alignment"
2036 Specify the file alignment.  Sections in the file will always begin at
2037 file offsets which are multiples of this number.  This defaults to
2038 512.
2039 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2040 .IP "\fB\-\-heap\fR \fIreserve\fR" 4
2041 .IX Item "--heap reserve"
2042 .PD 0
2043 .IP "\fB\-\-heap\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
2044 .IX Item "--heap reserve,commit"
2045 .PD
2046 Specify the number of bytes of memory to reserve (and optionally commit)
2047 to be used as heap for this program.  The default is 1Mb reserved, 4K
2048 committed.
2049 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2050 .IP "\fB\-\-image\-base\fR \fIvalue\fR" 4
2051 .IX Item "--image-base value"
2052 Use \fIvalue\fR as the base address of your program or dll.  This is
2053 the lowest memory location that will be used when your program or dll
2054 is loaded.  To reduce the need to relocate and improve performance of
2055 your dlls, each should have a unique base address and not overlap any
2056 other dlls.  The default is 0x400000 for executables, and 0x10000000
2057 for dlls.
2058 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2059 .IP "\fB\-\-kill\-at\fR" 4
2060 .IX Item "--kill-at"
2061 If given, the stdcall suffixes (@\fInn\fR) will be stripped from
2062 symbols before they are exported.
2063 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2064 .IP "\fB\-\-large\-address\-aware\fR" 4
2065 .IX Item "--large-address-aware"
2066 If given, the appropriate bit in the \*(L"Characteristics\*(R" field of the \s-1COFF\s0
2067 header is set to indicate that this executable supports virtual addresses
2068 greater than 2 gigabytes.  This should be used in conjunction with the /3GB
2069 or /USERVA=\fIvalue\fR megabytes switch in the \*(L"[operating systems]\*(R"
2070 section of the \s-1BOOT\s0.INI.  Otherwise, this bit has no effect.
2071 [This option is specific to \s-1PE\s0 targeted ports of the linker]
2072 .IP "\fB\-\-major\-image\-version\fR \fIvalue\fR" 4
2073 .IX Item "--major-image-version value"
2074 Sets the major number of the \*(L"image version\*(R".  Defaults to 1.
2075 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2076 .IP "\fB\-\-major\-os\-version\fR \fIvalue\fR" 4
2077 .IX Item "--major-os-version value"
2078 Sets the major number of the \*(L"os version\*(R".  Defaults to 4.
2079 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2080 .IP "\fB\-\-major\-subsystem\-version\fR \fIvalue\fR" 4
2081 .IX Item "--major-subsystem-version value"
2082 Sets the major number of the \*(L"subsystem version\*(R".  Defaults to 4.
2083 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2084 .IP "\fB\-\-minor\-image\-version\fR \fIvalue\fR" 4
2085 .IX Item "--minor-image-version value"
2086 Sets the minor number of the \*(L"image version\*(R".  Defaults to 0.
2087 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2088 .IP "\fB\-\-minor\-os\-version\fR \fIvalue\fR" 4
2089 .IX Item "--minor-os-version value"
2090 Sets the minor number of the \*(L"os version\*(R".  Defaults to 0.
2091 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2092 .IP "\fB\-\-minor\-subsystem\-version\fR \fIvalue\fR" 4
2093 .IX Item "--minor-subsystem-version value"
2094 Sets the minor number of the \*(L"subsystem version\*(R".  Defaults to 0.
2095 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2096 .IP "\fB\-\-output\-def\fR \fIfile\fR" 4
2097 .IX Item "--output-def file"
2098 The linker will create the file \fIfile\fR which will contain a \s-1DEF\s0
2099 file corresponding to the \s-1DLL\s0 the linker is generating.  This \s-1DEF\s0 file
2100 (which should be called \f(CW\*(C`*.def\*(C'\fR) may be used to create an import
2101 library with \f(CW\*(C`dlltool\*(C'\fR or may be used as a reference to
2102 automatically or implicitly exported symbols.
2103 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2104 .IP "\fB\-\-out\-implib\fR \fIfile\fR" 4
2105 .IX Item "--out-implib file"
2106 The linker will create the file \fIfile\fR which will contain an
2107 import lib corresponding to the \s-1DLL\s0 the linker is generating. This
2108 import lib (which should be called \f(CW\*(C`*.dll.a\*(C'\fR or \f(CW\*(C`*.a\*(C'\fR
2109 may be used to link clients against the generated \s-1DLL\s0; this behaviour
2110 makes it possible to skip a separate \f(CW\*(C`dlltool\*(C'\fR import library
2111 creation step.
2112 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2113 .IP "\fB\-\-enable\-auto\-image\-base\fR" 4
2114 .IX Item "--enable-auto-image-base"
2115 Automatically choose the image base for DLLs, unless one is specified
2116 using the \f(CW\*(C`\-\-image\-base\*(C'\fR argument.  By using a hash generated
2117 from the dllname to create unique image bases for each \s-1DLL\s0, in-memory
2118 collisions and relocations which can delay program execution are
2119 avoided.
2120 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2121 .IP "\fB\-\-disable\-auto\-image\-base\fR" 4
2122 .IX Item "--disable-auto-image-base"
2123 Do not automatically generate a unique image base.  If there is no
2124 user-specified image base (\f(CW\*(C`\-\-image\-base\*(C'\fR) then use the platform
2125 default.
2126 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2127 .IP "\fB\-\-dll\-search\-prefix\fR \fIstring\fR" 4
2128 .IX Item "--dll-search-prefix string"
2129 When linking dynamically to a dll without an import library,
2130 search for \f(CW\*(C`<string><basename>.dll\*(C'\fR in preference to
2131 \&\f(CW\*(C`lib<basename>.dll\*(C'\fR. This behaviour allows easy distinction
2132 between DLLs built for the various \*(L"subplatforms\*(R": native, cygwin,
2133 uwin, pw, etc.  For instance, cygwin DLLs typically use
2134 \&\f(CW\*(C`\-\-dll\-search\-prefix=cyg\*(C'\fR.
2135 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2136 .IP "\fB\-\-enable\-auto\-import\fR" 4
2137 .IX Item "--enable-auto-import"
2138 Do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to \f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for
2139 \&\s-1DATA\s0 imports from DLLs, and create the necessary thunking symbols when
2140 building the import libraries with those \s-1DATA\s0 exports. Note: Use of the
2141 \&'auto\-import' extension will cause the text section of the image file
2142 to be made writable. This does not conform to the PE-COFF format
2143 specification published by Microsoft.
2144 .Sp
2145 Note \- use of the 'auto\-import' extension will also cause read only
2146 data which would normally be placed into the .rdata section to be
2147 placed into the .data section instead.  This is in order to work
2148 around a problem with consts that is described here:
2149 http://www.cygwin.com/ml/cygwin/2004\-09/msg01101.html
2150 .Sp
2151 Using 'auto\-import' generally will 'just work' \*(-- but sometimes you may
2152 see this message:
2153 .Sp
2154 "variable '<var>' can't be auto-imported. Please read the
2155 documentation for ld's \f(CW\*(C`\-\-enable\-auto\-import\*(C'\fR for details."
2156 .Sp
2157 This message occurs when some (sub)expression accesses an address
2158 ultimately given by the sum of two constants (Win32 import tables only
2159 allow one).  Instances where this may occur include accesses to member
2160 fields of struct variables imported from a \s-1DLL\s0, as well as using a
2161 constant index into an array variable imported from a \s-1DLL\s0.  Any
2162 multiword variable (arrays, structs, long long, etc) may trigger
2163 this error condition.  However, regardless of the exact data type
2164 of the offending exported variable, ld will always detect it, issue
2165 the warning, and exit.
2166 .Sp
2167 There are several ways to address this difficulty, regardless of the
2168 data type of the exported variable:
2169 .Sp
2170 One way is to use \-\-enable\-runtime\-pseudo\-reloc switch. This leaves the task
2171 of adjusting references in your client code for runtime environment, so
2172 this method works only when runtime environment supports this feature.
2173 .Sp
2174 A second solution is to force one of the 'constants' to be a variable \*(--
2175 that is, unknown and un-optimizable at compile time.  For arrays,
2176 there are two possibilities: a) make the indexee (the array's address)
2177 a variable, or b) make the 'constant' index a variable.  Thus:
2178 .Sp
2179 .Vb 3
2180 \&        extern type extern_array[];
2181 \&        extern_array[1] \-\->
2182 \&           { volatile type *t=extern_array; t[1] }
2183 .Ve
2184 .Sp
2185 or
2186 .Sp
2187 .Vb 3
2188 \&        extern type extern_array[];
2189 \&        extern_array[1] \-\->
2190 \&           { volatile int t=1; extern_array[t] }
2191 .Ve
2192 .Sp
2193 For structs (and most other multiword data types) the only option
2194 is to make the struct itself (or the long long, or the ...) variable:
2195 .Sp
2196 .Vb 3
2197 \&        extern struct s extern_struct;
2198 \&        extern_struct.field \-\->
2199 \&           { volatile struct s *t=&extern_struct; t\->field }
2200 .Ve
2201 .Sp
2202 or
2203 .Sp
2204 .Vb 3
2205 \&        extern long long extern_ll;
2206 \&        extern_ll \-\->
2207 \&          { volatile long long * local_ll=&extern_ll; *local_ll }
2208 .Ve
2209 .Sp
2210 A third method of dealing with this difficulty is to abandon
2211 \&'auto\-import' for the offending symbol and mark it with
2212 \&\f(CW\*(C`_\|_declspec(dllimport)\*(C'\fR.  However, in practise that
2213 requires using compile-time #defines to indicate whether you are
2214 building a \s-1DLL\s0, building client code that will link to the \s-1DLL\s0, or
2215 merely building/linking to a static library.   In making the choice
2216 between the various methods of resolving the 'direct address with
2217 constant offset' problem, you should consider typical real-world usage:
2218 .Sp
2219 Original:
2220 .Sp
2221 .Vb 7
2222 \&        \-\-foo.h
2223 \&        extern int arr[];
2224 \&        \-\-foo.c
2225 \&        #include "foo.h"
2226 \&        void main(int argc, char **argv){
2227 \&          printf("%d\en",arr[1]);
2228 \&        }
2229 .Ve
2230 .Sp
2231 Solution 1:
2232 .Sp
2233 .Vb 9
2234 \&        \-\-foo.h
2235 \&        extern int arr[];
2236 \&        \-\-foo.c
2237 \&        #include "foo.h"
2238 \&        void main(int argc, char **argv){
2239 \&          /* This workaround is for win32 and cygwin; do not "optimize" */
2240 \&          volatile int *parr = arr;
2241 \&          printf("%d\en",parr[1]);
2242 \&        }
2243 .Ve
2244 .Sp
2245 Solution 2:
2246 .Sp
2247 .Vb 10
2248 \&        \-\-foo.h
2249 \&        /* Note: auto\-export is assumed (no _\|_declspec(dllexport)) */
2250 \&        #if (defined(_WIN32) || defined(_\|_CYGWIN_\|_)) && \e
2251 \&          !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
2252 \&        #define FOO_IMPORT _\|_declspec(dllimport)
2253 \&        #else
2254 \&        #define FOO_IMPORT
2255 \&        #endif
2256 \&        extern FOO_IMPORT int arr[];
2257 \&        \-\-foo.c
2258 \&        #include "foo.h"
2259 \&        void main(int argc, char **argv){
2260 \&          printf("%d\en",arr[1]);
2261 \&        }
2262 .Ve
2263 .Sp
2264 A fourth way to avoid this problem is to re-code your
2265 library to use a functional interface rather than a data interface
2266 for the offending variables (e.g. \fIset_foo()\fR and \fIget_foo()\fR accessor
2267 functions).
2268 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2269 .IP "\fB\-\-disable\-auto\-import\fR" 4
2270 .IX Item "--disable-auto-import"
2271 Do not attempt to do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to
2272 \&\f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for \s-1DATA\s0 imports from DLLs.
2273 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2274 .IP "\fB\-\-enable\-runtime\-pseudo\-reloc\fR" 4
2275 .IX Item "--enable-runtime-pseudo-reloc"
2276 If your code contains expressions described in \-\-enable\-auto\-import section,
2277 that is, \s-1DATA\s0 imports from \s-1DLL\s0 with non-zero offset, this switch will create
2278 a vector of 'runtime pseudo relocations' which can be used by runtime
2279 environment to adjust references to such data in your client code.
2280 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2281 .IP "\fB\-\-disable\-runtime\-pseudo\-reloc\fR" 4
2282 .IX Item "--disable-runtime-pseudo-reloc"
2283 Do not create pseudo relocations for non-zero offset \s-1DATA\s0 imports from
2284 DLLs.  This is the default.
2285 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2286 .IP "\fB\-\-enable\-extra\-pe\-debug\fR" 4
2287 .IX Item "--enable-extra-pe-debug"
2288 Show additional debug info related to auto-import symbol thunking.
2289 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2290 .IP "\fB\-\-section\-alignment\fR" 4
2291 .IX Item "--section-alignment"
2292 Sets the section alignment.  Sections in memory will always begin at
2293 addresses which are a multiple of this number.  Defaults to 0x1000.
2294 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2295 .IP "\fB\-\-stack\fR \fIreserve\fR" 4
2296 .IX Item "--stack reserve"
2297 .PD 0
2298 .IP "\fB\-\-stack\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
2299 .IX Item "--stack reserve,commit"
2300 .PD
2301 Specify the number of bytes of memory to reserve (and optionally commit)
2302 to be used as stack for this program.  The default is 2Mb reserved, 4K
2303 committed.
2304 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2305 .IP "\fB\-\-subsystem\fR \fIwhich\fR" 4
2306 .IX Item "--subsystem which"
2307 .PD 0
2308 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR" 4
2309 .IX Item "--subsystem which:major"
2310 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR\fB.\fR\fIminor\fR" 4
2311 .IX Item "--subsystem which:major.minor"
2312 .PD
2313 Specifies the subsystem under which your program will execute.  The
2314 legal values for \fIwhich\fR are \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`windows\*(C'\fR,
2315 \&\f(CW\*(C`console\*(C'\fR, \f(CW\*(C`posix\*(C'\fR, and \f(CW\*(C`xbox\*(C'\fR.  You may optionally set
2316 the subsystem version also.  Numeric values are also accepted for
2317 \&\fIwhich\fR.
2318 [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
2319 .Sp
2320 The following options set flags in the \f(CW\*(C`DllCharacteristics\*(C'\fR field
2321 of the \s-1PE\s0 file header:
2322 [These options are specific to \s-1PE\s0 targeted ports of the linker]
2323 .IP "\fB\-\-dynamicbase\fR" 4
2324 .IX Item "--dynamicbase"
2325 The image base address may be relocated using address space layout
2326 randomization (\s-1ASLR\s0).  This feature was introduced with \s-1MS\s0 Windows
2327 Vista for i386 \s-1PE\s0 targets.
2328 .IP "\fB\-\-forceinteg\fR" 4
2329 .IX Item "--forceinteg"
2330 Code integrity checks are enforced.
2331 .IP "\fB\-\-nxcompat\fR" 4
2332 .IX Item "--nxcompat"
2333 The image is compatible with the Data Execution Prevention.
2334 This feature was introduced with \s-1MS\s0 Windows \s-1XP\s0 \s-1SP2\s0 for i386 \s-1PE\s0 targets.
2335 .IP "\fB\-\-no\-isolation\fR" 4
2336 .IX Item "--no-isolation"
2337 Although the image understands isolation, do not isolate the image.
2338 .IP "\fB\-\-no\-seh\fR" 4
2339 .IX Item "--no-seh"
2340 The image does not use \s-1SEH\s0. No \s-1SE\s0 handler may be called from
2341 this image.
2342 .IP "\fB\-\-no\-bind\fR" 4
2343 .IX Item "--no-bind"
2344 Do not bind this image.
2345 .IP "\fB\-\-wdmdriver\fR" 4
2346 .IX Item "--wdmdriver"
2347 The driver uses the \s-1MS\s0 Windows Driver Model.
2348 .IP "\fB\-\-tsaware\fR" 4
2349 .IX Item "--tsaware"
2350 The image is Terminal Server aware.
2351 .PP
2352 The 68HC11 and 68HC12 linkers support specific options to control the
2353 memory bank switching mapping and trampoline code generation.
2354 .IP "\fB\-\-no\-trampoline\fR" 4
2355 .IX Item "--no-trampoline"
2356 This option disables the generation of trampoline. By default a trampoline
2357 is generated for each far function which is called using a \f(CW\*(C`jsr\*(C'\fR
2358 instruction (this happens when a pointer to a far function is taken).
2359 .IP "\fB\-\-bank\-window\fR \fIname\fR" 4
2360 .IX Item "--bank-window name"
2361 This option indicates to the linker the name of the memory region in
2362 the \fB\s-1MEMORY\s0\fR specification that describes the memory bank window.
2363 The definition of such region is then used by the linker to compute
2364 paging and addresses within the memory window.
2365 .PP
2366 The following options are supported to control handling of \s-1GOT\s0 generation
2367 when linking for 68K targets.
2368 .IP "\fB\-\-got=\fR\fItype\fR" 4
2369 .IX Item "--got=type"
2370 This option tells the linker which \s-1GOT\s0 generation scheme to use.
2371 \&\fItype\fR should be one of \fBsingle\fR, \fBnegative\fR,
2372 \&\fBmultigot\fR or \fBtarget\fR.  For more information refer to the
2373 Info entry for \fIld\fR.
2374 .SH "ENVIRONMENT"
2375 .IX Header "ENVIRONMENT"
2376 You can change the behaviour of \fBld\fR with the environment variables
2377 \&\f(CW\*(C`GNUTARGET\*(C'\fR,
2378 \&\f(CW\*(C`LDEMULATION\*(C'\fR and \f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR.
2379 .PP
2380 \&\f(CW\*(C`GNUTARGET\*(C'\fR determines the input-file object format if you don't
2381 use \fB\-b\fR (or its synonym \fB\-\-format\fR).  Its value should be one
2382 of the \s-1BFD\s0 names for an input format.  If there is no
2383 \&\f(CW\*(C`GNUTARGET\*(C'\fR in the environment, \fBld\fR uses the natural format
2384 of the target. If \f(CW\*(C`GNUTARGET\*(C'\fR is set to \f(CW\*(C`default\*(C'\fR then \s-1BFD\s0
2385 attempts to discover the input format by examining binary input files;
2386 this method often succeeds, but there are potential ambiguities, since
2387 there is no method of ensuring that the magic number used to specify
2388 object-file formats is unique.  However, the configuration procedure for
2389 \&\s-1BFD\s0 on each system places the conventional format for that system first
2390 in the search-list, so ambiguities are resolved in favor of convention.
2391 .PP
2392 \&\f(CW\*(C`LDEMULATION\*(C'\fR determines the default emulation if you don't use the
2393 \&\fB\-m\fR option.  The emulation can affect various aspects of linker
2394 behaviour, particularly the default linker script.  You can list the
2395 available emulations with the \fB\-\-verbose\fR or \fB\-V\fR options.  If
2396 the \fB\-m\fR option is not used, and the \f(CW\*(C`LDEMULATION\*(C'\fR environment
2397 variable is not defined, the default emulation depends upon how the
2398 linker was configured.
2399 .PP
2400 Normally, the linker will default to demangling symbols.  However, if
2401 \&\f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR is set in the environment, then it will
2402 default to not demangling symbols.  This environment variable is used in
2403 a similar fashion by the \f(CW\*(C`gcc\*(C'\fR linker wrapper program.  The default
2404 may be overridden by the \fB\-\-demangle\fR and \fB\-\-no\-demangle\fR
2405 options.
2406 .SH "SEE ALSO"
2407 .IX Header "SEE ALSO"
2408 \&\fIar\fR\|(1), \fInm\fR\|(1), \fIobjcopy\fR\|(1), \fIobjdump\fR\|(1), \fIreadelf\fR\|(1) and
2409 the Info entries for \fIbinutils\fR and
2410 \&\fIld\fR.
2411 .SH "COPYRIGHT"
2412 .IX Header "COPYRIGHT"
2413 Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2414 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
2415 Software Foundation, Inc.
2416 .PP
2417 Permission is granted to copy, distribute and/or modify this document
2418 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
2419 or any later version published by the Free Software Foundation;
2420 with no Invariant Sections, with no Front-Cover Texts, and with no
2421 Back-Cover Texts.  A copy of the license is included in the
2422 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".