logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

ld.1 (158183B)


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