1 .\" Copyright (c) 2016 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" This software is provided by the author and contributors ``as is''
13 .\" and any express or implied warranties, including, but not limited
14 .\" to, the implied warranties of merchantability and fitness for a
15 .\" particular purpose are disclaimed. In no event shall the author or
16 .\" contributors be liable for any direct, indirect, incidental, special,
17 .\" exemplary, or consequential damages (including, but not limited to,
18 .\" procurement of substitute goods or services; loss of use, data, or
19 .\" profits; or business interruption) however caused and on any
20 .\" theory of liability, whether in contract, strict liability, or
21 .\" tort (including negligence or otherwise) arising in any way
22 .\" out of the use of this software, even if advised of the
23 .\" possibility of such damage.
40 .Op Fl I Ar file | Fl -dynamic-linker= Ns Ar file
41 .Op Fl L Ar dir | Fl -library-path= Ns Ar dir
42 .Op Fl M | Fl -print-map
43 .Op Fl T Ar script-file | Fl -script= Ns Ar script-file
44 .Op Fl V | Fl v | Fl -version
46 .Op Fl b Ar input-format | Fl -format= Ns Ar input-format
48 .Op Fl d | Fl dc | Fl dp
51 .Op Fl e Ar symbol | Fl -entry= Ns Ar symbol
52 .Op Fl h Ar name | Fl soname= Ns Ar name
53 .Op Fl l Ar library | Fl -library= Ns Ar library
54 .Op Fl o Ar output-file | Fl -output= Ns Ar output-file
55 .Op Fl q | Fl -emit-relocs
56 .Op Fl r | Fl -relocatable
57 .Op Fl u Ar name | Fl -undefined= Ns Ar name
64 .Op Fl -no-define-common
65 .Op Fl -no-gc-sections
66 .Op Fl -no-print-gc-sections
67 .Op Fl -no-whole-archive
68 .Op Fl -oformat= Ns Ar format
69 .Op Fl -pic-executable | Fl pie
70 .Op Fl -print-gc-sections
71 .Op Fl -rpath= Ns Ar dirs
72 .Op Fl -rpath-link= Ns Ar dirs
76 .Op Fl -version-script= Ns Ar script
82 utility combines ELF objects and
84 archives containing ELF objects into an executable or a partially
89 utility processes options and files in the order presented on the
93 utilities, options and file names may be interspersed.
94 Options seen on the command line will generally apply to subsequent
95 files, or till overridden by another option.
100 utility supports the following options:
101 .Bl -tag -width indent
107 Start a group of archives that are to be searched repeatedly until no new
108 undefined references are created.
109 This option is used when there are circular references between one or
110 more archives in the archive group.
112 The files named by the arguments
114 are expected to be archive files.
118 option starts a new archive group that is ended by a matching
122 Choose dynamic libraries for the libraries specified by subsequent
126 Create a shared library.
128 Choose static libraries for the libraries specified by subsequent
131 .It Fl I Ar file | Fl -dynamic-linker= Ns Ar file
132 Set the name of the dynamic linker when generating ELF executables.
133 .It Fl L Ar dir | Fl -library-path= Ns Ar dir
136 to the list of paths that
138 will search for archive libraries.
139 This option may be specified multiple times.
140 User supplied directories are searched in the order specified on
142 .It Fl M | Fl -print-map
143 Print a link map to standard output.
144 .It Fl T Ar script-file | Fl -script= Ns Ar script-file
145 Use the file name by argument
147 as the linker script instead of the default.
148 .It Fl V | Fl v | Fl version
149 Print a version identifier for
154 The value of the argument
156 should be one of the following literals:
157 .Bl -tag -width ".Li default" -compact
159 Equivalent to specifying
162 Equivalent to specifying
165 Equivalent to specifying
168 .It Fl b Ar input-format | Fl -format Ar input-format
169 Set the input format to that specified by argument
171 The legal values for the argument
173 are those supported by
174 .Xr elftc_bfd_find_target 3 .
175 .It Fl d | Fl dc | Fl dp
176 Assign space for common symbols even if generating a relocatable object.
178 Equivalent to specifying option
181 Equivalent to specifying option
183 .It Fl e Ar entry | Fl -entry Ar entry
184 Set execution to start at the symbol named by the argument
186 The argument should be the name of a symbol.
187 .It Fl h Ar name | Fl soname Ar name
190 field in the object to that specified by the argument
192 .It Fl l Ar name | Fl -library= Ns Ar name
193 Add the archive library or shared library named by argument
195 to the set of files to link.
196 This file is looked for in the list of directories specified by prior
198 options on the command line.
199 .It Fl o Ar output-file | Fl -output= Ns Ar output-file
200 Use the file specified by argument
202 for the output, instead of the default file name of
204 .It Fl q | Fl -emit-relocs
205 Preserve relocation information in executables, for use by post-link
207 .It Fl r | Fl -relocatable
208 Generate a relocatable output file that can be used as input for subsequent
210 .It Fl u Ar name | Fl -undefined= Ns Ar name
211 Add the symbol specified by argument
213 to the output file as an undefined symbol.
214 This option may be specified multiple times.
216 Recognized keywords include:
217 .Bl -tag -width ".Li defaultextract" -compact
219 Require the object to use an executable stack.
221 Do not require the object to use an executable stack.
226 tags for only those shared libraries that satisfy non-weak
227 unresolved references from object files or other dynamic libraries
228 seen so far on the command line.
230 Equivalent to specifying option
237 segment header, containing exception handling information.
239 Equivalent to specifying option
242 Garbage collect unused input sections.
246 tags for all shared libraries seen henceforth on the command line,
247 irrespective of whether the shared library is needed to resolve an
248 undefined symbol or not.
249 This behavior is the default.
250 .It Fl -no-define-common
251 Do not assign addresses to common symbols.
252 .It Fl -no-gc-sections
253 Do not garbage collect input sections that contain unreferenced
255 .It Fl -no-print-gc-sections
256 Do not print the list of sections removed when the
259 .It Fl -no-whole-archive
260 Only include objects in an archive that satisfy an unresolved reference
262 This behavior is the default.
264 Equivalent to specifying option
266 .It Fl -oformat= Ns Ar format
267 Set the desired output format to that specified by the argument
269 Supported values for argument
271 are those understood by
272 .Xr elftc_bfd_find_target 3 .
273 .It Fl -pic-executable | Fl pie
274 Create a position-independent executable.
275 .It Fl -print-gc-sections
276 Print the list of sections removed when the
279 The output is printed to stderr.
280 .It Fl -rpath= Ns Ar dirs
281 Add the colon-separated list of directories named by the argument
283 to the runtime library search path and to the link-time search
285 .It Fl -rpath-link= Ns Ar dirs
286 Add the directories specified by the colon-separated list of directories
289 to the link-time search path for libraries.
290 The directories specified by this option are searched before those
295 Equivalent to specifying option
298 Equivalent to specifying option
301 Equivalent to specifying option
303 .It Fl -version-script= Ns Ar script-file
304 Use the version script in the file named by argument
306 .It Fl -whole-archive
307 Include the entire contents of every archive file encountered on the
308 command line after this option in the link.
317 .Xr elftc_bfd_find_target 3 ,
319 .Sh IMPLEMENTATION NOTES
322 utility differs from its GNU equivalent in the following:
327 utility currently supports a limited range of output formats.
333 options only accept a symbol name as an argument, and not a numeric
338 option only searches files in the directories specified by
345 option does not search for script files in the directories specified
352 option accepts a colon-separated list of directories instead of
356 The following options are recognized, but are currently unimplemented:
359 .Fl Bsymbolic_functions ,
386 .Fl -accept-unknown-input-arch ,
387 .Fl -allow-multiple-definition ,
388 .Fl -allow-shlib-undefined ,
392 .Fl -check-sections ,
396 .Fl -disable-new-dtags ,
398 .Fl -discard-locals ,
399 .Fl -error-unresolved-symbols ,
400 .Fl -export-dynamic ,
402 .Fl -enable-new-dtags ,
403 .Fl -fatal-warnings ,
413 .Fl -no-accept-unknown-input-arch ,
414 .Fl -no-allow-shlib-undefined ,
416 .Fl -no-check-sections ,
418 .Fl -no-keep-memory ,
421 .Fl -no-undefined-version ,
422 .Fl -no-warn-mismatch ,
426 .Fl -retain-symbols-file ,
431 .Fl -split-by-reloc ,
437 .Fl -traditional-format ,
439 .Fl -unresolved-symbols ,
442 .Fl -warn-constructors ,
443 .Fl -warn-multiple-gp ,
445 .Fl -warn-section-align ,
446 .Fl -warn-shared-textrel ,
447 .Fl -warn-unresolved-symbols ,
450 The following keywords are recognized by the
452 option, but are currently unimplemented:
473 command first appeared in AT&T UNIX Version 1.
475 The Elftoolchain implementation of
478 .An Kai Wang Aq Mt kaiwang27@gmail.com .