riscv-none-embed-ld.1 130 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905
  1. .\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
  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 "2020-07-03" "binutils-2.32" "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\-e\fR \fIentry\fR" 4
  366. .IX Item "-e entry"
  367. .PD 0
  368. .IP "\fB\-\-entry=\fR\fIentry\fR" 4
  369. .IX Item "--entry=entry"
  370. .PD
  371. Use \fIentry\fR as the explicit symbol for beginning execution of your
  372. program, rather than the default entry point. If there is no symbol
  373. named \fIentry\fR, the linker will try to parse \fIentry\fR as a number,
  374. and use that as the entry address (the number will be interpreted in
  375. base 10; you may use a leading \fB0x\fR for base 16, or a leading
  376. \&\fB0\fR for base 8).
  377. .IP "\fB\-\-exclude\-libs\fR \fIlib\fR\fB,\fR\fIlib\fR\fB,...\fR" 4
  378. .IX Item "--exclude-libs lib,lib,..."
  379. Specifies a list of archive libraries from which symbols should not be automatically
  380. exported. The library names may be delimited by commas or colons. Specifying
  381. \&\f(CW\*(C`\-\-exclude\-libs ALL\*(C'\fR excludes symbols in all archive libraries from
  382. automatic export. This option is available only for the i386 \s-1PE\s0 targeted
  383. port of the linker and for \s-1ELF\s0 targeted ports. For i386 \s-1PE,\s0 symbols
  384. explicitly listed in a .def file are still exported, regardless of this
  385. option. For \s-1ELF\s0 targeted ports, symbols affected by this option will
  386. be treated as hidden.
  387. .IP "\fB\-\-exclude\-modules\-for\-implib\fR \fImodule\fR\fB,\fR\fImodule\fR\fB,...\fR" 4
  388. .IX Item "--exclude-modules-for-implib module,module,..."
  389. Specifies a list of object files or archive members, from which symbols
  390. should not be automatically exported, but which should be copied wholesale
  391. into the import library being generated during the link. The module names
  392. may be delimited by commas or colons, and must match exactly the filenames
  393. used by \fBld\fR to open the files; for archive members, this is simply
  394. the member name, but for object files the name listed must include and
  395. match precisely any path used to specify the input file on the linker's
  396. command-line. This option is available only for the i386 \s-1PE\s0 targeted port
  397. of the linker. Symbols explicitly listed in a .def file are still exported,
  398. regardless of this option.
  399. .IP "\fB\-E\fR" 4
  400. .IX Item "-E"
  401. .PD 0
  402. .IP "\fB\-\-export\-dynamic\fR" 4
  403. .IX Item "--export-dynamic"
  404. .IP "\fB\-\-no\-export\-dynamic\fR" 4
  405. .IX Item "--no-export-dynamic"
  406. .PD
  407. When creating a dynamically linked executable, using the \fB\-E\fR
  408. option or the \fB\-\-export\-dynamic\fR option causes the linker to add
  409. all symbols to the dynamic symbol table. The dynamic symbol table is the
  410. set of symbols which are visible from dynamic objects at run time.
  411. .Sp
  412. If you do not use either of these options (or use the
  413. \&\fB\-\-no\-export\-dynamic\fR option to restore the default behavior), the
  414. dynamic symbol table will normally contain only those symbols which are
  415. referenced by some dynamic object mentioned in the link.
  416. .Sp
  417. If you use \f(CW\*(C`dlopen\*(C'\fR to load a dynamic object which needs to refer
  418. back to the symbols defined by the program, rather than some other
  419. dynamic object, then you will probably need to use this option when
  420. linking the program itself.
  421. .Sp
  422. You can also use the dynamic list to control what symbols should
  423. be added to the dynamic symbol table if the output format supports it.
  424. See the description of \fB\-\-dynamic\-list\fR.
  425. .Sp
  426. Note that this option is specific to \s-1ELF\s0 targeted ports. \s-1PE\s0 targets
  427. support a similar function to export all symbols from a \s-1DLL\s0 or \s-1EXE\s0; see
  428. the description of \fB\-\-export\-all\-symbols\fR below.
  429. .IP "\fB\-EB\fR" 4
  430. .IX Item "-EB"
  431. Link big-endian objects. This affects the default output format.
  432. .IP "\fB\-EL\fR" 4
  433. .IX Item "-EL"
  434. Link little-endian objects. This affects the default output format.
  435. .IP "\fB\-f\fR \fIname\fR" 4
  436. .IX Item "-f name"
  437. .PD 0
  438. .IP "\fB\-\-auxiliary=\fR\fIname\fR" 4
  439. .IX Item "--auxiliary=name"
  440. .PD
  441. When creating an \s-1ELF\s0 shared object, set the internal \s-1DT_AUXILIARY\s0 field
  442. to the specified name. This tells the dynamic linker that the symbol
  443. table of the shared object should be used as an auxiliary filter on the
  444. symbol table of the shared object \fIname\fR.
  445. .Sp
  446. If you later link a program against this filter object, then, when you
  447. run the program, the dynamic linker will see the \s-1DT_AUXILIARY\s0 field. If
  448. the dynamic linker resolves any symbols from the filter object, it will
  449. first check whether there is a definition in the shared object
  450. \&\fIname\fR. If there is one, it will be used instead of the definition
  451. in the filter object. The shared object \fIname\fR need not exist.
  452. Thus the shared object \fIname\fR may be used to provide an alternative
  453. implementation of certain functions, perhaps for debugging or for
  454. machine specific performance.
  455. .Sp
  456. This option may be specified more than once. The \s-1DT_AUXILIARY\s0 entries
  457. will be created in the order in which they appear on the command line.
  458. .IP "\fB\-F\fR \fIname\fR" 4
  459. .IX Item "-F name"
  460. .PD 0
  461. .IP "\fB\-\-filter=\fR\fIname\fR" 4
  462. .IX Item "--filter=name"
  463. .PD
  464. When creating an \s-1ELF\s0 shared object, set the internal \s-1DT_FILTER\s0 field to
  465. the specified name. This tells the dynamic linker that the symbol table
  466. of the shared object which is being created should be used as a filter
  467. on the symbol table of the shared object \fIname\fR.
  468. .Sp
  469. If you later link a program against this filter object, then, when you
  470. run the program, the dynamic linker will see the \s-1DT_FILTER\s0 field. The
  471. dynamic linker will resolve symbols according to the symbol table of the
  472. filter object as usual, but it will actually link to the definitions
  473. found in the shared object \fIname\fR. Thus the filter object can be
  474. used to select a subset of the symbols provided by the object
  475. \&\fIname\fR.
  476. .Sp
  477. Some older linkers used the \fB\-F\fR option throughout a compilation
  478. toolchain for specifying object-file format for both input and output
  479. object files.
  480. The \s-1GNU\s0 linker uses other mechanisms for this purpose: the
  481. \&\fB\-b\fR, \fB\-\-format\fR, \fB\-\-oformat\fR options, the
  482. \&\f(CW\*(C`TARGET\*(C'\fR command in linker scripts, and the \f(CW\*(C`GNUTARGET\*(C'\fR
  483. environment variable.
  484. The \s-1GNU\s0 linker will ignore the \fB\-F\fR option when not
  485. creating an \s-1ELF\s0 shared object.
  486. .IP "\fB\-fini=\fR\fIname\fR" 4
  487. .IX Item "-fini=name"
  488. When creating an \s-1ELF\s0 executable or shared object, call \s-1NAME\s0 when the
  489. executable or shared object is unloaded, by setting \s-1DT_FINI\s0 to the
  490. address of the function. By default, the linker uses \f(CW\*(C`_fini\*(C'\fR as
  491. the function to call.
  492. .IP "\fB\-g\fR" 4
  493. .IX Item "-g"
  494. Ignored. Provided for compatibility with other tools.
  495. .IP "\fB\-G\fR \fIvalue\fR" 4
  496. .IX Item "-G value"
  497. .PD 0
  498. .IP "\fB\-\-gpsize=\fR\fIvalue\fR" 4
  499. .IX Item "--gpsize=value"
  500. .PD
  501. Set the maximum size of objects to be optimized using the \s-1GP\s0 register to
  502. \&\fIsize\fR. This is only meaningful for object file formats such as
  503. \&\s-1MIPS ELF\s0 that support putting large and small objects into different
  504. sections. This is ignored for other object file formats.
  505. .IP "\fB\-h\fR \fIname\fR" 4
  506. .IX Item "-h name"
  507. .PD 0
  508. .IP "\fB\-soname=\fR\fIname\fR" 4
  509. .IX Item "-soname=name"
  510. .PD
  511. When creating an \s-1ELF\s0 shared object, set the internal \s-1DT_SONAME\s0 field to
  512. the specified name. When an executable is linked with a shared object
  513. which has a \s-1DT_SONAME\s0 field, then when the executable is run the dynamic
  514. linker will attempt to load the shared object specified by the \s-1DT_SONAME\s0
  515. field rather than the using the file name given to the linker.
  516. .IP "\fB\-i\fR" 4
  517. .IX Item "-i"
  518. Perform an incremental link (same as option \fB\-r\fR).
  519. .IP "\fB\-init=\fR\fIname\fR" 4
  520. .IX Item "-init=name"
  521. When creating an \s-1ELF\s0 executable or shared object, call \s-1NAME\s0 when the
  522. executable or shared object is loaded, by setting \s-1DT_INIT\s0 to the address
  523. of the function. By default, the linker uses \f(CW\*(C`_init\*(C'\fR as the
  524. function to call.
  525. .IP "\fB\-l\fR \fInamespec\fR" 4
  526. .IX Item "-l namespec"
  527. .PD 0
  528. .IP "\fB\-\-library=\fR\fInamespec\fR" 4
  529. .IX Item "--library=namespec"
  530. .PD
  531. Add the archive or object file specified by \fInamespec\fR to the
  532. list of files to link. This option may be used any number of times.
  533. If \fInamespec\fR is of the form \fI:\fIfilename\fI\fR, \fBld\fR
  534. will search the library path for a file called \fIfilename\fR, otherwise it
  535. will search the library path for a file called \fIlib\fInamespec\fI.a\fR.
  536. .Sp
  537. On systems which support shared libraries, \fBld\fR may also search for
  538. files other than \fIlib\fInamespec\fI.a\fR. Specifically, on \s-1ELF\s0
  539. and SunOS systems, \fBld\fR will search a directory for a library
  540. called \fIlib\fInamespec\fI.so\fR before searching for one called
  541. \&\fIlib\fInamespec\fI.a\fR. (By convention, a \f(CW\*(C`.so\*(C'\fR extension
  542. indicates a shared library.) Note that this behavior does not apply
  543. to \fI:\fIfilename\fI\fR, which always specifies a file called
  544. \&\fIfilename\fR.
  545. .Sp
  546. The linker will search an archive only once, at the location where it is
  547. specified on the command line. If the archive defines a symbol which
  548. was undefined in some object which appeared before the archive on the
  549. command line, the linker will include the appropriate file(s) from the
  550. archive. However, an undefined symbol in an object appearing later on
  551. the command line will not cause the linker to search the archive again.
  552. .Sp
  553. See the \fB\-(\fR option for a way to force the linker to search
  554. archives multiple times.
  555. .Sp
  556. You may list the same archive multiple times on the command line.
  557. .Sp
  558. This type of archive searching is standard for Unix linkers. However,
  559. if you are using \fBld\fR on \s-1AIX,\s0 note that it is different from the
  560. behaviour of the \s-1AIX\s0 linker.
  561. .IP "\fB\-L\fR \fIsearchdir\fR" 4
  562. .IX Item "-L searchdir"
  563. .PD 0
  564. .IP "\fB\-\-library\-path=\fR\fIsearchdir\fR" 4
  565. .IX Item "--library-path=searchdir"
  566. .PD
  567. Add path \fIsearchdir\fR to the list of paths that \fBld\fR will search
  568. for archive libraries and \fBld\fR control scripts. You may use this
  569. option any number of times. The directories are searched in the order
  570. in which they are specified on the command line. Directories specified
  571. on the command line are searched before the default directories. All
  572. \&\fB\-L\fR options apply to all \fB\-l\fR options, regardless of the
  573. order in which the options appear. \fB\-L\fR options do not affect
  574. how \fBld\fR searches for a linker script unless \fB\-T\fR
  575. option is specified.
  576. .Sp
  577. If \fIsearchdir\fR begins with \f(CW\*(C`=\*(C'\fR or \f(CW$SYSROOT\fR, then this
  578. prefix will be replaced by the \fIsysroot prefix\fR, controlled by the
  579. \&\fB\-\-sysroot\fR option, or specified when the linker is configured.
  580. .Sp
  581. The default set of paths searched (without being specified with
  582. \&\fB\-L\fR) depends on which emulation mode \fBld\fR is using, and in
  583. some cases also on how it was configured.
  584. .Sp
  585. The paths can also be specified in a link script with the
  586. \&\f(CW\*(C`SEARCH_DIR\*(C'\fR command. Directories specified this way are searched
  587. at the point in which the linker script appears in the command line.
  588. .IP "\fB\-m\fR \fIemulation\fR" 4
  589. .IX Item "-m emulation"
  590. Emulate the \fIemulation\fR linker. You can list the available
  591. emulations with the \fB\-\-verbose\fR or \fB\-V\fR options.
  592. .Sp
  593. If the \fB\-m\fR option is not used, the emulation is taken from the
  594. \&\f(CW\*(C`LDEMULATION\*(C'\fR environment variable, if that is defined.
  595. .Sp
  596. Otherwise, the default emulation depends upon how the linker was
  597. configured.
  598. .IP "\fB\-M\fR" 4
  599. .IX Item "-M"
  600. .PD 0
  601. .IP "\fB\-\-print\-map\fR" 4
  602. .IX Item "--print-map"
  603. .PD
  604. Print a link map to the standard output. A link map provides
  605. information about the link, including the following:
  606. .RS 4
  607. .IP "\(bu" 4
  608. Where object files are mapped into memory.
  609. .IP "\(bu" 4
  610. How common symbols are allocated.
  611. .IP "\(bu" 4
  612. All archive members included in the link, with a mention of the symbol
  613. which caused the archive member to be brought in.
  614. .IP "\(bu" 4
  615. The values assigned to symbols.
  616. .Sp
  617. Note \- symbols whose values are computed by an expression which
  618. involves a reference to a previous value of the same symbol may not
  619. have correct result displayed in the link map. This is because the
  620. linker discards intermediate results and only retains the final value
  621. of an expression. Under such circumstances the linker will display
  622. the final value enclosed by square brackets. Thus for example a
  623. linker script containing:
  624. .Sp
  625. .Vb 3
  626. \& foo = 1
  627. \& foo = foo * 4
  628. \& foo = foo + 8
  629. .Ve
  630. .Sp
  631. will produce the following output in the link map if the \fB\-M\fR
  632. option is used:
  633. .Sp
  634. .Vb 3
  635. \& 0x00000001 foo = 0x1
  636. \& [0x0000000c] foo = (foo * 0x4)
  637. \& [0x0000000c] foo = (foo + 0x8)
  638. .Ve
  639. .Sp
  640. See \fBExpressions\fR for more information about expressions in linker
  641. scripts.
  642. .IP "\(bu" 4
  643. *<How \s-1GNU\s0 properties are merged.>
  644. .Sp
  645. When linker merges input .note.gnu.property sections into one output
  646. \&.note.gnu.property section, some properties are removed or updated,
  647. which are reported in the link map as
  648. .Sp
  649. .Vb 1
  650. \& Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)
  651. .Ve
  652. .Sp
  653. It indicates that property 0xc0000002 is removed from output when
  654. merging properties in \fIfoo.o\fR, whose property 0xc0000002 value
  655. is 0x1, and \fIbar.o\fR, which doesn't have property 0xc0000002.
  656. .Sp
  657. .Vb 1
  658. \& Updated property 0xc0000002 (0x1) to merge foo.o (0x1) and bar.o (0x1)
  659. .Ve
  660. .Sp
  661. It indicates that property 0xc0010001 value is updated to 0x1 in output
  662. when merging properties in \fIfoo.o\fR, whose 0xc0010001 property value
  663. is 0x1, and \fIbar.o\fR, whose 0xc0010001 property value is 0x1.
  664. .RE
  665. .RS 4
  666. .RE
  667. .IP "\fB\-n\fR" 4
  668. .IX Item "-n"
  669. .PD 0
  670. .IP "\fB\-\-nmagic\fR" 4
  671. .IX Item "--nmagic"
  672. .PD
  673. Turn off page alignment of sections, and disable linking against shared
  674. libraries. If the output format supports Unix style magic numbers,
  675. mark the output as \f(CW\*(C`NMAGIC\*(C'\fR.
  676. .IP "\fB\-N\fR" 4
  677. .IX Item "-N"
  678. .PD 0
  679. .IP "\fB\-\-omagic\fR" 4
  680. .IX Item "--omagic"
  681. .PD
  682. Set the text and data sections to be readable and writable. Also, do
  683. not page-align the data segment, and disable linking against shared
  684. libraries. If the output format supports Unix style magic numbers,
  685. mark the output as \f(CW\*(C`OMAGIC\*(C'\fR. Note: Although a writable text section
  686. is allowed for PE-COFF targets, it does not conform to the format
  687. specification published by Microsoft.
  688. .IP "\fB\-\-no\-omagic\fR" 4
  689. .IX Item "--no-omagic"
  690. This option negates most of the effects of the \fB\-N\fR option. It
  691. sets the text section to be read-only, and forces the data segment to
  692. be page-aligned. Note \- this option does not enable linking against
  693. shared libraries. Use \fB\-Bdynamic\fR for this.
  694. .IP "\fB\-o\fR \fIoutput\fR" 4
  695. .IX Item "-o output"
  696. .PD 0
  697. .IP "\fB\-\-output=\fR\fIoutput\fR" 4
  698. .IX Item "--output=output"
  699. .PD
  700. Use \fIoutput\fR as the name for the program produced by \fBld\fR; if this
  701. option is not specified, the name \fIa.out\fR is used by default. The
  702. script command \f(CW\*(C`OUTPUT\*(C'\fR can also specify the output file name.
  703. .IP "\fB\-O\fR \fIlevel\fR" 4
  704. .IX Item "-O level"
  705. If \fIlevel\fR is a numeric values greater than zero \fBld\fR optimizes
  706. the output. This might take significantly longer and therefore probably
  707. should only be enabled for the final binary. At the moment this
  708. option only affects \s-1ELF\s0 shared library generation. Future releases of
  709. the linker may make more use of this option. Also currently there is
  710. no difference in the linker's behaviour for different non-zero values
  711. of this option. Again this may change with future releases.
  712. .IP "\fB\-plugin\fR \fIname\fR" 4
  713. .IX Item "-plugin name"
  714. Involve a plugin in the linking process. The \fIname\fR parameter is
  715. the absolute filename of the plugin. Usually this parameter is
  716. automatically added by the complier, when using link time
  717. optimization, but users can also add their own plugins if they so
  718. wish.
  719. .Sp
  720. Note that the location of the compiler originated plugins is different
  721. from the place where the \fBar\fR, \fBnm\fR and
  722. \&\fBranlib\fR programs search for their plugins. In order for
  723. those commands to make use of a compiler based plugin it must first be
  724. copied into the \fI${libdir}/bfd\-plugins\fR directory. All gcc
  725. based linker plugins are backward compatible, so it is sufficient to
  726. just copy in the newest one.
  727. .IP "\fB\-\-push\-state\fR" 4
  728. .IX Item "--push-state"
  729. The \fB\-\-push\-state\fR allows to preserve the current state of the
  730. flags which govern the input file handling so that they can all be
  731. restored with one corresponding \fB\-\-pop\-state\fR option.
  732. .Sp
  733. The option which are covered are: \fB\-Bdynamic\fR, \fB\-Bstatic\fR,
  734. \&\fB\-dn\fR, \fB\-dy\fR, \fB\-call_shared\fR, \fB\-non_shared\fR,
  735. \&\fB\-static\fR, \fB\-N\fR, \fB\-n\fR, \fB\-\-whole\-archive\fR,
  736. \&\fB\-\-no\-whole\-archive\fR, \fB\-r\fR, \fB\-Ur\fR,
  737. \&\fB\-\-copy\-dt\-needed\-entries\fR, \fB\-\-no\-copy\-dt\-needed\-entries\fR,
  738. \&\fB\-\-as\-needed\fR, \fB\-\-no\-as\-needed\fR, and \fB\-a\fR.
  739. .Sp
  740. One target for this option are specifications for \fIpkg-config\fR. When
  741. used with the \fB\-\-libs\fR option all possibly needed libraries are
  742. listed and then possibly linked with all the time. It is better to return
  743. something as follows:
  744. .Sp
  745. .Vb 1
  746. \& \-Wl,\-\-push\-state,\-\-as\-needed \-libone \-libtwo \-Wl,\-\-pop\-state
  747. .Ve
  748. .IP "\fB\-\-pop\-state\fR" 4
  749. .IX Item "--pop-state"
  750. Undoes the effect of \-\-push\-state, restores the previous values of the
  751. flags governing input file handling.
  752. .IP "\fB\-q\fR" 4
  753. .IX Item "-q"
  754. .PD 0
  755. .IP "\fB\-\-emit\-relocs\fR" 4
  756. .IX Item "--emit-relocs"
  757. .PD
  758. Leave relocation sections and contents in fully linked executables.
  759. Post link analysis and optimization tools may need this information in
  760. order to perform correct modifications of executables. This results
  761. in larger executables.
  762. .Sp
  763. This option is currently only supported on \s-1ELF\s0 platforms.
  764. .IP "\fB\-\-force\-dynamic\fR" 4
  765. .IX Item "--force-dynamic"
  766. Force the output file to have dynamic sections. This option is specific
  767. to VxWorks targets.
  768. .IP "\fB\-r\fR" 4
  769. .IX Item "-r"
  770. .PD 0
  771. .IP "\fB\-\-relocatable\fR" 4
  772. .IX Item "--relocatable"
  773. .PD
  774. Generate relocatable output\-\-\-i.e., generate an output file that can in
  775. turn serve as input to \fBld\fR. This is often called \fIpartial
  776. linking\fR. As a side effect, in environments that support standard Unix
  777. magic numbers, this option also sets the output file's magic number to
  778. \&\f(CW\*(C`OMAGIC\*(C'\fR.
  779. If this option is not specified, an absolute file is produced. When
  780. linking \*(C+ programs, this option \fIwill not\fR resolve references to
  781. constructors; to do that, use \fB\-Ur\fR.
  782. .Sp
  783. When an input file does not have the same format as the output file,
  784. partial linking is only supported if that input file does not contain any
  785. relocations. Different output formats can have further restrictions; for
  786. example some \f(CW\*(C`a.out\*(C'\fR\-based formats do not support partial linking
  787. with input files in other formats at all.
  788. .Sp
  789. This option does the same thing as \fB\-i\fR.
  790. .IP "\fB\-R\fR \fIfilename\fR" 4
  791. .IX Item "-R filename"
  792. .PD 0
  793. .IP "\fB\-\-just\-symbols=\fR\fIfilename\fR" 4
  794. .IX Item "--just-symbols=filename"
  795. .PD
  796. Read symbol names and their addresses from \fIfilename\fR, but do not
  797. relocate it or include it in the output. This allows your output file
  798. to refer symbolically to absolute locations of memory defined in other
  799. programs. You may use this option more than once.
  800. .Sp
  801. For compatibility with other \s-1ELF\s0 linkers, if the \fB\-R\fR option is
  802. followed by a directory name, rather than a file name, it is treated as
  803. the \fB\-rpath\fR option.
  804. .IP "\fB\-s\fR" 4
  805. .IX Item "-s"
  806. .PD 0
  807. .IP "\fB\-\-strip\-all\fR" 4
  808. .IX Item "--strip-all"
  809. .PD
  810. Omit all symbol information from the output file.
  811. .IP "\fB\-S\fR" 4
  812. .IX Item "-S"
  813. .PD 0
  814. .IP "\fB\-\-strip\-debug\fR" 4
  815. .IX Item "--strip-debug"
  816. .PD
  817. Omit debugger symbol information (but not all symbols) from the output file.
  818. .IP "\fB\-\-strip\-discarded\fR" 4
  819. .IX Item "--strip-discarded"
  820. .PD 0
  821. .IP "\fB\-\-no\-strip\-discarded\fR" 4
  822. .IX Item "--no-strip-discarded"
  823. .PD
  824. Omit (or do not omit) global symbols defined in discarded sections.
  825. Enabled by default.
  826. .IP "\fB\-t\fR" 4
  827. .IX Item "-t"
  828. .PD 0
  829. .IP "\fB\-\-trace\fR" 4
  830. .IX Item "--trace"
  831. .PD
  832. Print the names of the input files as \fBld\fR processes them. If
  833. \&\fB\-t\fR is given twice then members within archives are also printed.
  834. \&\fB\-t\fR output is useful to generate a list of all the object files
  835. and scripts involved in linking, for example, when packaging files for
  836. a linker bug report.
  837. .IP "\fB\-T\fR \fIscriptfile\fR" 4
  838. .IX Item "-T scriptfile"
  839. .PD 0
  840. .IP "\fB\-\-script=\fR\fIscriptfile\fR" 4
  841. .IX Item "--script=scriptfile"
  842. .PD
  843. Use \fIscriptfile\fR as the linker script. This script replaces
  844. \&\fBld\fR's default linker script (rather than adding to it), so
  845. \&\fIcommandfile\fR must specify everything necessary to describe the
  846. output file. If \fIscriptfile\fR does not exist in
  847. the current directory, \f(CW\*(C`ld\*(C'\fR looks for it in the directories
  848. specified by any preceding \fB\-L\fR options. Multiple \fB\-T\fR
  849. options accumulate.
  850. .IP "\fB\-dT\fR \fIscriptfile\fR" 4
  851. .IX Item "-dT scriptfile"
  852. .PD 0
  853. .IP "\fB\-\-default\-script=\fR\fIscriptfile\fR" 4
  854. .IX Item "--default-script=scriptfile"
  855. .PD
  856. Use \fIscriptfile\fR as the default linker script.
  857. .Sp
  858. This option is similar to the \fB\-\-script\fR option except that
  859. processing of the script is delayed until after the rest of the
  860. command line has been processed. This allows options placed after the
  861. \&\fB\-\-default\-script\fR option on the command line to affect the
  862. behaviour of the linker script, which can be important when the linker
  863. command line cannot be directly controlled by the user. (eg because
  864. the command line is being constructed by another tool, such as
  865. \&\fBgcc\fR).
  866. .IP "\fB\-u\fR \fIsymbol\fR" 4
  867. .IX Item "-u symbol"
  868. .PD 0
  869. .IP "\fB\-\-undefined=\fR\fIsymbol\fR" 4
  870. .IX Item "--undefined=symbol"
  871. .PD
  872. Force \fIsymbol\fR to be entered in the output file as an undefined
  873. symbol. Doing this may, for example, trigger linking of additional
  874. modules from standard libraries. \fB\-u\fR may be repeated with
  875. different option arguments to enter additional undefined symbols. This
  876. option is equivalent to the \f(CW\*(C`EXTERN\*(C'\fR linker script command.
  877. .Sp
  878. If this option is being used to force additional modules to be pulled
  879. into the link, and if it is an error for the symbol to remain
  880. undefined, then the option \fB\-\-require\-defined\fR should be used
  881. instead.
  882. .IP "\fB\-\-require\-defined=\fR\fIsymbol\fR" 4
  883. .IX Item "--require-defined=symbol"
  884. Require that \fIsymbol\fR is defined in the output file. This option
  885. is the same as option \fB\-\-undefined\fR except that if \fIsymbol\fR
  886. is not defined in the output file then the linker will issue an error
  887. and exit. The same effect can be achieved in a linker script by using
  888. \&\f(CW\*(C`EXTERN\*(C'\fR, \f(CW\*(C`ASSERT\*(C'\fR and \f(CW\*(C`DEFINED\*(C'\fR together. This option
  889. can be used multiple times to require additional symbols.
  890. .IP "\fB\-Ur\fR" 4
  891. .IX Item "-Ur"
  892. For anything other than \*(C+ programs, this option is equivalent to
  893. \&\fB\-r\fR: it generates relocatable output\-\-\-i.e., an output file that can in
  894. turn serve as input to \fBld\fR. When linking \*(C+ programs, \fB\-Ur\fR
  895. \&\fIdoes\fR resolve references to constructors, unlike \fB\-r\fR.
  896. It does not work to use \fB\-Ur\fR on files that were themselves linked
  897. with \fB\-Ur\fR; once the constructor table has been built, it cannot
  898. be added to. Use \fB\-Ur\fR only for the last partial link, and
  899. \&\fB\-r\fR for the others.
  900. .IP "\fB\-\-orphan\-handling=\fR\fI\s-1MODE\s0\fR" 4
  901. .IX Item "--orphan-handling=MODE"
  902. Control how orphan sections are handled. An orphan section is one not
  903. specifically mentioned in a linker script.
  904. .Sp
  905. \&\fI\s-1MODE\s0\fR can have any of the following values:
  906. .RS 4
  907. .ie n .IP """place""" 4
  908. .el .IP "\f(CWplace\fR" 4
  909. .IX Item "place"
  910. Orphan sections are placed into a suitable output section following
  911. the strategy described in \fBOrphan Sections\fR. The option
  912. \&\fB\-\-unique\fR also affects how sections are placed.
  913. .ie n .IP """discard""" 4
  914. .el .IP "\f(CWdiscard\fR" 4
  915. .IX Item "discard"
  916. All orphan sections are discarded, by placing them in the
  917. \&\fB/DISCARD/\fR section.
  918. .ie n .IP """warn""" 4
  919. .el .IP "\f(CWwarn\fR" 4
  920. .IX Item "warn"
  921. The linker will place the orphan section as for \f(CW\*(C`place\*(C'\fR and also
  922. issue a warning.
  923. .ie n .IP """error""" 4
  924. .el .IP "\f(CWerror\fR" 4
  925. .IX Item "error"
  926. The linker will exit with an error if any orphan section is found.
  927. .RE
  928. .RS 4
  929. .Sp
  930. The default if \fB\-\-orphan\-handling\fR is not given is \f(CW\*(C`place\*(C'\fR.
  931. .RE
  932. .IP "\fB\-\-unique[=\fR\fI\s-1SECTION\s0\fR\fB]\fR" 4
  933. .IX Item "--unique[=SECTION]"
  934. Creates a separate output section for every input section matching
  935. \&\fI\s-1SECTION\s0\fR, or if the optional wildcard \fI\s-1SECTION\s0\fR argument is
  936. missing, for every orphan input section. An orphan section is one not
  937. specifically mentioned in a linker script. You may use this option
  938. multiple times on the command line; It prevents the normal merging of
  939. input sections with the same name, overriding output section assignments
  940. in a linker script.
  941. .IP "\fB\-v\fR" 4
  942. .IX Item "-v"
  943. .PD 0
  944. .IP "\fB\-\-version\fR" 4
  945. .IX Item "--version"
  946. .IP "\fB\-V\fR" 4
  947. .IX Item "-V"
  948. .PD
  949. Display the version number for \fBld\fR. The \fB\-V\fR option also
  950. lists the supported emulations.
  951. .IP "\fB\-x\fR" 4
  952. .IX Item "-x"
  953. .PD 0
  954. .IP "\fB\-\-discard\-all\fR" 4
  955. .IX Item "--discard-all"
  956. .PD
  957. Delete all local symbols.
  958. .IP "\fB\-X\fR" 4
  959. .IX Item "-X"
  960. .PD 0
  961. .IP "\fB\-\-discard\-locals\fR" 4
  962. .IX Item "--discard-locals"
  963. .PD
  964. Delete all temporary local symbols. (These symbols start with
  965. system-specific local label prefixes, typically \fB.L\fR for \s-1ELF\s0 systems
  966. or \fBL\fR for traditional a.out systems.)
  967. .IP "\fB\-y\fR \fIsymbol\fR" 4
  968. .IX Item "-y symbol"
  969. .PD 0
  970. .IP "\fB\-\-trace\-symbol=\fR\fIsymbol\fR" 4
  971. .IX Item "--trace-symbol=symbol"
  972. .PD
  973. Print the name of each linked file in which \fIsymbol\fR appears. This
  974. option may be given any number of times. On many systems it is necessary
  975. to prepend an underscore.
  976. .Sp
  977. This option is useful when you have an undefined symbol in your link but
  978. don't know where the reference is coming from.
  979. .IP "\fB\-Y\fR \fIpath\fR" 4
  980. .IX Item "-Y path"
  981. Add \fIpath\fR to the default library search path. This option exists
  982. for Solaris compatibility.
  983. .IP "\fB\-z\fR \fIkeyword\fR" 4
  984. .IX Item "-z keyword"
  985. The recognized keywords are:
  986. .RS 4
  987. .IP "\fBbndplt\fR" 4
  988. .IX Item "bndplt"
  989. Always generate \s-1BND\s0 prefix in \s-1PLT\s0 entries. Supported for Linux/x86_64.
  990. .IP "\fBcall\-nop=prefix\-addr\fR" 4
  991. .IX Item "call-nop=prefix-addr"
  992. .PD 0
  993. .IP "\fBcall\-nop=suffix\-nop\fR" 4
  994. .IX Item "call-nop=suffix-nop"
  995. .IP "\fBcall\-nop=prefix\-\fR\fIbyte\fR" 4
  996. .IX Item "call-nop=prefix-byte"
  997. .IP "\fBcall\-nop=suffix\-\fR\fIbyte\fR" 4
  998. .IX Item "call-nop=suffix-byte"
  999. .PD
  1000. Specify the 1\-byte \f(CW\*(C`NOP\*(C'\fR padding when transforming indirect call
  1001. to a locally defined function, foo, via its \s-1GOT\s0 slot.
  1002. \&\fBcall\-nop=prefix\-addr\fR generates \f(CW\*(C`0x67 call foo\*(C'\fR.
  1003. \&\fBcall\-nop=suffix\-nop\fR generates \f(CW\*(C`call foo 0x90\*(C'\fR.
  1004. \&\fBcall\-nop=prefix\-\fR\fIbyte\fR generates \f(CW\*(C`\f(CIbyte\f(CW call foo\*(C'\fR.
  1005. \&\fBcall\-nop=suffix\-\fR\fIbyte\fR generates \f(CW\*(C`call foo \f(CIbyte\f(CW\*(C'\fR.
  1006. Supported for i386 and x86_64.
  1007. .IP "\fBcombreloc\fR" 4
  1008. .IX Item "combreloc"
  1009. .PD 0
  1010. .IP "\fBnocombreloc\fR" 4
  1011. .IX Item "nocombreloc"
  1012. .PD
  1013. Combine multiple dynamic relocation sections and sort to improve
  1014. dynamic symbol lookup caching. Do not do this if \fBnocombreloc\fR.
  1015. .IP "\fBcommon\fR" 4
  1016. .IX Item "common"
  1017. .PD 0
  1018. .IP "\fBnocommon\fR" 4
  1019. .IX Item "nocommon"
  1020. .PD
  1021. Generate common symbols with \s-1STT_COMMON\s0 type during a relocatable
  1022. link. Use \s-1STT_OBJECT\s0 type if \fBnocommon\fR.
  1023. .IP "\fBcommon\-page\-size=\fR\fIvalue\fR" 4
  1024. .IX Item "common-page-size=value"
  1025. Set the page size most commonly used to \fIvalue\fR. Memory image
  1026. layout will be optimized to minimize memory pages if the system is
  1027. using pages of this size.
  1028. .IP "\fBdefs\fR" 4
  1029. .IX Item "defs"
  1030. Report unresolved symbol references from regular object files. This
  1031. is done even if the linker is creating a non-symbolic shared library.
  1032. This option is the inverse of \fB\-z undefs\fR.
  1033. .IP "\fBdynamic-undefined-weak\fR" 4
  1034. .IX Item "dynamic-undefined-weak"
  1035. .PD 0
  1036. .IP "\fBnodynamic-undefined-weak\fR" 4
  1037. .IX Item "nodynamic-undefined-weak"
  1038. .PD
  1039. Make undefined weak symbols dynamic when building a dynamic object,
  1040. if they are referenced from a regular object file and not forced local
  1041. by symbol visibility or versioning. Do not make them dynamic if
  1042. \&\fBnodynamic-undefined-weak\fR. If neither option is given, a target
  1043. may default to either option being in force, or make some other
  1044. selection of undefined weak symbols dynamic. Not all targets support
  1045. these options.
  1046. .IP "\fBexecstack\fR" 4
  1047. .IX Item "execstack"
  1048. Marks the object as requiring executable stack.
  1049. .IP "\fBglobal\fR" 4
  1050. .IX Item "global"
  1051. This option is only meaningful when building a shared object. It makes
  1052. the symbols defined by this shared object available for symbol resolution
  1053. of subsequently loaded libraries.
  1054. .IP "\fBglobalaudit\fR" 4
  1055. .IX Item "globalaudit"
  1056. This option is only meaningful when building a dynamic executable.
  1057. This option marks the executable as requiring global auditing by
  1058. setting the \f(CW\*(C`DF_1_GLOBAUDIT\*(C'\fR bit in the \f(CW\*(C`DT_FLAGS_1\*(C'\fR dynamic
  1059. tag. Global auditing requires that any auditing library defined via
  1060. the \fB\-\-depaudit\fR or \fB\-P\fR command-line options be run for
  1061. all dynamic objects loaded by the application.
  1062. .IP "\fBibtplt\fR" 4
  1063. .IX Item "ibtplt"
  1064. Generate Intel Indirect Branch Tracking (\s-1IBT\s0) enabled \s-1PLT\s0 entries.
  1065. Supported for Linux/i386 and Linux/x86_64.
  1066. .IP "\fBibt\fR" 4
  1067. .IX Item "ibt"
  1068. Generate \s-1GNU_PROPERTY_X86_FEATURE_1_IBT\s0 in .note.gnu.property section
  1069. to indicate compatibility with \s-1IBT.\s0 This also implies \fBibtplt\fR.
  1070. Supported for Linux/i386 and Linux/x86_64.
  1071. .IP "\fBinitfirst\fR" 4
  1072. .IX Item "initfirst"
  1073. This option is only meaningful when building a shared object.
  1074. It marks the object so that its runtime initialization will occur
  1075. before the runtime initialization of any other objects brought into
  1076. the process at the same time. Similarly the runtime finalization of
  1077. the object will occur after the runtime finalization of any other
  1078. objects.
  1079. .IP "\fBinterpose\fR" 4
  1080. .IX Item "interpose"
  1081. Specify that the dynamic loader should modify its symbol search order
  1082. so that symbols in this shared library interpose all other shared
  1083. libraries not so marked.
  1084. .IP "\fBlazy\fR" 4
  1085. .IX Item "lazy"
  1086. When generating an executable or shared library, mark it to tell the
  1087. dynamic linker to defer function call resolution to the point when
  1088. the function is called (lazy binding), rather than at load time.
  1089. Lazy binding is the default.
  1090. .IP "\fBloadfltr\fR" 4
  1091. .IX Item "loadfltr"
  1092. Specify that the object's filters be processed immediately at runtime.
  1093. .IP "\fBmax\-page\-size=\fR\fIvalue\fR" 4
  1094. .IX Item "max-page-size=value"
  1095. Set the maximum memory page size supported to \fIvalue\fR.
  1096. .IP "\fBmuldefs\fR" 4
  1097. .IX Item "muldefs"
  1098. Allow multiple definitions.
  1099. .IP "\fBnocopyreloc\fR" 4
  1100. .IX Item "nocopyreloc"
  1101. Disable linker generated .dynbss variables used in place of variables
  1102. defined in shared libraries. May result in dynamic text relocations.
  1103. .IP "\fBnodefaultlib\fR" 4
  1104. .IX Item "nodefaultlib"
  1105. Specify that the dynamic loader search for dependencies of this object
  1106. should ignore any default library search paths.
  1107. .IP "\fBnodelete\fR" 4
  1108. .IX Item "nodelete"
  1109. Specify that the object shouldn't be unloaded at runtime.
  1110. .IP "\fBnodlopen\fR" 4
  1111. .IX Item "nodlopen"
  1112. Specify that the object is not available to \f(CW\*(C`dlopen\*(C'\fR.
  1113. .IP "\fBnodump\fR" 4
  1114. .IX Item "nodump"
  1115. Specify that the object can not be dumped by \f(CW\*(C`dldump\*(C'\fR.
  1116. .IP "\fBnoexecstack\fR" 4
  1117. .IX Item "noexecstack"
  1118. Marks the object as not requiring executable stack.
  1119. .IP "\fBnoextern-protected-data\fR" 4
  1120. .IX Item "noextern-protected-data"
  1121. Don't treat protected data symbols as external when building a shared
  1122. library. This option overrides the linker backend default. It can be
  1123. used to work around incorrect relocations against protected data symbols
  1124. generated by compiler. Updates on protected data symbols by another
  1125. module aren't visible to the resulting shared library. Supported for
  1126. i386 and x86\-64.
  1127. .IP "\fBnoreloc-overflow\fR" 4
  1128. .IX Item "noreloc-overflow"
  1129. Disable relocation overflow check. This can be used to disable
  1130. relocation overflow check if there will be no dynamic relocation
  1131. overflow at run-time. Supported for x86_64.
  1132. .IP "\fBnow\fR" 4
  1133. .IX Item "now"
  1134. When generating an executable or shared library, mark it to tell the
  1135. dynamic linker to resolve all symbols when the program is started, or
  1136. when the shared library is loaded by dlopen, instead of deferring
  1137. function call resolution to the point when the function is first
  1138. called.
  1139. .IP "\fBorigin\fR" 4
  1140. .IX Item "origin"
  1141. Specify that the object requires \fB\f(CB$ORIGIN\fB\fR handling in paths.
  1142. .IP "\fBrelro\fR" 4
  1143. .IX Item "relro"
  1144. .PD 0
  1145. .IP "\fBnorelro\fR" 4
  1146. .IX Item "norelro"
  1147. .PD
  1148. Create an \s-1ELF\s0 \f(CW\*(C`PT_GNU_RELRO\*(C'\fR segment header in the object. This
  1149. specifies a memory segment that should be made read-only after
  1150. relocation, if supported. Specifying \fBcommon-page-size\fR smaller
  1151. than the system page size will render this protection ineffective.
  1152. Don't create an \s-1ELF\s0 \f(CW\*(C`PT_GNU_RELRO\*(C'\fR segment if \fBnorelro\fR.
  1153. .IP "\fBseparate-code\fR" 4
  1154. .IX Item "separate-code"
  1155. .PD 0
  1156. .IP "\fBnoseparate-code\fR" 4
  1157. .IX Item "noseparate-code"
  1158. .PD
  1159. Create separate code \f(CW\*(C`PT_LOAD\*(C'\fR segment header in the object. This
  1160. specifies a memory segment that should contain only instructions and must
  1161. be in wholly disjoint pages from any other data. Don't create separate
  1162. code \f(CW\*(C`PT_LOAD\*(C'\fR segment if \fBnoseparate-code\fR is used.
  1163. .IP "\fBshstk\fR" 4
  1164. .IX Item "shstk"
  1165. Generate \s-1GNU_PROPERTY_X86_FEATURE_1_SHSTK\s0 in .note.gnu.property section
  1166. to indicate compatibility with Intel Shadow Stack. Supported for
  1167. Linux/i386 and Linux/x86_64.
  1168. .IP "\fBstack\-size=\fR\fIvalue\fR" 4
  1169. .IX Item "stack-size=value"
  1170. Specify a stack size for an \s-1ELF\s0 \f(CW\*(C`PT_GNU_STACK\*(C'\fR segment.
  1171. Specifying zero will override any default non-zero sized
  1172. \&\f(CW\*(C`PT_GNU_STACK\*(C'\fR segment creation.
  1173. .IP "\fBtext\fR" 4
  1174. .IX Item "text"
  1175. .PD 0
  1176. .IP "\fBnotext\fR" 4
  1177. .IX Item "notext"
  1178. .IP "\fBtextoff\fR" 4
  1179. .IX Item "textoff"
  1180. .PD
  1181. Report an error if \s-1DT_TEXTREL\s0 is set, i.e., if the binary has dynamic
  1182. relocations in read-only sections. Don't report an error if
  1183. \&\fBnotext\fR or \fBtextoff\fR.
  1184. .IP "\fBundefs\fR" 4
  1185. .IX Item "undefs"
  1186. Do not report unresolved symbol references from regular object files,
  1187. either when creating an executable, or when creating a shared library.
  1188. This option is the inverse of \fB\-z defs\fR.
  1189. .RE
  1190. .RS 4
  1191. .Sp
  1192. Other keywords are ignored for Solaris compatibility.
  1193. .RE
  1194. .IP "\fB\-(\fR \fIarchives\fR \fB\-)\fR" 4
  1195. .IX Item "-( archives -)"
  1196. .PD 0
  1197. .IP "\fB\-\-start\-group\fR \fIarchives\fR \fB\-\-end\-group\fR" 4
  1198. .IX Item "--start-group archives --end-group"
  1199. .PD
  1200. The \fIarchives\fR should be a list of archive files. They may be
  1201. either explicit file names, or \fB\-l\fR options.
  1202. .Sp
  1203. The specified archives are searched repeatedly until no new undefined
  1204. references are created. Normally, an archive is searched only once in
  1205. the order that it is specified on the command line. If a symbol in that
  1206. archive is needed to resolve an undefined symbol referred to by an
  1207. object in an archive that appears later on the command line, the linker
  1208. would not be able to resolve that reference. By grouping the archives,
  1209. they all be searched repeatedly until all possible references are
  1210. resolved.
  1211. .Sp
  1212. Using this option has a significant performance cost. It is best to use
  1213. it only when there are unavoidable circular references between two or
  1214. more archives.
  1215. .IP "\fB\-\-accept\-unknown\-input\-arch\fR" 4
  1216. .IX Item "--accept-unknown-input-arch"
  1217. .PD 0
  1218. .IP "\fB\-\-no\-accept\-unknown\-input\-arch\fR" 4
  1219. .IX Item "--no-accept-unknown-input-arch"
  1220. .PD
  1221. Tells the linker to accept input files whose architecture cannot be
  1222. recognised. The assumption is that the user knows what they are doing
  1223. and deliberately wants to link in these unknown input files. This was
  1224. the default behaviour of the linker, before release 2.14. The default
  1225. behaviour from release 2.14 onwards is to reject such input files, and
  1226. so the \fB\-\-accept\-unknown\-input\-arch\fR option has been added to
  1227. restore the old behaviour.
  1228. .IP "\fB\-\-as\-needed\fR" 4
  1229. .IX Item "--as-needed"
  1230. .PD 0
  1231. .IP "\fB\-\-no\-as\-needed\fR" 4
  1232. .IX Item "--no-as-needed"
  1233. .PD
  1234. This option affects \s-1ELF DT_NEEDED\s0 tags for dynamic libraries mentioned
  1235. on the command line after the \fB\-\-as\-needed\fR option. Normally
  1236. the linker will add a \s-1DT_NEEDED\s0 tag for each dynamic library mentioned
  1237. on the command line, regardless of whether the library is actually
  1238. needed or not. \fB\-\-as\-needed\fR causes a \s-1DT_NEEDED\s0 tag to only be
  1239. emitted for a library that \fIat that point in the link\fR satisfies a
  1240. non-weak undefined symbol reference from a regular object file or, if
  1241. the library is not found in the \s-1DT_NEEDED\s0 lists of other needed libraries, a
  1242. non-weak undefined symbol reference from another needed dynamic library.
  1243. Object files or libraries appearing on the command line \fIafter\fR
  1244. the library in question do not affect whether the library is seen as
  1245. needed. This is similar to the rules for extraction of object files
  1246. from archives. \fB\-\-no\-as\-needed\fR restores the default behaviour.
  1247. .IP "\fB\-\-add\-needed\fR" 4
  1248. .IX Item "--add-needed"
  1249. .PD 0
  1250. .IP "\fB\-\-no\-add\-needed\fR" 4
  1251. .IX Item "--no-add-needed"
  1252. .PD
  1253. These two options have been deprecated because of the similarity of
  1254. their names to the \fB\-\-as\-needed\fR and \fB\-\-no\-as\-needed\fR
  1255. options. They have been replaced by \fB\-\-copy\-dt\-needed\-entries\fR
  1256. and \fB\-\-no\-copy\-dt\-needed\-entries\fR.
  1257. .IP "\fB\-assert\fR \fIkeyword\fR" 4
  1258. .IX Item "-assert keyword"
  1259. This option is ignored for SunOS compatibility.
  1260. .IP "\fB\-Bdynamic\fR" 4
  1261. .IX Item "-Bdynamic"
  1262. .PD 0
  1263. .IP "\fB\-dy\fR" 4
  1264. .IX Item "-dy"
  1265. .IP "\fB\-call_shared\fR" 4
  1266. .IX Item "-call_shared"
  1267. .PD
  1268. Link against dynamic libraries. This is only meaningful on platforms
  1269. for which shared libraries are supported. This option is normally the
  1270. default on such platforms. The different variants of this option are
  1271. for compatibility with various systems. You may use this option
  1272. multiple times on the command line: it affects library searching for
  1273. \&\fB\-l\fR options which follow it.
  1274. .IP "\fB\-Bgroup\fR" 4
  1275. .IX Item "-Bgroup"
  1276. 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
  1277. section. This causes the runtime linker to handle lookups in this
  1278. object and its dependencies to be performed only inside the group.
  1279. \&\fB\-\-unresolved\-symbols=report\-all\fR is implied. This option is
  1280. only meaningful on \s-1ELF\s0 platforms which support shared libraries.
  1281. .IP "\fB\-Bstatic\fR" 4
  1282. .IX Item "-Bstatic"
  1283. .PD 0
  1284. .IP "\fB\-dn\fR" 4
  1285. .IX Item "-dn"
  1286. .IP "\fB\-non_shared\fR" 4
  1287. .IX Item "-non_shared"
  1288. .IP "\fB\-static\fR" 4
  1289. .IX Item "-static"
  1290. .PD
  1291. Do not link against shared libraries. This is only meaningful on
  1292. platforms for which shared libraries are supported. The different
  1293. variants of this option are for compatibility with various systems. You
  1294. may use this option multiple times on the command line: it affects
  1295. library searching for \fB\-l\fR options which follow it. This
  1296. option also implies \fB\-\-unresolved\-symbols=report\-all\fR. This
  1297. option can be used with \fB\-shared\fR. Doing so means that a
  1298. shared library is being created but that all of the library's external
  1299. references must be resolved by pulling in entries from static
  1300. libraries.
  1301. .IP "\fB\-Bsymbolic\fR" 4
  1302. .IX Item "-Bsymbolic"
  1303. When creating a shared library, bind references to global symbols to the
  1304. definition within the shared library, if any. Normally, it is possible
  1305. for a program linked against a shared library to override the definition
  1306. within the shared library. This option can also be used with the
  1307. \&\fB\-\-export\-dynamic\fR option, when creating a position independent
  1308. executable, to bind references to global symbols to the definition within
  1309. the executable. This option is only meaningful on \s-1ELF\s0 platforms which
  1310. support shared libraries and position independent executables.
  1311. .IP "\fB\-Bsymbolic\-functions\fR" 4
  1312. .IX Item "-Bsymbolic-functions"
  1313. When creating a shared library, bind references to global function
  1314. symbols to the definition within the shared library, if any.
  1315. This option can also be used with the \fB\-\-export\-dynamic\fR option,
  1316. when creating a position independent executable, to bind references
  1317. to global function symbols to the definition within the executable.
  1318. This option is only meaningful on \s-1ELF\s0 platforms which support shared
  1319. libraries and position independent executables.
  1320. .IP "\fB\-\-dynamic\-list=\fR\fIdynamic-list-file\fR" 4
  1321. .IX Item "--dynamic-list=dynamic-list-file"
  1322. Specify the name of a dynamic list file to the linker. This is
  1323. typically used when creating shared libraries to specify a list of
  1324. global symbols whose references shouldn't be bound to the definition
  1325. within the shared library, or creating dynamically linked executables
  1326. to specify a list of symbols which should be added to the symbol table
  1327. in the executable. This option is only meaningful on \s-1ELF\s0 platforms
  1328. which support shared libraries.
  1329. .Sp
  1330. The format of the dynamic list is the same as the version node without
  1331. scope and node name. See \fB\s-1VERSION\s0\fR for more information.
  1332. .IP "\fB\-\-dynamic\-list\-data\fR" 4
  1333. .IX Item "--dynamic-list-data"
  1334. Include all global data symbols to the dynamic list.
  1335. .IP "\fB\-\-dynamic\-list\-cpp\-new\fR" 4
  1336. .IX Item "--dynamic-list-cpp-new"
  1337. Provide the builtin dynamic list for \*(C+ operator new and delete. It
  1338. is mainly useful for building shared libstdc++.
  1339. .IP "\fB\-\-dynamic\-list\-cpp\-typeinfo\fR" 4
  1340. .IX Item "--dynamic-list-cpp-typeinfo"
  1341. Provide the builtin dynamic list for \*(C+ runtime type identification.
  1342. .IP "\fB\-\-check\-sections\fR" 4
  1343. .IX Item "--check-sections"
  1344. .PD 0
  1345. .IP "\fB\-\-no\-check\-sections\fR" 4
  1346. .IX Item "--no-check-sections"
  1347. .PD
  1348. Asks the linker \fInot\fR to check section addresses after they have
  1349. been assigned to see if there are any overlaps. Normally the linker will
  1350. perform this check, and if it finds any overlaps it will produce
  1351. suitable error messages. The linker does know about, and does make
  1352. allowances for sections in overlays. The default behaviour can be
  1353. restored by using the command-line switch \fB\-\-check\-sections\fR.
  1354. Section overlap is not usually checked for relocatable links. You can
  1355. force checking in that case by using the \fB\-\-check\-sections\fR
  1356. option.
  1357. .IP "\fB\-\-copy\-dt\-needed\-entries\fR" 4
  1358. .IX Item "--copy-dt-needed-entries"
  1359. .PD 0
  1360. .IP "\fB\-\-no\-copy\-dt\-needed\-entries\fR" 4
  1361. .IX Item "--no-copy-dt-needed-entries"
  1362. .PD
  1363. This option affects the treatment of dynamic libraries referred to
  1364. by \s-1DT_NEEDED\s0 tags \fIinside\fR \s-1ELF\s0 dynamic libraries mentioned on the
  1365. command line. Normally the linker won't add a \s-1DT_NEEDED\s0 tag to the
  1366. output binary for each library mentioned in a \s-1DT_NEEDED\s0 tag in an
  1367. input dynamic library. With \fB\-\-copy\-dt\-needed\-entries\fR
  1368. specified on the command line however any dynamic libraries that
  1369. follow it will have their \s-1DT_NEEDED\s0 entries added. The default
  1370. behaviour can be restored with \fB\-\-no\-copy\-dt\-needed\-entries\fR.
  1371. .Sp
  1372. This option also has an effect on the resolution of symbols in dynamic
  1373. libraries. With \fB\-\-copy\-dt\-needed\-entries\fR dynamic libraries
  1374. mentioned on the command line will be recursively searched, following
  1375. their \s-1DT_NEEDED\s0 tags to other libraries, in order to resolve symbols
  1376. required by the output binary. With the default setting however
  1377. the searching of dynamic libraries that follow it will stop with the
  1378. dynamic library itself. No \s-1DT_NEEDED\s0 links will be traversed to resolve
  1379. symbols.
  1380. .IP "\fB\-\-cref\fR" 4
  1381. .IX Item "--cref"
  1382. Output a cross reference table. If a linker map file is being
  1383. generated, the cross reference table is printed to the map file.
  1384. Otherwise, it is printed on the standard output.
  1385. .Sp
  1386. The format of the table is intentionally simple, so that it may be
  1387. easily processed by a script if necessary. The symbols are printed out,
  1388. sorted by name. For each symbol, a list of file names is given. If the
  1389. symbol is defined, the first file listed is the location of the
  1390. definition. If the symbol is defined as a common value then any files
  1391. where this happens appear next. Finally any files that reference the
  1392. symbol are listed.
  1393. .IP "\fB\-\-no\-define\-common\fR" 4
  1394. .IX Item "--no-define-common"
  1395. This option inhibits the assignment of addresses to common symbols.
  1396. The script command \f(CW\*(C`INHIBIT_COMMON_ALLOCATION\*(C'\fR has the same effect.
  1397. .Sp
  1398. The \fB\-\-no\-define\-common\fR option allows decoupling
  1399. the decision to assign addresses to Common symbols from the choice
  1400. of the output file type; otherwise a non-Relocatable output type
  1401. forces assigning addresses to Common symbols.
  1402. Using \fB\-\-no\-define\-common\fR allows Common symbols that are referenced
  1403. from a shared library to be assigned addresses only in the main program.
  1404. This eliminates the unused duplicate space in the shared library,
  1405. and also prevents any possible confusion over resolving to the wrong
  1406. duplicate when there are many dynamic modules with specialized search
  1407. paths for runtime symbol resolution.
  1408. .IP "\fB\-\-force\-group\-allocation\fR" 4
  1409. .IX Item "--force-group-allocation"
  1410. This option causes the linker to place section group members like
  1411. normal input sections, and to delete the section groups. This is the
  1412. default behaviour for a final link but this option can be used to
  1413. change the behaviour of a relocatable link (\fB\-r\fR). The script
  1414. command \f(CW\*(C`FORCE_GROUP_ALLOCATION\*(C'\fR has the same
  1415. effect.
  1416. .IP "\fB\-\-defsym=\fR\fIsymbol\fR\fB=\fR\fIexpression\fR" 4
  1417. .IX Item "--defsym=symbol=expression"
  1418. Create a global symbol in the output file, containing the absolute
  1419. address given by \fIexpression\fR. You may use this option as many
  1420. times as necessary to define multiple symbols in the command line. A
  1421. limited form of arithmetic is supported for the \fIexpression\fR in this
  1422. context: you may give a hexadecimal constant or the name of an existing
  1423. symbol, or use \f(CW\*(C`+\*(C'\fR and \f(CW\*(C`\-\*(C'\fR to add or subtract hexadecimal
  1424. constants or symbols. If you need more elaborate expressions, consider
  1425. using the linker command language from a script.
  1426. \&\fINote:\fR there should be no white space between \fIsymbol\fR, the
  1427. equals sign ("\fB=\fR"), and \fIexpression\fR.
  1428. .IP "\fB\-\-demangle[=\fR\fIstyle\fR\fB]\fR" 4
  1429. .IX Item "--demangle[=style]"
  1430. .PD 0
  1431. .IP "\fB\-\-no\-demangle\fR" 4
  1432. .IX Item "--no-demangle"
  1433. .PD
  1434. These options control whether to demangle symbol names in error messages
  1435. and other output. When the linker is told to demangle, it tries to
  1436. present symbol names in a readable fashion: it strips leading
  1437. underscores if they are used by the object file format, and converts \*(C+
  1438. mangled symbol names into user readable names. Different compilers have
  1439. different mangling styles. The optional demangling style argument can be used
  1440. to choose an appropriate demangling style for your compiler. The linker will
  1441. demangle by default unless the environment variable \fB\s-1COLLECT_NO_DEMANGLE\s0\fR
  1442. is set. These options may be used to override the default.
  1443. .IP "\fB\-I\fR\fIfile\fR" 4
  1444. .IX Item "-Ifile"
  1445. .PD 0
  1446. .IP "\fB\-\-dynamic\-linker=\fR\fIfile\fR" 4
  1447. .IX Item "--dynamic-linker=file"
  1448. .PD
  1449. Set the name of the dynamic linker. This is only meaningful when
  1450. generating dynamically linked \s-1ELF\s0 executables. The default dynamic
  1451. linker is normally correct; don't use this unless you know what you are
  1452. doing.
  1453. .IP "\fB\-\-no\-dynamic\-linker\fR" 4
  1454. .IX Item "--no-dynamic-linker"
  1455. When producing an executable file, omit the request for a dynamic
  1456. linker to be used at load-time. This is only meaningful for \s-1ELF\s0
  1457. executables that contain dynamic relocations, and usually requires
  1458. entry point code that is capable of processing these relocations.
  1459. .IP "\fB\-\-embedded\-relocs\fR" 4
  1460. .IX Item "--embedded-relocs"
  1461. This option is similar to the \fB\-\-emit\-relocs\fR option except
  1462. that the relocs are stored in a target specific section. This option
  1463. is only supported by the \fB\s-1BFIN\s0\fR, \fB\s-1CR16\s0\fR and \fIM68K\fR
  1464. targets.
  1465. .IP "\fB\-\-disable\-multiple\-abs\-defs\fR" 4
  1466. .IX Item "--disable-multiple-abs-defs"
  1467. Do not allow multiple definitions with symbols included
  1468. in filename invoked by \-R or \-\-just\-symbols
  1469. .IP "\fB\-\-fatal\-warnings\fR" 4
  1470. .IX Item "--fatal-warnings"
  1471. .PD 0
  1472. .IP "\fB\-\-no\-fatal\-warnings\fR" 4
  1473. .IX Item "--no-fatal-warnings"
  1474. .PD
  1475. Treat all warnings as errors. The default behaviour can be restored
  1476. with the option \fB\-\-no\-fatal\-warnings\fR.
  1477. .IP "\fB\-\-force\-exe\-suffix\fR" 4
  1478. .IX Item "--force-exe-suffix"
  1479. Make sure that an output file has a .exe suffix.
  1480. .Sp
  1481. If a successfully built fully linked output file does not have a
  1482. \&\f(CW\*(C`.exe\*(C'\fR or \f(CW\*(C`.dll\*(C'\fR suffix, this option forces the linker to copy
  1483. the output file to one of the same name with a \f(CW\*(C`.exe\*(C'\fR suffix. This
  1484. option is useful when using unmodified Unix makefiles on a Microsoft
  1485. Windows host, since some versions of Windows won't run an image unless
  1486. it ends in a \f(CW\*(C`.exe\*(C'\fR suffix.
  1487. .IP "\fB\-\-gc\-sections\fR" 4
  1488. .IX Item "--gc-sections"
  1489. .PD 0
  1490. .IP "\fB\-\-no\-gc\-sections\fR" 4
  1491. .IX Item "--no-gc-sections"
  1492. .PD
  1493. Enable garbage collection of unused input sections. It is ignored on
  1494. targets that do not support this option. The default behaviour (of not
  1495. performing this garbage collection) can be restored by specifying
  1496. \&\fB\-\-no\-gc\-sections\fR on the command line. Note that garbage
  1497. collection for \s-1COFF\s0 and \s-1PE\s0 format targets is supported, but the
  1498. implementation is currently considered to be experimental.
  1499. .Sp
  1500. \&\fB\-\-gc\-sections\fR decides which input sections are used by
  1501. examining symbols and relocations. The section containing the entry
  1502. symbol and all sections containing symbols undefined on the
  1503. command-line will be kept, as will sections containing symbols
  1504. referenced by dynamic objects. Note that when building shared
  1505. libraries, the linker must assume that any visible symbol is
  1506. referenced. Once this initial set of sections has been determined,
  1507. the linker recursively marks as used any section referenced by their
  1508. relocations. See \fB\-\-entry\fR, \fB\-\-undefined\fR, and
  1509. \&\fB\-\-gc\-keep\-exported\fR.
  1510. .Sp
  1511. This option can be set when doing a partial link (enabled with option
  1512. \&\fB\-r\fR). In this case the root of symbols kept must be explicitly
  1513. specified either by one of the options \fB\-\-entry\fR,
  1514. \&\fB\-\-undefined\fR, or \fB\-\-gc\-keep\-exported\fR or by a \f(CW\*(C`ENTRY\*(C'\fR
  1515. command in the linker script.
  1516. .IP "\fB\-\-print\-gc\-sections\fR" 4
  1517. .IX Item "--print-gc-sections"
  1518. .PD 0
  1519. .IP "\fB\-\-no\-print\-gc\-sections\fR" 4
  1520. .IX Item "--no-print-gc-sections"
  1521. .PD
  1522. List all sections removed by garbage collection. The listing is
  1523. printed on stderr. This option is only effective if garbage
  1524. collection has been enabled via the \fB\-\-gc\-sections\fR) option. The
  1525. default behaviour (of not listing the sections that are removed) can
  1526. be restored by specifying \fB\-\-no\-print\-gc\-sections\fR on the command
  1527. line.
  1528. .IP "\fB\-\-gc\-keep\-exported\fR" 4
  1529. .IX Item "--gc-keep-exported"
  1530. When \fB\-\-gc\-sections\fR is enabled, this option prevents garbage
  1531. collection of unused input sections that contain global symbols having
  1532. default or protected visibility. This option is intended to be used for
  1533. executables where unreferenced sections would otherwise be garbage
  1534. collected regardless of the external visibility of contained symbols.
  1535. Note that this option has no effect when linking shared objects since
  1536. it is already the default behaviour. This option is only supported for
  1537. \&\s-1ELF\s0 format targets.
  1538. .IP "\fB\-\-print\-output\-format\fR" 4
  1539. .IX Item "--print-output-format"
  1540. Print the name of the default output format (perhaps influenced by
  1541. other command-line options). This is the string that would appear
  1542. in an \f(CW\*(C`OUTPUT_FORMAT\*(C'\fR linker script command.
  1543. .IP "\fB\-\-print\-memory\-usage\fR" 4
  1544. .IX Item "--print-memory-usage"
  1545. Print used size, total size and used size of memory regions created with
  1546. the \fB\s-1MEMORY\s0\fR command. This is useful on embedded targets to have a
  1547. quick view of amount of free memory. The format of the output has one
  1548. headline and one line per region. It is both human readable and easily
  1549. parsable by tools. Here is an example of an output:
  1550. .Sp
  1551. .Vb 3
  1552. \& Memory region Used Size Region Size %age Used
  1553. \& ROM: 256 KB 1 MB 25.00%
  1554. \& RAM: 32 B 2 GB 0.00%
  1555. .Ve
  1556. .IP "\fB\-\-help\fR" 4
  1557. .IX Item "--help"
  1558. Print a summary of the command-line options on the standard output and exit.
  1559. .IP "\fB\-\-target\-help\fR" 4
  1560. .IX Item "--target-help"
  1561. Print a summary of all target specific options on the standard output and exit.
  1562. .IP "\fB\-Map=\fR\fImapfile\fR" 4
  1563. .IX Item "-Map=mapfile"
  1564. Print a link map to the file \fImapfile\fR. See the description of the
  1565. \&\fB\-M\fR option, above.
  1566. .IP "\fB\-\-no\-keep\-memory\fR" 4
  1567. .IX Item "--no-keep-memory"
  1568. \&\fBld\fR normally optimizes for speed over memory usage by caching the
  1569. symbol tables of input files in memory. This option tells \fBld\fR to
  1570. instead optimize for memory usage, by rereading the symbol tables as
  1571. necessary. This may be required if \fBld\fR runs out of memory space
  1572. while linking a large executable.
  1573. .IP "\fB\-\-no\-undefined\fR" 4
  1574. .IX Item "--no-undefined"
  1575. .PD 0
  1576. .IP "\fB\-z defs\fR" 4
  1577. .IX Item "-z defs"
  1578. .PD
  1579. Report unresolved symbol references from regular object files. This
  1580. is done even if the linker is creating a non-symbolic shared library.
  1581. The switch \fB\-\-[no\-]allow\-shlib\-undefined\fR controls the
  1582. behaviour for reporting unresolved references found in shared
  1583. libraries being linked in.
  1584. .Sp
  1585. The effects of this option can be reverted by using \f(CW\*(C`\-z undefs\*(C'\fR.
  1586. .IP "\fB\-\-allow\-multiple\-definition\fR" 4
  1587. .IX Item "--allow-multiple-definition"
  1588. .PD 0
  1589. .IP "\fB\-z muldefs\fR" 4
  1590. .IX Item "-z muldefs"
  1591. .PD
  1592. Normally when a symbol is defined multiple times, the linker will
  1593. report a fatal error. These options allow multiple definitions and the
  1594. first definition will be used.
  1595. .IP "\fB\-\-allow\-shlib\-undefined\fR" 4
  1596. .IX Item "--allow-shlib-undefined"
  1597. .PD 0
  1598. .IP "\fB\-\-no\-allow\-shlib\-undefined\fR" 4
  1599. .IX Item "--no-allow-shlib-undefined"
  1600. .PD
  1601. Allows or disallows undefined symbols in shared libraries.
  1602. This switch is similar to \fB\-\-no\-undefined\fR except that it
  1603. determines the behaviour when the undefined symbols are in a
  1604. shared library rather than a regular object file. It does not affect
  1605. how undefined symbols in regular object files are handled.
  1606. .Sp
  1607. The default behaviour is to report errors for any undefined symbols
  1608. referenced in shared libraries if the linker is being used to create
  1609. an executable, but to allow them if the linker is being used to create
  1610. a shared library.
  1611. .Sp
  1612. The reasons for allowing undefined symbol references in shared
  1613. libraries specified at link time are that:
  1614. .RS 4
  1615. .IP "\(bu" 4
  1616. A shared library specified at link time may not be the same as the one
  1617. that is available at load time, so the symbol might actually be
  1618. resolvable at load time.
  1619. .IP "\(bu" 4
  1620. There are some operating systems, eg BeOS and \s-1HPPA,\s0 where undefined
  1621. symbols in shared libraries are normal.
  1622. .Sp
  1623. The BeOS kernel for example patches shared libraries at load time to
  1624. select whichever function is most appropriate for the current
  1625. architecture. This is used, for example, to dynamically select an
  1626. appropriate memset function.
  1627. .RE
  1628. .RS 4
  1629. .RE
  1630. .IP "\fB\-\-no\-undefined\-version\fR" 4
  1631. .IX Item "--no-undefined-version"
  1632. Normally when a symbol has an undefined version, the linker will ignore
  1633. it. This option disallows symbols with undefined version and a fatal error
  1634. will be issued instead.
  1635. .IP "\fB\-\-default\-symver\fR" 4
  1636. .IX Item "--default-symver"
  1637. Create and use a default symbol version (the soname) for unversioned
  1638. exported symbols.
  1639. .IP "\fB\-\-default\-imported\-symver\fR" 4
  1640. .IX Item "--default-imported-symver"
  1641. Create and use a default symbol version (the soname) for unversioned
  1642. imported symbols.
  1643. .IP "\fB\-\-no\-warn\-mismatch\fR" 4
  1644. .IX Item "--no-warn-mismatch"
  1645. Normally \fBld\fR will give an error if you try to link together input
  1646. files that are mismatched for some reason, perhaps because they have
  1647. been compiled for different processors or for different endiannesses.
  1648. This option tells \fBld\fR that it should silently permit such possible
  1649. errors. This option should only be used with care, in cases when you
  1650. have taken some special action that ensures that the linker errors are
  1651. inappropriate.
  1652. .IP "\fB\-\-no\-warn\-search\-mismatch\fR" 4
  1653. .IX Item "--no-warn-search-mismatch"
  1654. Normally \fBld\fR will give a warning if it finds an incompatible
  1655. library during a library search. This option silences the warning.
  1656. .IP "\fB\-\-no\-whole\-archive\fR" 4
  1657. .IX Item "--no-whole-archive"
  1658. Turn off the effect of the \fB\-\-whole\-archive\fR option for subsequent
  1659. archive files.
  1660. .IP "\fB\-\-noinhibit\-exec\fR" 4
  1661. .IX Item "--noinhibit-exec"
  1662. Retain the executable output file whenever it is still usable.
  1663. Normally, the linker will not produce an output file if it encounters
  1664. errors during the link process; it exits without writing an output file
  1665. when it issues any error whatsoever.
  1666. .IP "\fB\-nostdlib\fR" 4
  1667. .IX Item "-nostdlib"
  1668. Only search library directories explicitly specified on the
  1669. command line. Library directories specified in linker scripts
  1670. (including linker scripts specified on the command line) are ignored.
  1671. .IP "\fB\-\-oformat=\fR\fIoutput-format\fR" 4
  1672. .IX Item "--oformat=output-format"
  1673. \&\fBld\fR may be configured to support more than one kind of object
  1674. file. If your \fBld\fR is configured this way, you can use the
  1675. \&\fB\-\-oformat\fR option to specify the binary format for the output
  1676. object file. Even when \fBld\fR is configured to support alternative
  1677. object formats, you don't usually need to specify this, as \fBld\fR
  1678. should be configured to produce as a default output format the most
  1679. usual format on each machine. \fIoutput-format\fR is a text string, the
  1680. name of a particular format supported by the \s-1BFD\s0 libraries. (You can
  1681. list the available binary formats with \fBobjdump \-i\fR.) The script
  1682. command \f(CW\*(C`OUTPUT_FORMAT\*(C'\fR can also specify the output format, but
  1683. this option overrides it.
  1684. .IP "\fB\-\-out\-implib\fR \fIfile\fR" 4
  1685. .IX Item "--out-implib file"
  1686. Create an import library in \fIfile\fR corresponding to the executable
  1687. the linker is generating (eg. a \s-1DLL\s0 or \s-1ELF\s0 program). This import
  1688. library (which should be called \f(CW\*(C`*.dll.a\*(C'\fR or \f(CW\*(C`*.a\*(C'\fR for DLLs)
  1689. may be used to link clients against the generated executable; this
  1690. behaviour makes it possible to skip a separate import library creation
  1691. step (eg. \f(CW\*(C`dlltool\*(C'\fR for DLLs). This option is only available for
  1692. the i386 \s-1PE\s0 and \s-1ELF\s0 targetted ports of the linker.
  1693. .IP "\fB\-pie\fR" 4
  1694. .IX Item "-pie"
  1695. .PD 0
  1696. .IP "\fB\-\-pic\-executable\fR" 4
  1697. .IX Item "--pic-executable"
  1698. .PD
  1699. Create a position independent executable. This is currently only supported on
  1700. \&\s-1ELF\s0 platforms. Position independent executables are similar to shared
  1701. libraries in that they are relocated by the dynamic linker to the virtual
  1702. address the \s-1OS\s0 chooses for them (which can vary between invocations). Like
  1703. normal dynamically linked executables they can be executed and symbols
  1704. defined in the executable cannot be overridden by shared libraries.
  1705. .IP "\fB\-qmagic\fR" 4
  1706. .IX Item "-qmagic"
  1707. This option is ignored for Linux compatibility.
  1708. .IP "\fB\-Qy\fR" 4
  1709. .IX Item "-Qy"
  1710. This option is ignored for \s-1SVR4\s0 compatibility.
  1711. .IP "\fB\-\-relax\fR" 4
  1712. .IX Item "--relax"
  1713. .PD 0
  1714. .IP "\fB\-\-no\-relax\fR" 4
  1715. .IX Item "--no-relax"
  1716. .PD
  1717. An option with machine dependent effects.
  1718. This option is only supported on a few targets.
  1719. .Sp
  1720. On some platforms the \fB\-\-relax\fR option performs target specific,
  1721. global optimizations that become possible when the linker resolves
  1722. addressing in the program, such as relaxing address modes,
  1723. synthesizing new instructions, selecting shorter version of current
  1724. instructions, and combining constant values.
  1725. .Sp
  1726. On some platforms these link time global optimizations may make symbolic
  1727. debugging of the resulting executable impossible.
  1728. This is known to be the case for the Matsushita \s-1MN10200\s0 and \s-1MN10300\s0
  1729. family of processors.
  1730. .Sp
  1731. On platforms where this is not supported, \fB\-\-relax\fR is accepted,
  1732. but ignored.
  1733. .Sp
  1734. On platforms where \fB\-\-relax\fR is accepted the option
  1735. \&\fB\-\-no\-relax\fR can be used to disable the feature.
  1736. .IP "\fB\-\-retain\-symbols\-file=\fR\fIfilename\fR" 4
  1737. .IX Item "--retain-symbols-file=filename"
  1738. Retain \fIonly\fR the symbols listed in the file \fIfilename\fR,
  1739. discarding all others. \fIfilename\fR is simply a flat file, with one
  1740. symbol name per line. This option is especially useful in environments
  1741. (such as VxWorks)
  1742. where a large global symbol table is accumulated gradually, to conserve
  1743. run-time memory.
  1744. .Sp
  1745. \&\fB\-\-retain\-symbols\-file\fR does \fInot\fR discard undefined symbols,
  1746. or symbols needed for relocations.
  1747. .Sp
  1748. You may only specify \fB\-\-retain\-symbols\-file\fR once in the command
  1749. line. It overrides \fB\-s\fR and \fB\-S\fR.
  1750. .IP "\fB\-rpath=\fR\fIdir\fR" 4
  1751. .IX Item "-rpath=dir"
  1752. Add a directory to the runtime library search path. This is used when
  1753. linking an \s-1ELF\s0 executable with shared objects. All \fB\-rpath\fR
  1754. arguments are concatenated and passed to the runtime linker, which uses
  1755. them to locate shared objects at runtime. The \fB\-rpath\fR option is
  1756. also used when locating shared objects which are needed by shared
  1757. objects explicitly included in the link; see the description of the
  1758. \&\fB\-rpath\-link\fR option. If \fB\-rpath\fR is not used when linking an
  1759. \&\s-1ELF\s0 executable, the contents of the environment variable
  1760. \&\f(CW\*(C`LD_RUN_PATH\*(C'\fR will be used if it is defined.
  1761. .Sp
  1762. The \fB\-rpath\fR option may also be used on SunOS. By default, on
  1763. SunOS, the linker will form a runtime search path out of all the
  1764. \&\fB\-L\fR options it is given. If a \fB\-rpath\fR option is used, the
  1765. runtime search path will be formed exclusively using the \fB\-rpath\fR
  1766. options, ignoring the \fB\-L\fR options. This can be useful when using
  1767. gcc, which adds many \fB\-L\fR options which may be on \s-1NFS\s0 mounted
  1768. file systems.
  1769. .Sp
  1770. For compatibility with other \s-1ELF\s0 linkers, if the \fB\-R\fR option is
  1771. followed by a directory name, rather than a file name, it is treated as
  1772. the \fB\-rpath\fR option.
  1773. .IP "\fB\-rpath\-link=\fR\fIdir\fR" 4
  1774. .IX Item "-rpath-link=dir"
  1775. When using \s-1ELF\s0 or SunOS, one shared library may require another. This
  1776. happens when an \f(CW\*(C`ld \-shared\*(C'\fR link includes a shared library as one
  1777. of the input files.
  1778. .Sp
  1779. When the linker encounters such a dependency when doing a non-shared,
  1780. non-relocatable link, it will automatically try to locate the required
  1781. shared library and include it in the link, if it is not included
  1782. explicitly. In such a case, the \fB\-rpath\-link\fR option
  1783. specifies the first set of directories to search. The
  1784. \&\fB\-rpath\-link\fR option may specify a sequence of directory names
  1785. either by specifying a list of names separated by colons, or by
  1786. appearing multiple times.
  1787. .Sp
  1788. The tokens \fI\f(CI$ORIGIN\fI\fR and \fI\f(CI$LIB\fI\fR can appear in these search
  1789. directories. They will be replaced by the full path to the directory
  1790. containing the program or shared object in the case of \fI\f(CI$ORIGIN\fI\fR
  1791. and either \fBlib\fR \- for 32\-bit binaries \- or \fBlib64\fR \- for
  1792. 64\-bit binaries \- in the case of \fI\f(CI$LIB\fI\fR.
  1793. .Sp
  1794. The alternative form of these tokens \- \fI${\s-1ORIGIN\s0}\fR and
  1795. \&\fI${\s-1LIB\s0}\fR can also be used. The token \fI\f(CI$PLATFORM\fI\fR is not
  1796. supported.
  1797. .Sp
  1798. This option should be used with caution as it overrides the search path
  1799. that may have been hard compiled into a shared library. In such a case it
  1800. is possible to use unintentionally a different search path than the
  1801. runtime linker would do.
  1802. .Sp
  1803. The linker uses the following search paths to locate required shared
  1804. libraries:
  1805. .RS 4
  1806. .IP "1." 4
  1807. Any directories specified by \fB\-rpath\-link\fR options.
  1808. .IP "2." 4
  1809. Any directories specified by \fB\-rpath\fR options. The difference
  1810. between \fB\-rpath\fR and \fB\-rpath\-link\fR is that directories
  1811. specified by \fB\-rpath\fR options are included in the executable and
  1812. used at runtime, whereas the \fB\-rpath\-link\fR option is only effective
  1813. at link time. Searching \fB\-rpath\fR in this way is only supported
  1814. by native linkers and cross linkers which have been configured with
  1815. the \fB\-\-with\-sysroot\fR option.
  1816. .IP "3." 4
  1817. On an \s-1ELF\s0 system, for native linkers, if the \fB\-rpath\fR and
  1818. \&\fB\-rpath\-link\fR options were not used, search the contents of the
  1819. environment variable \f(CW\*(C`LD_RUN_PATH\*(C'\fR.
  1820. .IP "4." 4
  1821. On SunOS, if the \fB\-rpath\fR option was not used, search any
  1822. directories specified using \fB\-L\fR options.
  1823. .IP "5." 4
  1824. For a native linker, search the contents of the environment
  1825. variable \f(CW\*(C`LD_LIBRARY_PATH\*(C'\fR.
  1826. .IP "6." 4
  1827. For a native \s-1ELF\s0 linker, the directories in \f(CW\*(C`DT_RUNPATH\*(C'\fR or
  1828. \&\f(CW\*(C`DT_RPATH\*(C'\fR of a shared library are searched for shared
  1829. libraries needed by it. The \f(CW\*(C`DT_RPATH\*(C'\fR entries are ignored if
  1830. \&\f(CW\*(C`DT_RUNPATH\*(C'\fR entries exist.
  1831. .IP "7." 4
  1832. The default directories, normally \fI/lib\fR and \fI/usr/lib\fR.
  1833. .IP "8." 4
  1834. For a native linker on an \s-1ELF\s0 system, if the file \fI/etc/ld.so.conf\fR
  1835. exists, the list of directories found in that file.
  1836. .RE
  1837. .RS 4
  1838. .Sp
  1839. If the required shared library is not found, the linker will issue a
  1840. warning and continue with the link.
  1841. .RE
  1842. .IP "\fB\-shared\fR" 4
  1843. .IX Item "-shared"
  1844. .PD 0
  1845. .IP "\fB\-Bshareable\fR" 4
  1846. .IX Item "-Bshareable"
  1847. .PD
  1848. Create a shared library. This is currently only supported on \s-1ELF, XCOFF\s0
  1849. and SunOS platforms. On SunOS, the linker will automatically create a
  1850. shared library if the \fB\-e\fR option is not used and there are
  1851. undefined symbols in the link.
  1852. .IP "\fB\-\-sort\-common\fR" 4
  1853. .IX Item "--sort-common"
  1854. .PD 0
  1855. .IP "\fB\-\-sort\-common=ascending\fR" 4
  1856. .IX Item "--sort-common=ascending"
  1857. .IP "\fB\-\-sort\-common=descending\fR" 4
  1858. .IX Item "--sort-common=descending"
  1859. .PD
  1860. This option tells \fBld\fR to sort the common symbols by alignment in
  1861. ascending or descending order when it places them in the appropriate output
  1862. sections. The symbol alignments considered are sixteen-byte or larger,
  1863. eight-byte, four-byte, two-byte, and one-byte. This is to prevent gaps
  1864. between symbols due to alignment constraints. If no sorting order is
  1865. specified, then descending order is assumed.
  1866. .IP "\fB\-\-sort\-section=name\fR" 4
  1867. .IX Item "--sort-section=name"
  1868. This option will apply \f(CW\*(C`SORT_BY_NAME\*(C'\fR to all wildcard section
  1869. patterns in the linker script.
  1870. .IP "\fB\-\-sort\-section=alignment\fR" 4
  1871. .IX Item "--sort-section=alignment"
  1872. This option will apply \f(CW\*(C`SORT_BY_ALIGNMENT\*(C'\fR to all wildcard section
  1873. patterns in the linker script.
  1874. .IP "\fB\-\-spare\-dynamic\-tags=\fR\fIcount\fR" 4
  1875. .IX Item "--spare-dynamic-tags=count"
  1876. This option specifies the number of empty slots to leave in the
  1877. \&.dynamic section of \s-1ELF\s0 shared objects. Empty slots may be needed by
  1878. post processing tools, such as the prelinker. The default is 5.
  1879. .IP "\fB\-\-split\-by\-file[=\fR\fIsize\fR\fB]\fR" 4
  1880. .IX Item "--split-by-file[=size]"
  1881. Similar to \fB\-\-split\-by\-reloc\fR but creates a new output section for
  1882. each input file when \fIsize\fR is reached. \fIsize\fR defaults to a
  1883. size of 1 if not given.
  1884. .IP "\fB\-\-split\-by\-reloc[=\fR\fIcount\fR\fB]\fR" 4
  1885. .IX Item "--split-by-reloc[=count]"
  1886. Tries to creates extra sections in the output file so that no single
  1887. output section in the file contains more than \fIcount\fR relocations.
  1888. This is useful when generating huge relocatable files for downloading into
  1889. certain real time kernels with the \s-1COFF\s0 object file format; since \s-1COFF\s0
  1890. cannot represent more than 65535 relocations in a single section. Note
  1891. that this will fail to work with object file formats which do not
  1892. support arbitrary sections. The linker will not split up individual
  1893. input sections for redistribution, so if a single input section contains
  1894. more than \fIcount\fR relocations one output section will contain that
  1895. many relocations. \fIcount\fR defaults to a value of 32768.
  1896. .IP "\fB\-\-stats\fR" 4
  1897. .IX Item "--stats"
  1898. Compute and display statistics about the operation of the linker, such
  1899. as execution time and memory usage.
  1900. .IP "\fB\-\-sysroot=\fR\fIdirectory\fR" 4
  1901. .IX Item "--sysroot=directory"
  1902. Use \fIdirectory\fR as the location of the sysroot, overriding the
  1903. configure-time default. This option is only supported by linkers
  1904. that were configured using \fB\-\-with\-sysroot\fR.
  1905. .IP "\fB\-\-task\-link\fR" 4
  1906. .IX Item "--task-link"
  1907. This is used by \s-1COFF/PE\s0 based targets to create a task-linked object
  1908. file where all of the global symbols have been converted to statics.
  1909. .IP "\fB\-\-traditional\-format\fR" 4
  1910. .IX Item "--traditional-format"
  1911. For some targets, the output of \fBld\fR is different in some ways from
  1912. the output of some existing linker. This switch requests \fBld\fR to
  1913. use the traditional format instead.
  1914. .Sp
  1915. For example, on SunOS, \fBld\fR combines duplicate entries in the
  1916. symbol string table. This can reduce the size of an output file with
  1917. full debugging information by over 30 percent. Unfortunately, the SunOS
  1918. \&\f(CW\*(C`dbx\*(C'\fR program can not read the resulting program (\f(CW\*(C`gdb\*(C'\fR has no
  1919. trouble). The \fB\-\-traditional\-format\fR switch tells \fBld\fR to not
  1920. combine duplicate entries.
  1921. .IP "\fB\-\-section\-start=\fR\fIsectionname\fR\fB=\fR\fIorg\fR" 4
  1922. .IX Item "--section-start=sectionname=org"
  1923. Locate a section in the output file at the absolute
  1924. address given by \fIorg\fR. You may use this option as many
  1925. times as necessary to locate multiple sections in the command
  1926. line.
  1927. \&\fIorg\fR must be a single hexadecimal integer;
  1928. for compatibility with other linkers, you may omit the leading
  1929. \&\fB0x\fR usually associated with hexadecimal values. \fINote:\fR there
  1930. should be no white space between \fIsectionname\fR, the equals
  1931. sign ("\fB=\fR"), and \fIorg\fR.
  1932. .IP "\fB\-Tbss=\fR\fIorg\fR" 4
  1933. .IX Item "-Tbss=org"
  1934. .PD 0
  1935. .IP "\fB\-Tdata=\fR\fIorg\fR" 4
  1936. .IX Item "-Tdata=org"
  1937. .IP "\fB\-Ttext=\fR\fIorg\fR" 4
  1938. .IX Item "-Ttext=org"
  1939. .PD
  1940. Same as \fB\-\-section\-start\fR, with \f(CW\*(C`.bss\*(C'\fR, \f(CW\*(C`.data\*(C'\fR or
  1941. \&\f(CW\*(C`.text\*(C'\fR as the \fIsectionname\fR.
  1942. .IP "\fB\-Ttext\-segment=\fR\fIorg\fR" 4
  1943. .IX Item "-Ttext-segment=org"
  1944. When creating an \s-1ELF\s0 executable, it will set the address of the first
  1945. byte of the text segment.
  1946. .IP "\fB\-Trodata\-segment=\fR\fIorg\fR" 4
  1947. .IX Item "-Trodata-segment=org"
  1948. When creating an \s-1ELF\s0 executable or shared object for a target where
  1949. the read-only data is in its own segment separate from the executable
  1950. text, it will set the address of the first byte of the read-only data segment.
  1951. .IP "\fB\-Tldata\-segment=\fR\fIorg\fR" 4
  1952. .IX Item "-Tldata-segment=org"
  1953. When creating an \s-1ELF\s0 executable or shared object for x86\-64 medium memory
  1954. model, it will set the address of the first byte of the ldata segment.
  1955. .IP "\fB\-\-unresolved\-symbols=\fR\fImethod\fR" 4
  1956. .IX Item "--unresolved-symbols=method"
  1957. Determine how to handle unresolved symbols. There are four possible
  1958. values for \fBmethod\fR:
  1959. .RS 4
  1960. .IP "\fBignore-all\fR" 4
  1961. .IX Item "ignore-all"
  1962. Do not report any unresolved symbols.
  1963. .IP "\fBreport-all\fR" 4
  1964. .IX Item "report-all"
  1965. Report all unresolved symbols. This is the default.
  1966. .IP "\fBignore-in-object-files\fR" 4
  1967. .IX Item "ignore-in-object-files"
  1968. Report unresolved symbols that are contained in shared libraries, but
  1969. ignore them if they come from regular object files.
  1970. .IP "\fBignore-in-shared-libs\fR" 4
  1971. .IX Item "ignore-in-shared-libs"
  1972. Report unresolved symbols that come from regular object files, but
  1973. ignore them if they come from shared libraries. This can be useful
  1974. when creating a dynamic binary and it is known that all the shared
  1975. libraries that it should be referencing are included on the linker's
  1976. command line.
  1977. .RE
  1978. .RS 4
  1979. .Sp
  1980. The behaviour for shared libraries on their own can also be controlled
  1981. by the \fB\-\-[no\-]allow\-shlib\-undefined\fR option.
  1982. .Sp
  1983. Normally the linker will generate an error message for each reported
  1984. unresolved symbol but the option \fB\-\-warn\-unresolved\-symbols\fR
  1985. can change this to a warning.
  1986. .RE
  1987. .IP "\fB\-\-dll\-verbose\fR" 4
  1988. .IX Item "--dll-verbose"
  1989. .PD 0
  1990. .IP "\fB\-\-verbose[=\fR\fI\s-1NUMBER\s0\fR\fB]\fR" 4
  1991. .IX Item "--verbose[=NUMBER]"
  1992. .PD
  1993. Display the version number for \fBld\fR and list the linker emulations
  1994. supported. Display which input files can and cannot be opened. Display
  1995. the linker script being used by the linker. If the optional \fI\s-1NUMBER\s0\fR
  1996. argument > 1, plugin symbol status will also be displayed.
  1997. .IP "\fB\-\-version\-script=\fR\fIversion-scriptfile\fR" 4
  1998. .IX Item "--version-script=version-scriptfile"
  1999. Specify the name of a version script to the linker. This is typically
  2000. used when creating shared libraries to specify additional information
  2001. about the version hierarchy for the library being created. This option
  2002. is only fully supported on \s-1ELF\s0 platforms which support shared libraries;
  2003. see \fB\s-1VERSION\s0\fR. It is partially supported on \s-1PE\s0 platforms, which can
  2004. use version scripts to filter symbol visibility in auto-export mode: any
  2005. symbols marked \fBlocal\fR in the version script will not be exported.
  2006. .IP "\fB\-\-warn\-common\fR" 4
  2007. .IX Item "--warn-common"
  2008. Warn when a common symbol is combined with another common symbol or with
  2009. a symbol definition. Unix linkers allow this somewhat sloppy practice,
  2010. but linkers on some other operating systems do not. This option allows
  2011. you to find potential problems from combining global symbols.
  2012. Unfortunately, some C libraries use this practice, so you may get some
  2013. warnings about symbols in the libraries as well as in your programs.
  2014. .Sp
  2015. There are three kinds of global symbols, illustrated here by C examples:
  2016. .RS 4
  2017. .IP "\fBint i = 1;\fR" 4
  2018. .IX Item "int i = 1;"
  2019. A definition, which goes in the initialized data section of the output
  2020. file.
  2021. .IP "\fBextern int i;\fR" 4
  2022. .IX Item "extern int i;"
  2023. An undefined reference, which does not allocate space.
  2024. There must be either a definition or a common symbol for the
  2025. variable somewhere.
  2026. .IP "\fBint i;\fR" 4
  2027. .IX Item "int i;"
  2028. A common symbol. If there are only (one or more) common symbols for a
  2029. variable, it goes in the uninitialized data area of the output file.
  2030. The linker merges multiple common symbols for the same variable into a
  2031. single symbol. If they are of different sizes, it picks the largest
  2032. size. The linker turns a common symbol into a declaration, if there is
  2033. a definition of the same variable.
  2034. .RE
  2035. .RS 4
  2036. .Sp
  2037. The \fB\-\-warn\-common\fR option can produce five kinds of warnings.
  2038. Each warning consists of a pair of lines: the first describes the symbol
  2039. just encountered, and the second describes the previous symbol
  2040. encountered with the same name. One or both of the two symbols will be
  2041. a common symbol.
  2042. .IP "1." 4
  2043. Turning a common symbol into a reference, because there is already a
  2044. definition for the symbol.
  2045. .Sp
  2046. .Vb 3
  2047. \& <file>(<section>): warning: common of \`<symbol>\*(Aq
  2048. \& overridden by definition
  2049. \& <file>(<section>): warning: defined here
  2050. .Ve
  2051. .IP "2." 4
  2052. Turning a common symbol into a reference, because a later definition for
  2053. the symbol is encountered. This is the same as the previous case,
  2054. except that the symbols are encountered in a different order.
  2055. .Sp
  2056. .Vb 3
  2057. \& <file>(<section>): warning: definition of \`<symbol>\*(Aq
  2058. \& overriding common
  2059. \& <file>(<section>): warning: common is here
  2060. .Ve
  2061. .IP "3." 4
  2062. Merging a common symbol with a previous same-sized common symbol.
  2063. .Sp
  2064. .Vb 3
  2065. \& <file>(<section>): warning: multiple common
  2066. \& of \`<symbol>\*(Aq
  2067. \& <file>(<section>): warning: previous common is here
  2068. .Ve
  2069. .IP "4." 4
  2070. Merging a common symbol with a previous larger common symbol.
  2071. .Sp
  2072. .Vb 3
  2073. \& <file>(<section>): warning: common of \`<symbol>\*(Aq
  2074. \& overridden by larger common
  2075. \& <file>(<section>): warning: larger common is here
  2076. .Ve
  2077. .IP "5." 4
  2078. Merging a common symbol with a previous smaller common symbol. This is
  2079. the same as the previous case, except that the symbols are
  2080. encountered in a different order.
  2081. .Sp
  2082. .Vb 3
  2083. \& <file>(<section>): warning: common of \`<symbol>\*(Aq
  2084. \& overriding smaller common
  2085. \& <file>(<section>): warning: smaller common is here
  2086. .Ve
  2087. .RE
  2088. .RS 4
  2089. .RE
  2090. .IP "\fB\-\-warn\-constructors\fR" 4
  2091. .IX Item "--warn-constructors"
  2092. Warn if any global constructors are used. This is only useful for a few
  2093. object file formats. For formats like \s-1COFF\s0 or \s-1ELF,\s0 the linker can not
  2094. detect the use of global constructors.
  2095. .IP "\fB\-\-warn\-multiple\-gp\fR" 4
  2096. .IX Item "--warn-multiple-gp"
  2097. Warn if multiple global pointer values are required in the output file.
  2098. This is only meaningful for certain processors, such as the Alpha.
  2099. Specifically, some processors put large-valued constants in a special
  2100. section. A special register (the global pointer) points into the middle
  2101. of this section, so that constants can be loaded efficiently via a
  2102. base-register relative addressing mode. Since the offset in
  2103. base-register relative mode is fixed and relatively small (e.g., 16
  2104. bits), this limits the maximum size of the constant pool. Thus, in
  2105. large programs, it is often necessary to use multiple global pointer
  2106. values in order to be able to address all possible constants. This
  2107. option causes a warning to be issued whenever this case occurs.
  2108. .IP "\fB\-\-warn\-once\fR" 4
  2109. .IX Item "--warn-once"
  2110. Only warn once for each undefined symbol, rather than once per module
  2111. which refers to it.
  2112. .IP "\fB\-\-warn\-section\-align\fR" 4
  2113. .IX Item "--warn-section-align"
  2114. Warn if the address of an output section is changed because of
  2115. alignment. Typically, the alignment will be set by an input section.
  2116. The address will only be changed if it not explicitly specified; that
  2117. is, if the \f(CW\*(C`SECTIONS\*(C'\fR command does not specify a start address for
  2118. the section.
  2119. .IP "\fB\-\-warn\-shared\-textrel\fR" 4
  2120. .IX Item "--warn-shared-textrel"
  2121. Warn if the linker adds a \s-1DT_TEXTREL\s0 to a shared object.
  2122. .IP "\fB\-\-warn\-alternate\-em\fR" 4
  2123. .IX Item "--warn-alternate-em"
  2124. Warn if an object has alternate \s-1ELF\s0 machine code.
  2125. .IP "\fB\-\-warn\-unresolved\-symbols\fR" 4
  2126. .IX Item "--warn-unresolved-symbols"
  2127. If the linker is going to report an unresolved symbol (see the option
  2128. \&\fB\-\-unresolved\-symbols\fR) it will normally generate an error.
  2129. This option makes it generate a warning instead.
  2130. .IP "\fB\-\-error\-unresolved\-symbols\fR" 4
  2131. .IX Item "--error-unresolved-symbols"
  2132. This restores the linker's default behaviour of generating errors when
  2133. it is reporting unresolved symbols.
  2134. .IP "\fB\-\-whole\-archive\fR" 4
  2135. .IX Item "--whole-archive"
  2136. For each archive mentioned on the command line after the
  2137. \&\fB\-\-whole\-archive\fR option, include every object file in the archive
  2138. in the link, rather than searching the archive for the required object
  2139. files. This is normally used to turn an archive file into a shared
  2140. library, forcing every object to be included in the resulting shared
  2141. library. This option may be used more than once.
  2142. .Sp
  2143. Two notes when using this option from gcc: First, gcc doesn't know
  2144. about this option, so you have to use \fB\-Wl,\-whole\-archive\fR.
  2145. Second, don't forget to use \fB\-Wl,\-no\-whole\-archive\fR after your
  2146. list of archives, because gcc will add its own list of archives to
  2147. your link and you may not want this flag to affect those as well.
  2148. .IP "\fB\-\-wrap=\fR\fIsymbol\fR" 4
  2149. .IX Item "--wrap=symbol"
  2150. Use a wrapper function for \fIsymbol\fR. Any undefined reference to
  2151. \&\fIsymbol\fR will be resolved to \f(CW\*(C`_\|_wrap_\f(CIsymbol\f(CW\*(C'\fR. Any
  2152. undefined reference to \f(CW\*(C`_\|_real_\f(CIsymbol\f(CW\*(C'\fR will be resolved to
  2153. \&\fIsymbol\fR.
  2154. .Sp
  2155. This can be used to provide a wrapper for a system function. The
  2156. wrapper function should be called \f(CW\*(C`_\|_wrap_\f(CIsymbol\f(CW\*(C'\fR. If it
  2157. wishes to call the system function, it should call
  2158. \&\f(CW\*(C`_\|_real_\f(CIsymbol\f(CW\*(C'\fR.
  2159. .Sp
  2160. Here is a trivial example:
  2161. .Sp
  2162. .Vb 6
  2163. \& void *
  2164. \& _\|_wrap_malloc (size_t c)
  2165. \& {
  2166. \& printf ("malloc called with %zu\en", c);
  2167. \& return _\|_real_malloc (c);
  2168. \& }
  2169. .Ve
  2170. .Sp
  2171. If you link other code with this file using \fB\-\-wrap malloc\fR, then
  2172. all calls to \f(CW\*(C`malloc\*(C'\fR will call the function \f(CW\*(C`_\|_wrap_malloc\*(C'\fR
  2173. instead. The call to \f(CW\*(C`_\|_real_malloc\*(C'\fR in \f(CW\*(C`_\|_wrap_malloc\*(C'\fR will
  2174. call the real \f(CW\*(C`malloc\*(C'\fR function.
  2175. .Sp
  2176. You may wish to provide a \f(CW\*(C`_\|_real_malloc\*(C'\fR function as well, so that
  2177. links without the \fB\-\-wrap\fR option will succeed. If you do this,
  2178. you should not put the definition of \f(CW\*(C`_\|_real_malloc\*(C'\fR in the same
  2179. file as \f(CW\*(C`_\|_wrap_malloc\*(C'\fR; if you do, the assembler may resolve the
  2180. call before the linker has a chance to wrap it to \f(CW\*(C`malloc\*(C'\fR.
  2181. .Sp
  2182. Only undefined references are replaced by the linker. So, translation unit
  2183. internal references to \fIsymbol\fR are not resolved to
  2184. \&\f(CW\*(C`_\|_wrap_\f(CIsymbol\f(CW\*(C'\fR. In the next example, the call to \f(CW\*(C`f\*(C'\fR in
  2185. \&\f(CW\*(C`g\*(C'\fR is not resolved to \f(CW\*(C`_\|_wrap_f\*(C'\fR.
  2186. .Sp
  2187. .Vb 5
  2188. \& int
  2189. \& f (void)
  2190. \& {
  2191. \& return 123;
  2192. \& }
  2193. \&
  2194. \& int
  2195. \& g (void)
  2196. \& {
  2197. \& return f();
  2198. \& }
  2199. .Ve
  2200. .IP "\fB\-\-eh\-frame\-hdr\fR" 4
  2201. .IX Item "--eh-frame-hdr"
  2202. .PD 0
  2203. .IP "\fB\-\-no\-eh\-frame\-hdr\fR" 4
  2204. .IX Item "--no-eh-frame-hdr"
  2205. .PD
  2206. Request (\fB\-\-eh\-frame\-hdr\fR) or suppress
  2207. (\fB\-\-no\-eh\-frame\-hdr\fR) the creation of \f(CW\*(C`.eh_frame_hdr\*(C'\fR
  2208. section and \s-1ELF\s0 \f(CW\*(C`PT_GNU_EH_FRAME\*(C'\fR segment header.
  2209. .IP "\fB\-\-no\-ld\-generated\-unwind\-info\fR" 4
  2210. .IX Item "--no-ld-generated-unwind-info"
  2211. Request creation of \f(CW\*(C`.eh_frame\*(C'\fR unwind info for linker
  2212. generated code sections like \s-1PLT.\s0 This option is on by default
  2213. if linker generated unwind info is supported.
  2214. .IP "\fB\-\-enable\-new\-dtags\fR" 4
  2215. .IX Item "--enable-new-dtags"
  2216. .PD 0
  2217. .IP "\fB\-\-disable\-new\-dtags\fR" 4
  2218. .IX Item "--disable-new-dtags"
  2219. .PD
  2220. This linker can create the new dynamic tags in \s-1ELF.\s0 But the older \s-1ELF\s0
  2221. systems may not understand them. If you specify
  2222. \&\fB\-\-enable\-new\-dtags\fR, the new dynamic tags will be created as needed
  2223. and older dynamic tags will be omitted.
  2224. If you specify \fB\-\-disable\-new\-dtags\fR, no new dynamic tags will be
  2225. created. By default, the new dynamic tags are not created. Note that
  2226. those options are only available for \s-1ELF\s0 systems.
  2227. .IP "\fB\-\-hash\-size=\fR\fInumber\fR" 4
  2228. .IX Item "--hash-size=number"
  2229. Set the default size of the linker's hash tables to a prime number
  2230. close to \fInumber\fR. Increasing this value can reduce the length of
  2231. time it takes the linker to perform its tasks, at the expense of
  2232. increasing the linker's memory requirements. Similarly reducing this
  2233. value can reduce the memory requirements at the expense of speed.
  2234. .IP "\fB\-\-hash\-style=\fR\fIstyle\fR" 4
  2235. .IX Item "--hash-style=style"
  2236. Set the type of linker's hash table(s). \fIstyle\fR can be either
  2237. \&\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
  2238. new style \s-1GNU\s0 \f(CW\*(C`.gnu.hash\*(C'\fR section or \f(CW\*(C`both\*(C'\fR for both
  2239. the classic \s-1ELF\s0 \f(CW\*(C`.hash\*(C'\fR and new style \s-1GNU\s0 \f(CW\*(C`.gnu.hash\*(C'\fR
  2240. hash tables. The default depends upon how the linker was configured,
  2241. but for most Linux based systems it will be \f(CW\*(C`both\*(C'\fR.
  2242. .IP "\fB\-\-compress\-debug\-sections=none\fR" 4
  2243. .IX Item "--compress-debug-sections=none"
  2244. .PD 0
  2245. .IP "\fB\-\-compress\-debug\-sections=zlib\fR" 4
  2246. .IX Item "--compress-debug-sections=zlib"
  2247. .IP "\fB\-\-compress\-debug\-sections=zlib\-gnu\fR" 4
  2248. .IX Item "--compress-debug-sections=zlib-gnu"
  2249. .IP "\fB\-\-compress\-debug\-sections=zlib\-gabi\fR" 4
  2250. .IX Item "--compress-debug-sections=zlib-gabi"
  2251. .PD
  2252. On \s-1ELF\s0 platforms, these options control how \s-1DWARF\s0 debug sections are
  2253. compressed using zlib.
  2254. .Sp
  2255. \&\fB\-\-compress\-debug\-sections=none\fR doesn't compress \s-1DWARF\s0 debug
  2256. sections. \fB\-\-compress\-debug\-sections=zlib\-gnu\fR compresses
  2257. \&\s-1DWARF\s0 debug sections and renames them to begin with \fB.zdebug\fR
  2258. instead of \fB.debug\fR. \fB\-\-compress\-debug\-sections=zlib\-gabi\fR
  2259. also compresses \s-1DWARF\s0 debug sections, but rather than renaming them it
  2260. sets the \s-1SHF_COMPRESSED\s0 flag in the sections' headers.
  2261. .Sp
  2262. The \fB\-\-compress\-debug\-sections=zlib\fR option is an alias for
  2263. \&\fB\-\-compress\-debug\-sections=zlib\-gabi\fR.
  2264. .Sp
  2265. Note that this option overrides any compression in input debug
  2266. sections, so if a binary is linked with \fB\-\-compress\-debug\-sections=none\fR
  2267. for example, then any compressed debug sections in input files will be
  2268. uncompressed before they are copied into the output binary.
  2269. .Sp
  2270. The default compression behaviour varies depending upon the target
  2271. involved and the configure options used to build the toolchain. The
  2272. default can be determined by examining the output from the linker's
  2273. \&\fB\-\-help\fR option.
  2274. .IP "\fB\-\-reduce\-memory\-overheads\fR" 4
  2275. .IX Item "--reduce-memory-overheads"
  2276. This option reduces memory requirements at ld runtime, at the expense of
  2277. linking speed. This was introduced to select the old O(n^2) algorithm
  2278. for link map file generation, rather than the new O(n) algorithm which uses
  2279. about 40% more memory for symbol storage.
  2280. .Sp
  2281. Another effect of the switch is to set the default hash table size to
  2282. 1021, which again saves memory at the cost of lengthening the linker's
  2283. run time. This is not done however if the \fB\-\-hash\-size\fR switch
  2284. has been used.
  2285. .Sp
  2286. The \fB\-\-reduce\-memory\-overheads\fR switch may be also be used to
  2287. enable other tradeoffs in future versions of the linker.
  2288. .IP "\fB\-\-build\-id\fR" 4
  2289. .IX Item "--build-id"
  2290. .PD 0
  2291. .IP "\fB\-\-build\-id=\fR\fIstyle\fR" 4
  2292. .IX Item "--build-id=style"
  2293. .PD
  2294. Request the creation of a \f(CW\*(C`.note.gnu.build\-id\*(C'\fR \s-1ELF\s0 note section
  2295. or a \f(CW\*(C`.buildid\*(C'\fR \s-1COFF\s0 section. The contents of the note are
  2296. unique bits identifying this linked file. \fIstyle\fR can be
  2297. \&\f(CW\*(C`uuid\*(C'\fR to use 128 random bits, \f(CW\*(C`sha1\*(C'\fR to use a 160\-bit
  2298. \&\s-1SHA1\s0 hash on the normative parts of the output contents,
  2299. \&\f(CW\*(C`md5\*(C'\fR to use a 128\-bit \s-1MD5\s0 hash on the normative parts of
  2300. the output contents, or \f(CW\*(C`0x\f(CIhexstring\f(CW\*(C'\fR to use a chosen bit
  2301. string specified as an even number of hexadecimal digits (\f(CW\*(C`\-\*(C'\fR and
  2302. \&\f(CW\*(C`:\*(C'\fR characters between digit pairs are ignored). If \fIstyle\fR
  2303. is omitted, \f(CW\*(C`sha1\*(C'\fR is used.
  2304. .Sp
  2305. The \f(CW\*(C`md5\*(C'\fR and \f(CW\*(C`sha1\*(C'\fR styles produces an identifier
  2306. that is always the same in an identical output file, but will be
  2307. unique among all nonidentical output files. It is not intended
  2308. to be compared as a checksum for the file's contents. A linked
  2309. file may be changed later by other tools, but the build \s-1ID\s0 bit
  2310. string identifying the original linked file does not change.
  2311. .Sp
  2312. Passing \f(CW\*(C`none\*(C'\fR for \fIstyle\fR disables the setting from any
  2313. \&\f(CW\*(C`\-\-build\-id\*(C'\fR options earlier on the command line.
  2314. .PP
  2315. The i386 \s-1PE\s0 linker supports the \fB\-shared\fR option, which causes
  2316. the output to be a dynamically linked library (\s-1DLL\s0) instead of a
  2317. normal executable. You should name the output \f(CW\*(C`*.dll\*(C'\fR when you
  2318. use this option. In addition, the linker fully supports the standard
  2319. \&\f(CW\*(C`*.def\*(C'\fR files, which may be specified on the linker command line
  2320. like an object file (in fact, it should precede archives it exports
  2321. symbols from, to ensure that they get linked in, just like a normal
  2322. object file).
  2323. .PP
  2324. In addition to the options common to all targets, the i386 \s-1PE\s0 linker
  2325. support additional command-line options that are specific to the i386
  2326. \&\s-1PE\s0 target. Options that take values may be separated from their
  2327. values by either a space or an equals sign.
  2328. .IP "\fB\-\-add\-stdcall\-alias\fR" 4
  2329. .IX Item "--add-stdcall-alias"
  2330. If given, symbols with a stdcall suffix (@\fInn\fR) will be exported
  2331. as-is and also with the suffix stripped.
  2332. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2333. .IP "\fB\-\-base\-file\fR \fIfile\fR" 4
  2334. .IX Item "--base-file file"
  2335. Use \fIfile\fR as the name of a file in which to save the base
  2336. addresses of all the relocations needed for generating DLLs with
  2337. \&\fIdlltool\fR.
  2338. [This is an i386 \s-1PE\s0 specific option]
  2339. .IP "\fB\-\-dll\fR" 4
  2340. .IX Item "--dll"
  2341. Create a \s-1DLL\s0 instead of a regular executable. You may also use
  2342. \&\fB\-shared\fR or specify a \f(CW\*(C`LIBRARY\*(C'\fR in a given \f(CW\*(C`.def\*(C'\fR
  2343. file.
  2344. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2345. .IP "\fB\-\-enable\-long\-section\-names\fR" 4
  2346. .IX Item "--enable-long-section-names"
  2347. .PD 0
  2348. .IP "\fB\-\-disable\-long\-section\-names\fR" 4
  2349. .IX Item "--disable-long-section-names"
  2350. .PD
  2351. The \s-1PE\s0 variants of the \s-1COFF\s0 object format add an extension that permits
  2352. the use of section names longer than eight characters, the normal limit
  2353. for \s-1COFF.\s0 By default, these names are only allowed in object files, as
  2354. fully-linked executable images do not carry the \s-1COFF\s0 string table required
  2355. to support the longer names. As a \s-1GNU\s0 extension, it is possible to
  2356. allow their use in executable images as well, or to (probably pointlessly!)
  2357. disallow it in object files, by using these two options. Executable images
  2358. generated with these long section names are slightly non-standard, carrying
  2359. as they do a string table, and may generate confusing output when examined
  2360. with non-GNU PE-aware tools, such as file viewers and dumpers. However,
  2361. \&\s-1GDB\s0 relies on the use of \s-1PE\s0 long section names to find Dwarf\-2 debug
  2362. information sections in an executable image at runtime, and so if neither
  2363. option is specified on the command-line, \fBld\fR will enable long
  2364. section names, overriding the default and technically correct behaviour,
  2365. when it finds the presence of debug information while linking an executable
  2366. image and not stripping symbols.
  2367. [This option is valid for all \s-1PE\s0 targeted ports of the linker]
  2368. .IP "\fB\-\-enable\-stdcall\-fixup\fR" 4
  2369. .IX Item "--enable-stdcall-fixup"
  2370. .PD 0
  2371. .IP "\fB\-\-disable\-stdcall\-fixup\fR" 4
  2372. .IX Item "--disable-stdcall-fixup"
  2373. .PD
  2374. If the link finds a symbol that it cannot resolve, it will attempt to
  2375. do \*(L"fuzzy linking\*(R" by looking for another defined symbol that differs
  2376. only in the format of the symbol name (cdecl vs stdcall) and will
  2377. resolve that symbol by linking to the match. For example, the
  2378. undefined symbol \f(CW\*(C`_foo\*(C'\fR might be linked to the function
  2379. \&\f(CW\*(C`_foo@12\*(C'\fR, or the undefined symbol \f(CW\*(C`_bar@16\*(C'\fR might be linked
  2380. to the function \f(CW\*(C`_bar\*(C'\fR. When the linker does this, it prints a
  2381. warning, since it normally should have failed to link, but sometimes
  2382. import libraries generated from third-party dlls may need this feature
  2383. to be usable. If you specify \fB\-\-enable\-stdcall\-fixup\fR, this
  2384. feature is fully enabled and warnings are not printed. If you specify
  2385. \&\fB\-\-disable\-stdcall\-fixup\fR, this feature is disabled and such
  2386. mismatches are considered to be errors.
  2387. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2388. .IP "\fB\-\-leading\-underscore\fR" 4
  2389. .IX Item "--leading-underscore"
  2390. .PD 0
  2391. .IP "\fB\-\-no\-leading\-underscore\fR" 4
  2392. .IX Item "--no-leading-underscore"
  2393. .PD
  2394. For most targets default symbol-prefix is an underscore and is defined
  2395. in target's description. By this option it is possible to
  2396. disable/enable the default underscore symbol-prefix.
  2397. .IP "\fB\-\-export\-all\-symbols\fR" 4
  2398. .IX Item "--export-all-symbols"
  2399. If given, all global symbols in the objects used to build a \s-1DLL\s0 will
  2400. be exported by the \s-1DLL.\s0 Note that this is the default if there
  2401. otherwise wouldn't be any exported symbols. When symbols are
  2402. explicitly exported via \s-1DEF\s0 files or implicitly exported via function
  2403. attributes, the default is to not export anything else unless this
  2404. option is given. Note that the symbols \f(CW\*(C`DllMain@12\*(C'\fR,
  2405. \&\f(CW\*(C`DllEntryPoint@0\*(C'\fR, \f(CW\*(C`DllMainCRTStartup@12\*(C'\fR, and
  2406. \&\f(CW\*(C`impure_ptr\*(C'\fR will not be automatically
  2407. exported. Also, symbols imported from other DLLs will not be
  2408. re-exported, nor will symbols specifying the \s-1DLL\s0's internal layout
  2409. such as those beginning with \f(CW\*(C`_head_\*(C'\fR or ending with
  2410. \&\f(CW\*(C`_iname\*(C'\fR. In addition, no symbols from \f(CW\*(C`libgcc\*(C'\fR,
  2411. \&\f(CW\*(C`libstd++\*(C'\fR, \f(CW\*(C`libmingw32\*(C'\fR, or \f(CW\*(C`crtX.o\*(C'\fR will be exported.
  2412. Symbols whose names begin with \f(CW\*(C`_\|_rtti_\*(C'\fR or \f(CW\*(C`_\|_builtin_\*(C'\fR will
  2413. not be exported, to help with \*(C+ DLLs. Finally, there is an
  2414. extensive list of cygwin-private symbols that are not exported
  2415. (obviously, this applies on when building DLLs for cygwin targets).
  2416. These cygwin-excludes are: \f(CW\*(C`_cygwin_dll_entry@12\*(C'\fR,
  2417. \&\f(CW\*(C`_cygwin_crt0_common@8\*(C'\fR, \f(CW\*(C`_cygwin_noncygwin_dll_entry@12\*(C'\fR,
  2418. \&\f(CW\*(C`_fmode\*(C'\fR, \f(CW\*(C`_impure_ptr\*(C'\fR, \f(CW\*(C`cygwin_attach_dll\*(C'\fR,
  2419. \&\f(CW\*(C`cygwin_premain0\*(C'\fR, \f(CW\*(C`cygwin_premain1\*(C'\fR, \f(CW\*(C`cygwin_premain2\*(C'\fR,
  2420. \&\f(CW\*(C`cygwin_premain3\*(C'\fR, and \f(CW\*(C`environ\*(C'\fR.
  2421. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2422. .IP "\fB\-\-exclude\-symbols\fR \fIsymbol\fR\fB,\fR\fIsymbol\fR\fB,...\fR" 4
  2423. .IX Item "--exclude-symbols symbol,symbol,..."
  2424. Specifies a list of symbols which should not be automatically
  2425. exported. The symbol names may be delimited by commas or colons.
  2426. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2427. .IP "\fB\-\-exclude\-all\-symbols\fR" 4
  2428. .IX Item "--exclude-all-symbols"
  2429. Specifies no symbols should be automatically exported.
  2430. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2431. .IP "\fB\-\-file\-alignment\fR" 4
  2432. .IX Item "--file-alignment"
  2433. Specify the file alignment. Sections in the file will always begin at
  2434. file offsets which are multiples of this number. This defaults to
  2435. 512.
  2436. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2437. .IP "\fB\-\-heap\fR \fIreserve\fR" 4
  2438. .IX Item "--heap reserve"
  2439. .PD 0
  2440. .IP "\fB\-\-heap\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
  2441. .IX Item "--heap reserve,commit"
  2442. .PD
  2443. Specify the number of bytes of memory to reserve (and optionally commit)
  2444. to be used as heap for this program. The default is 1MB reserved, 4K
  2445. committed.
  2446. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2447. .IP "\fB\-\-image\-base\fR \fIvalue\fR" 4
  2448. .IX Item "--image-base value"
  2449. Use \fIvalue\fR as the base address of your program or dll. This is
  2450. the lowest memory location that will be used when your program or dll
  2451. is loaded. To reduce the need to relocate and improve performance of
  2452. your dlls, each should have a unique base address and not overlap any
  2453. other dlls. The default is 0x400000 for executables, and 0x10000000
  2454. for dlls.
  2455. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2456. .IP "\fB\-\-kill\-at\fR" 4
  2457. .IX Item "--kill-at"
  2458. If given, the stdcall suffixes (@\fInn\fR) will be stripped from
  2459. symbols before they are exported.
  2460. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2461. .IP "\fB\-\-large\-address\-aware\fR" 4
  2462. .IX Item "--large-address-aware"
  2463. If given, the appropriate bit in the \*(L"Characteristics\*(R" field of the \s-1COFF\s0
  2464. header is set to indicate that this executable supports virtual addresses
  2465. greater than 2 gigabytes. This should be used in conjunction with the /3GB
  2466. or /USERVA=\fIvalue\fR megabytes switch in the \*(L"[operating systems]\*(R"
  2467. section of the \s-1BOOT.INI.\s0 Otherwise, this bit has no effect.
  2468. [This option is specific to \s-1PE\s0 targeted ports of the linker]
  2469. .IP "\fB\-\-disable\-large\-address\-aware\fR" 4
  2470. .IX Item "--disable-large-address-aware"
  2471. Reverts the effect of a previous \fB\-\-large\-address\-aware\fR option.
  2472. This is useful if \fB\-\-large\-address\-aware\fR is always set by the compiler
  2473. driver (e.g. Cygwin gcc) and the executable does not support virtual
  2474. addresses greater than 2 gigabytes.
  2475. [This option is specific to \s-1PE\s0 targeted ports of the linker]
  2476. .IP "\fB\-\-major\-image\-version\fR \fIvalue\fR" 4
  2477. .IX Item "--major-image-version value"
  2478. Sets the major number of the \*(L"image version\*(R". Defaults to 1.
  2479. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2480. .IP "\fB\-\-major\-os\-version\fR \fIvalue\fR" 4
  2481. .IX Item "--major-os-version value"
  2482. Sets the major number of the \*(L"os version\*(R". Defaults to 4.
  2483. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2484. .IP "\fB\-\-major\-subsystem\-version\fR \fIvalue\fR" 4
  2485. .IX Item "--major-subsystem-version value"
  2486. Sets the major number of the \*(L"subsystem version\*(R". Defaults to 4.
  2487. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2488. .IP "\fB\-\-minor\-image\-version\fR \fIvalue\fR" 4
  2489. .IX Item "--minor-image-version value"
  2490. Sets the minor number of the \*(L"image version\*(R". Defaults to 0.
  2491. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2492. .IP "\fB\-\-minor\-os\-version\fR \fIvalue\fR" 4
  2493. .IX Item "--minor-os-version value"
  2494. Sets the minor number of the \*(L"os version\*(R". Defaults to 0.
  2495. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2496. .IP "\fB\-\-minor\-subsystem\-version\fR \fIvalue\fR" 4
  2497. .IX Item "--minor-subsystem-version value"
  2498. Sets the minor number of the \*(L"subsystem version\*(R". Defaults to 0.
  2499. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2500. .IP "\fB\-\-output\-def\fR \fIfile\fR" 4
  2501. .IX Item "--output-def file"
  2502. The linker will create the file \fIfile\fR which will contain a \s-1DEF\s0
  2503. file corresponding to the \s-1DLL\s0 the linker is generating. This \s-1DEF\s0 file
  2504. (which should be called \f(CW\*(C`*.def\*(C'\fR) may be used to create an import
  2505. library with \f(CW\*(C`dlltool\*(C'\fR or may be used as a reference to
  2506. automatically or implicitly exported symbols.
  2507. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2508. .IP "\fB\-\-enable\-auto\-image\-base\fR" 4
  2509. .IX Item "--enable-auto-image-base"
  2510. .PD 0
  2511. .IP "\fB\-\-enable\-auto\-image\-base=\fR\fIvalue\fR" 4
  2512. .IX Item "--enable-auto-image-base=value"
  2513. .PD
  2514. Automatically choose the image base for DLLs, optionally starting with base
  2515. \&\fIvalue\fR, unless one is specified using the \f(CW\*(C`\-\-image\-base\*(C'\fR argument.
  2516. By using a hash generated from the dllname to create unique image bases
  2517. for each \s-1DLL,\s0 in-memory collisions and relocations which can delay program
  2518. execution are avoided.
  2519. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2520. .IP "\fB\-\-disable\-auto\-image\-base\fR" 4
  2521. .IX Item "--disable-auto-image-base"
  2522. Do not automatically generate a unique image base. If there is no
  2523. user-specified image base (\f(CW\*(C`\-\-image\-base\*(C'\fR) then use the platform
  2524. default.
  2525. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2526. .IP "\fB\-\-dll\-search\-prefix\fR \fIstring\fR" 4
  2527. .IX Item "--dll-search-prefix string"
  2528. When linking dynamically to a dll without an import library,
  2529. search for \f(CW\*(C`<string><basename>.dll\*(C'\fR in preference to
  2530. \&\f(CW\*(C`lib<basename>.dll\*(C'\fR. This behaviour allows easy distinction
  2531. between DLLs built for the various \*(L"subplatforms\*(R": native, cygwin,
  2532. uwin, pw, etc. For instance, cygwin DLLs typically use
  2533. \&\f(CW\*(C`\-\-dll\-search\-prefix=cyg\*(C'\fR.
  2534. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2535. .IP "\fB\-\-enable\-auto\-import\fR" 4
  2536. .IX Item "--enable-auto-import"
  2537. Do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to \f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for
  2538. \&\s-1DATA\s0 imports from DLLs, thus making it possible to bypass the dllimport
  2539. mechanism on the user side and to reference unmangled symbol names.
  2540. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2541. .Sp
  2542. The following remarks pertain to the original implementation of the
  2543. feature and are obsolete nowadays for Cygwin and MinGW targets.
  2544. .Sp
  2545. Note: Use of the 'auto\-import' extension will cause the text section
  2546. of the image file to be made writable. This does not conform to the
  2547. PE-COFF format specification published by Microsoft.
  2548. .Sp
  2549. Note \- use of the 'auto\-import' extension will also cause read only
  2550. data which would normally be placed into the .rdata section to be
  2551. placed into the .data section instead. This is in order to work
  2552. around a problem with consts that is described here:
  2553. http://www.cygwin.com/ml/cygwin/2004\-09/msg01101.html
  2554. .Sp
  2555. Using 'auto\-import' generally will 'just work' \*(-- but sometimes you may
  2556. see this message:
  2557. .Sp
  2558. "variable '<var>' can't be auto-imported. Please read the
  2559. documentation for ld's \f(CW\*(C`\-\-enable\-auto\-import\*(C'\fR for details."
  2560. .Sp
  2561. This message occurs when some (sub)expression accesses an address
  2562. ultimately given by the sum of two constants (Win32 import tables only
  2563. allow one). Instances where this may occur include accesses to member
  2564. fields of struct variables imported from a \s-1DLL,\s0 as well as using a
  2565. constant index into an array variable imported from a \s-1DLL.\s0 Any
  2566. multiword variable (arrays, structs, long long, etc) may trigger
  2567. this error condition. However, regardless of the exact data type
  2568. of the offending exported variable, ld will always detect it, issue
  2569. the warning, and exit.
  2570. .Sp
  2571. There are several ways to address this difficulty, regardless of the
  2572. data type of the exported variable:
  2573. .Sp
  2574. One way is to use \-\-enable\-runtime\-pseudo\-reloc switch. This leaves the task
  2575. of adjusting references in your client code for runtime environment, so
  2576. this method works only when runtime environment supports this feature.
  2577. .Sp
  2578. A second solution is to force one of the 'constants' to be a variable \*(--
  2579. that is, unknown and un-optimizable at compile time. For arrays,
  2580. there are two possibilities: a) make the indexee (the array's address)
  2581. a variable, or b) make the 'constant' index a variable. Thus:
  2582. .Sp
  2583. .Vb 3
  2584. \& extern type extern_array[];
  2585. \& extern_array[1] \-\->
  2586. \& { volatile type *t=extern_array; t[1] }
  2587. .Ve
  2588. .Sp
  2589. or
  2590. .Sp
  2591. .Vb 3
  2592. \& extern type extern_array[];
  2593. \& extern_array[1] \-\->
  2594. \& { volatile int t=1; extern_array[t] }
  2595. .Ve
  2596. .Sp
  2597. For structs (and most other multiword data types) the only option
  2598. is to make the struct itself (or the long long, or the ...) variable:
  2599. .Sp
  2600. .Vb 3
  2601. \& extern struct s extern_struct;
  2602. \& extern_struct.field \-\->
  2603. \& { volatile struct s *t=&extern_struct; t\->field }
  2604. .Ve
  2605. .Sp
  2606. or
  2607. .Sp
  2608. .Vb 3
  2609. \& extern long long extern_ll;
  2610. \& extern_ll \-\->
  2611. \& { volatile long long * local_ll=&extern_ll; *local_ll }
  2612. .Ve
  2613. .Sp
  2614. A third method of dealing with this difficulty is to abandon
  2615. \&'auto\-import' for the offending symbol and mark it with
  2616. \&\f(CW\*(C`_\|_declspec(dllimport)\*(C'\fR. However, in practice that
  2617. requires using compile-time #defines to indicate whether you are
  2618. building a \s-1DLL,\s0 building client code that will link to the \s-1DLL,\s0 or
  2619. merely building/linking to a static library. In making the choice
  2620. between the various methods of resolving the 'direct address with
  2621. constant offset' problem, you should consider typical real-world usage:
  2622. .Sp
  2623. Original:
  2624. .Sp
  2625. .Vb 7
  2626. \& \-\-foo.h
  2627. \& extern int arr[];
  2628. \& \-\-foo.c
  2629. \& #include "foo.h"
  2630. \& void main(int argc, char **argv){
  2631. \& printf("%d\en",arr[1]);
  2632. \& }
  2633. .Ve
  2634. .Sp
  2635. Solution 1:
  2636. .Sp
  2637. .Vb 9
  2638. \& \-\-foo.h
  2639. \& extern int arr[];
  2640. \& \-\-foo.c
  2641. \& #include "foo.h"
  2642. \& void main(int argc, char **argv){
  2643. \& /* This workaround is for win32 and cygwin; do not "optimize" */
  2644. \& volatile int *parr = arr;
  2645. \& printf("%d\en",parr[1]);
  2646. \& }
  2647. .Ve
  2648. .Sp
  2649. Solution 2:
  2650. .Sp
  2651. .Vb 10
  2652. \& \-\-foo.h
  2653. \& /* Note: auto\-export is assumed (no _\|_declspec(dllexport)) */
  2654. \& #if (defined(_WIN32) || defined(_\|_CYGWIN_\|_)) && \e
  2655. \& !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
  2656. \& #define FOO_IMPORT _\|_declspec(dllimport)
  2657. \& #else
  2658. \& #define FOO_IMPORT
  2659. \& #endif
  2660. \& extern FOO_IMPORT int arr[];
  2661. \& \-\-foo.c
  2662. \& #include "foo.h"
  2663. \& void main(int argc, char **argv){
  2664. \& printf("%d\en",arr[1]);
  2665. \& }
  2666. .Ve
  2667. .Sp
  2668. A fourth way to avoid this problem is to re-code your
  2669. library to use a functional interface rather than a data interface
  2670. for the offending variables (e.g. \fBset_foo()\fR and \fBget_foo()\fR accessor
  2671. functions).
  2672. .IP "\fB\-\-disable\-auto\-import\fR" 4
  2673. .IX Item "--disable-auto-import"
  2674. Do not attempt to do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to
  2675. \&\f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for \s-1DATA\s0 imports from DLLs.
  2676. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2677. .IP "\fB\-\-enable\-runtime\-pseudo\-reloc\fR" 4
  2678. .IX Item "--enable-runtime-pseudo-reloc"
  2679. If your code contains expressions described in \-\-enable\-auto\-import section,
  2680. that is, \s-1DATA\s0 imports from \s-1DLL\s0 with non-zero offset, this switch will create
  2681. a vector of 'runtime pseudo relocations' which can be used by runtime
  2682. environment to adjust references to such data in your client code.
  2683. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2684. .IP "\fB\-\-disable\-runtime\-pseudo\-reloc\fR" 4
  2685. .IX Item "--disable-runtime-pseudo-reloc"
  2686. Do not create pseudo relocations for non-zero offset \s-1DATA\s0 imports from DLLs.
  2687. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2688. .IP "\fB\-\-enable\-extra\-pe\-debug\fR" 4
  2689. .IX Item "--enable-extra-pe-debug"
  2690. Show additional debug info related to auto-import symbol thunking.
  2691. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2692. .IP "\fB\-\-section\-alignment\fR" 4
  2693. .IX Item "--section-alignment"
  2694. Sets the section alignment. Sections in memory will always begin at
  2695. addresses which are a multiple of this number. Defaults to 0x1000.
  2696. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2697. .IP "\fB\-\-stack\fR \fIreserve\fR" 4
  2698. .IX Item "--stack reserve"
  2699. .PD 0
  2700. .IP "\fB\-\-stack\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
  2701. .IX Item "--stack reserve,commit"
  2702. .PD
  2703. Specify the number of bytes of memory to reserve (and optionally commit)
  2704. to be used as stack for this program. The default is 2MB reserved, 4K
  2705. committed.
  2706. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2707. .IP "\fB\-\-subsystem\fR \fIwhich\fR" 4
  2708. .IX Item "--subsystem which"
  2709. .PD 0
  2710. .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR" 4
  2711. .IX Item "--subsystem which:major"
  2712. .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR\fB.\fR\fIminor\fR" 4
  2713. .IX Item "--subsystem which:major.minor"
  2714. .PD
  2715. Specifies the subsystem under which your program will execute. The
  2716. legal values for \fIwhich\fR are \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`windows\*(C'\fR,
  2717. \&\f(CW\*(C`console\*(C'\fR, \f(CW\*(C`posix\*(C'\fR, and \f(CW\*(C`xbox\*(C'\fR. You may optionally set
  2718. the subsystem version also. Numeric values are also accepted for
  2719. \&\fIwhich\fR.
  2720. [This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
  2721. .Sp
  2722. The following options set flags in the \f(CW\*(C`DllCharacteristics\*(C'\fR field
  2723. of the \s-1PE\s0 file header:
  2724. [These options are specific to \s-1PE\s0 targeted ports of the linker]
  2725. .IP "\fB\-\-high\-entropy\-va\fR" 4
  2726. .IX Item "--high-entropy-va"
  2727. Image is compatible with 64\-bit address space layout randomization
  2728. (\s-1ASLR\s0).
  2729. .IP "\fB\-\-dynamicbase\fR" 4
  2730. .IX Item "--dynamicbase"
  2731. The image base address may be relocated using address space layout
  2732. randomization (\s-1ASLR\s0). This feature was introduced with \s-1MS\s0 Windows
  2733. Vista for i386 \s-1PE\s0 targets.
  2734. .IP "\fB\-\-forceinteg\fR" 4
  2735. .IX Item "--forceinteg"
  2736. Code integrity checks are enforced.
  2737. .IP "\fB\-\-nxcompat\fR" 4
  2738. .IX Item "--nxcompat"
  2739. The image is compatible with the Data Execution Prevention.
  2740. This feature was introduced with \s-1MS\s0 Windows \s-1XP SP2\s0 for i386 \s-1PE\s0 targets.
  2741. .IP "\fB\-\-no\-isolation\fR" 4
  2742. .IX Item "--no-isolation"
  2743. Although the image understands isolation, do not isolate the image.
  2744. .IP "\fB\-\-no\-seh\fR" 4
  2745. .IX Item "--no-seh"
  2746. The image does not use \s-1SEH.\s0 No \s-1SE\s0 handler may be called from
  2747. this image.
  2748. .IP "\fB\-\-no\-bind\fR" 4
  2749. .IX Item "--no-bind"
  2750. Do not bind this image.
  2751. .IP "\fB\-\-wdmdriver\fR" 4
  2752. .IX Item "--wdmdriver"
  2753. The driver uses the \s-1MS\s0 Windows Driver Model.
  2754. .IP "\fB\-\-tsaware\fR" 4
  2755. .IX Item "--tsaware"
  2756. The image is Terminal Server aware.
  2757. .IP "\fB\-\-insert\-timestamp\fR" 4
  2758. .IX Item "--insert-timestamp"
  2759. .PD 0
  2760. .IP "\fB\-\-no\-insert\-timestamp\fR" 4
  2761. .IX Item "--no-insert-timestamp"
  2762. .PD
  2763. Insert a real timestamp into the image. This is the default behaviour
  2764. as it matches legacy code and it means that the image will work with
  2765. other, proprietary tools. The problem with this default is that it
  2766. will result in slightly different images being produced each time the
  2767. same sources are linked. The option \fB\-\-no\-insert\-timestamp\fR
  2768. can be used to insert a zero value for the timestamp, this ensuring
  2769. that binaries produced from identical sources will compare
  2770. identically.
  2771. .PP
  2772. The C6X uClinux target uses a binary format called \s-1DSBT\s0 to support shared
  2773. libraries. Each shared library in the system needs to have a unique index;
  2774. all executables use an index of 0.
  2775. .IP "\fB\-\-dsbt\-size\fR \fIsize\fR" 4
  2776. .IX Item "--dsbt-size size"
  2777. This option sets the number of entries in the \s-1DSBT\s0 of the current executable
  2778. or shared library to \fIsize\fR. The default is to create a table with 64
  2779. entries.
  2780. .IP "\fB\-\-dsbt\-index\fR \fIindex\fR" 4
  2781. .IX Item "--dsbt-index index"
  2782. This option sets the \s-1DSBT\s0 index of the current executable or shared library
  2783. to \fIindex\fR. The default is 0, which is appropriate for generating
  2784. executables. If a shared library is generated with a \s-1DSBT\s0 index of 0, the
  2785. \&\f(CW\*(C`R_C6000_DSBT_INDEX\*(C'\fR relocs are copied into the output file.
  2786. .Sp
  2787. The \fB\-\-no\-merge\-exidx\-entries\fR switch disables the merging of adjacent
  2788. exidx entries in frame unwind info.
  2789. .IP "\fB\-\-branch\-stub\fR" 4
  2790. .IX Item "--branch-stub"
  2791. This option enables linker branch relaxation by inserting branch stub
  2792. sections when needed to extend the range of branches. This option is
  2793. usually not required since C\-SKY supports branch and call instructions that
  2794. can access the full memory range and branch relaxation is normally handled by
  2795. the compiler or assembler.
  2796. .IP "\fB\-\-stub\-group\-size=\fR\fIN\fR" 4
  2797. .IX Item "--stub-group-size=N"
  2798. This option allows finer control of linker branch stub creation.
  2799. It sets the maximum size of a group of input sections that can
  2800. be handled by one stub section. A negative value of \fIN\fR locates
  2801. stub sections after their branches, while a positive value allows stub
  2802. sections to appear either before or after the branches. Values of
  2803. \&\fB1\fR or \fB\-1\fR indicate that the
  2804. linker should choose suitable defaults.
  2805. .PP
  2806. The 68HC11 and 68HC12 linkers support specific options to control the
  2807. memory bank switching mapping and trampoline code generation.
  2808. .IP "\fB\-\-no\-trampoline\fR" 4
  2809. .IX Item "--no-trampoline"
  2810. This option disables the generation of trampoline. By default a trampoline
  2811. is generated for each far function which is called using a \f(CW\*(C`jsr\*(C'\fR
  2812. instruction (this happens when a pointer to a far function is taken).
  2813. .IP "\fB\-\-bank\-window\fR \fIname\fR" 4
  2814. .IX Item "--bank-window name"
  2815. This option indicates to the linker the name of the memory region in
  2816. the \fB\s-1MEMORY\s0\fR specification that describes the memory bank window.
  2817. The definition of such region is then used by the linker to compute
  2818. paging and addresses within the memory window.
  2819. .PP
  2820. The following options are supported to control handling of \s-1GOT\s0 generation
  2821. when linking for 68K targets.
  2822. .IP "\fB\-\-got=\fR\fItype\fR" 4
  2823. .IX Item "--got=type"
  2824. This option tells the linker which \s-1GOT\s0 generation scheme to use.
  2825. \&\fItype\fR should be one of \fBsingle\fR, \fBnegative\fR,
  2826. \&\fBmultigot\fR or \fBtarget\fR. For more information refer to the
  2827. Info entry for \fIld\fR.
  2828. .PP
  2829. The following options are supported to control microMIPS instruction
  2830. generation and branch relocation checks for \s-1ISA\s0 mode transitions when
  2831. linking for \s-1MIPS\s0 targets.
  2832. .IP "\fB\-\-insn32\fR" 4
  2833. .IX Item "--insn32"
  2834. .PD 0
  2835. .IP "\fB\-\-no\-insn32\fR" 4
  2836. .IX Item "--no-insn32"
  2837. .PD
  2838. These options control the choice of microMIPS instructions used in code
  2839. generated by the linker, such as that in the \s-1PLT\s0 or lazy binding stubs,
  2840. or in relaxation. If \fB\-\-insn32\fR is used, then the linker only uses
  2841. 32\-bit instruction encodings. By default or if \fB\-\-no\-insn32\fR is
  2842. used, all instruction encodings are used, including 16\-bit ones where
  2843. possible.
  2844. .IP "\fB\-\-ignore\-branch\-isa\fR" 4
  2845. .IX Item "--ignore-branch-isa"
  2846. .PD 0
  2847. .IP "\fB\-\-no\-ignore\-branch\-isa\fR" 4
  2848. .IX Item "--no-ignore-branch-isa"
  2849. .PD
  2850. These options control branch relocation checks for invalid \s-1ISA\s0 mode
  2851. transitions. If \fB\-\-ignore\-branch\-isa\fR is used, then the linker
  2852. accepts any branch relocations and any \s-1ISA\s0 mode transition required
  2853. is lost in relocation calculation, except for some cases of \f(CW\*(C`BAL\*(C'\fR
  2854. instructions which meet relaxation conditions and are converted to
  2855. equivalent \f(CW\*(C`JALX\*(C'\fR instructions as the associated relocation is
  2856. calculated. By default or if \fB\-\-no\-ignore\-branch\-isa\fR is used
  2857. a check is made causing the loss of an \s-1ISA\s0 mode transition to produce
  2858. an error.
  2859. .SH "ENVIRONMENT"
  2860. .IX Header "ENVIRONMENT"
  2861. You can change the behaviour of \fBld\fR with the environment variables
  2862. \&\f(CW\*(C`GNUTARGET\*(C'\fR,
  2863. \&\f(CW\*(C`LDEMULATION\*(C'\fR and \f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR.
  2864. .PP
  2865. \&\f(CW\*(C`GNUTARGET\*(C'\fR determines the input-file object format if you don't
  2866. use \fB\-b\fR (or its synonym \fB\-\-format\fR). Its value should be one
  2867. of the \s-1BFD\s0 names for an input format. If there is no
  2868. \&\f(CW\*(C`GNUTARGET\*(C'\fR in the environment, \fBld\fR uses the natural format
  2869. of the target. If \f(CW\*(C`GNUTARGET\*(C'\fR is set to \f(CW\*(C`default\*(C'\fR then \s-1BFD\s0
  2870. attempts to discover the input format by examining binary input files;
  2871. this method often succeeds, but there are potential ambiguities, since
  2872. there is no method of ensuring that the magic number used to specify
  2873. object-file formats is unique. However, the configuration procedure for
  2874. \&\s-1BFD\s0 on each system places the conventional format for that system first
  2875. in the search-list, so ambiguities are resolved in favor of convention.
  2876. .PP
  2877. \&\f(CW\*(C`LDEMULATION\*(C'\fR determines the default emulation if you don't use the
  2878. \&\fB\-m\fR option. The emulation can affect various aspects of linker
  2879. behaviour, particularly the default linker script. You can list the
  2880. available emulations with the \fB\-\-verbose\fR or \fB\-V\fR options. If
  2881. the \fB\-m\fR option is not used, and the \f(CW\*(C`LDEMULATION\*(C'\fR environment
  2882. variable is not defined, the default emulation depends upon how the
  2883. linker was configured.
  2884. .PP
  2885. Normally, the linker will default to demangling symbols. However, if
  2886. \&\f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR is set in the environment, then it will
  2887. default to not demangling symbols. This environment variable is used in
  2888. a similar fashion by the \f(CW\*(C`gcc\*(C'\fR linker wrapper program. The default
  2889. may be overridden by the \fB\-\-demangle\fR and \fB\-\-no\-demangle\fR
  2890. options.
  2891. .SH "SEE ALSO"
  2892. .IX Header "SEE ALSO"
  2893. \&\fBar\fR\|(1), \fBnm\fR\|(1), \fBobjcopy\fR\|(1), \fBobjdump\fR\|(1), \fBreadelf\fR\|(1) and
  2894. the Info entries for \fIbinutils\fR and
  2895. \&\fIld\fR.
  2896. .SH "COPYRIGHT"
  2897. .IX Header "COPYRIGHT"
  2898. Copyright (c) 1991\-2019 Free Software Foundation, Inc.
  2899. .PP
  2900. Permission is granted to copy, distribute and/or modify this document
  2901. under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
  2902. or any later version published by the Free Software Foundation;
  2903. with no Invariant Sections, with no Front-Cover Texts, and with no
  2904. Back-Cover Texts. A copy of the license is included in the
  2905. section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".