Link-Options.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>Using the GNU Compiler Collection (GCC): Link Options</title>
  20. <meta name="description" content="Using the GNU Compiler Collection (GCC): Link Options">
  21. <meta name="keywords" content="Using the GNU Compiler Collection (GCC): Link Options">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Invoking-GCC.html#Invoking-GCC" rel="up" title="Invoking GCC">
  30. <link href="Directory-Options.html#Directory-Options" rel="next" title="Directory Options">
  31. <link href="Assembler-Options.html#Assembler-Options" rel="prev" title="Assembler Options">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Link-Options"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Directory-Options.html#Directory-Options" accesskey="n" rel="next">Directory Options</a>, Previous: <a href="Assembler-Options.html#Assembler-Options" accesskey="p" rel="prev">Assembler Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="Options-for-Linking"></a>
  69. <h3 class="section">3.14 Options for Linking</h3>
  70. <a name="index-link-options"></a>
  71. <a name="index-options_002c-linking"></a>
  72. <p>These options come into play when the compiler links object files into
  73. an executable output file. They are meaningless if the compiler is
  74. not doing a link step.
  75. </p>
  76. <dl compact="compact">
  77. <dd><a name="index-file-names"></a>
  78. </dd>
  79. <dt><code><var>object-file-name</var></code></dt>
  80. <dd><p>A file name that does not end in a special recognized suffix is
  81. considered to name an object file or library. (Object files are
  82. distinguished from libraries by the linker according to the file
  83. contents.) If linking is done, these object files are used as input
  84. to the linker.
  85. </p>
  86. </dd>
  87. <dt><code>-c</code></dt>
  88. <dt><code>-S</code></dt>
  89. <dt><code>-E</code></dt>
  90. <dd><a name="index-c-1"></a>
  91. <a name="index-S-1"></a>
  92. <a name="index-E-1"></a>
  93. <p>If any of these options is used, then the linker is not run, and
  94. object file names should not be used as arguments. See <a href="Overall-Options.html#Overall-Options">Overall Options</a>.
  95. </p>
  96. </dd>
  97. <dt><code>-fuse-ld=bfd</code></dt>
  98. <dd><a name="index-fuse_002dld_003dbfd"></a>
  99. <p>Use the <code>bfd</code> linker instead of the default linker.
  100. </p>
  101. </dd>
  102. <dt><code>-fuse-ld=gold</code></dt>
  103. <dd><a name="index-fuse_002dld_003dgold"></a>
  104. <p>Use the <code>gold</code> linker instead of the default linker.
  105. </p>
  106. <a name="index-Libraries"></a>
  107. </dd>
  108. <dt><code>-l<var>library</var></code></dt>
  109. <dt><code>-l <var>library</var></code></dt>
  110. <dd><a name="index-l"></a>
  111. <p>Search the library named <var>library</var> when linking. (The second
  112. alternative with the library as a separate argument is only for
  113. POSIX compliance and is not recommended.)
  114. </p>
  115. <p>It makes a difference where in the command you write this option; the
  116. linker searches and processes libraries and object files in the order they
  117. are specified. Thus, &lsquo;<samp>foo.o -lz bar.o</samp>&rsquo; searches library &lsquo;<samp>z</samp>&rsquo;
  118. after file <samp>foo.o</samp> but before <samp>bar.o</samp>. If <samp>bar.o</samp> refers
  119. to functions in &lsquo;<samp>z</samp>&rsquo;, those functions may not be loaded.
  120. </p>
  121. <p>The linker searches a standard list of directories for the library,
  122. which is actually a file named <samp>lib<var>library</var>.a</samp>. The linker
  123. then uses this file as if it had been specified precisely by name.
  124. </p>
  125. <p>The directories searched include several standard system directories
  126. plus any that you specify with <samp>-L</samp>.
  127. </p>
  128. <p>Normally the files found this way are library files&mdash;archive files
  129. whose members are object files. The linker handles an archive file by
  130. scanning through it for members which define symbols that have so far
  131. been referenced but not defined. But if the file that is found is an
  132. ordinary object file, it is linked in the usual fashion. The only
  133. difference between using an <samp>-l</samp> option and specifying a file name
  134. is that <samp>-l</samp> surrounds <var>library</var> with &lsquo;<samp>lib</samp>&rsquo; and &lsquo;<samp>.a</samp>&rsquo;
  135. and searches several directories.
  136. </p>
  137. </dd>
  138. <dt><code>-lobjc</code></dt>
  139. <dd><a name="index-lobjc"></a>
  140. <p>You need this special case of the <samp>-l</samp> option in order to
  141. link an Objective-C or Objective-C++ program.
  142. </p>
  143. </dd>
  144. <dt><code>-nostartfiles</code></dt>
  145. <dd><a name="index-nostartfiles"></a>
  146. <p>Do not use the standard system startup files when linking.
  147. The standard system libraries are used normally, unless <samp>-nostdlib</samp>
  148. or <samp>-nodefaultlibs</samp> is used.
  149. </p>
  150. </dd>
  151. <dt><code>-nodefaultlibs</code></dt>
  152. <dd><a name="index-nodefaultlibs"></a>
  153. <p>Do not use the standard system libraries when linking.
  154. Only the libraries you specify are passed to the linker, and options
  155. specifying linkage of the system libraries, such as <samp>-static-libgcc</samp>
  156. or <samp>-shared-libgcc</samp>, are ignored.
  157. The standard startup files are used normally, unless <samp>-nostartfiles</samp>
  158. is used.
  159. </p>
  160. <p>The compiler may generate calls to <code>memcmp</code>,
  161. <code>memset</code>, <code>memcpy</code> and <code>memmove</code>.
  162. These entries are usually resolved by entries in
  163. libc. These entry points should be supplied through some other
  164. mechanism when this option is specified.
  165. </p>
  166. </dd>
  167. <dt><code>-nostdlib</code></dt>
  168. <dd><a name="index-nostdlib"></a>
  169. <p>Do not use the standard system startup files or libraries when linking.
  170. No startup files and only the libraries you specify are passed to
  171. the linker, and options specifying linkage of the system libraries, such as
  172. <samp>-static-libgcc</samp> or <samp>-shared-libgcc</samp>, are ignored.
  173. </p>
  174. <p>The compiler may generate calls to <code>memcmp</code>, <code>memset</code>,
  175. <code>memcpy</code> and <code>memmove</code>.
  176. These entries are usually resolved by entries in
  177. libc. These entry points should be supplied through some other
  178. mechanism when this option is specified.
  179. </p>
  180. <a name="index-_002dlgcc_002c-use-with-_002dnostdlib"></a>
  181. <a name="index-_002dnostdlib-and-unresolved-references"></a>
  182. <a name="index-unresolved-references-and-_002dnostdlib"></a>
  183. <a name="index-_002dlgcc_002c-use-with-_002dnodefaultlibs"></a>
  184. <a name="index-_002dnodefaultlibs-and-unresolved-references"></a>
  185. <a name="index-unresolved-references-and-_002dnodefaultlibs"></a>
  186. <p>One of the standard libraries bypassed by <samp>-nostdlib</samp> and
  187. <samp>-nodefaultlibs</samp> is <samp>libgcc.a</samp>, a library of internal subroutines
  188. which GCC uses to overcome shortcomings of particular machines, or special
  189. needs for some languages.
  190. (See <a href="http://gcc.gnu.org/onlinedocs/gccint/Interface.html#Interface">Interfacing to GCC Output</a> in <cite>GNU Compiler
  191. Collection (GCC) Internals</cite>,
  192. for more discussion of <samp>libgcc.a</samp>.)
  193. In most cases, you need <samp>libgcc.a</samp> even when you want to avoid
  194. other standard libraries. In other words, when you specify <samp>-nostdlib</samp>
  195. or <samp>-nodefaultlibs</samp> you should usually specify <samp>-lgcc</samp> as well.
  196. This ensures that you have no unresolved references to internal GCC
  197. library subroutines.
  198. (An example of such an internal subroutine is <code>__main</code>, used to ensure C++
  199. constructors are called; see <a href="http://gcc.gnu.org/onlinedocs/gccint/Collect2.html#Collect2"><code>collect2</code></a> in <cite>GNU Compiler Collection (GCC) Internals</cite>.)
  200. </p>
  201. </dd>
  202. <dt><code>-pie</code></dt>
  203. <dd><a name="index-pie"></a>
  204. <p>Produce a position independent executable on targets that support it.
  205. For predictable results, you must also specify the same set of options
  206. used for compilation (<samp>-fpie</samp>, <samp>-fPIE</samp>,
  207. or model suboptions) when you specify this linker option.
  208. </p>
  209. </dd>
  210. <dt><code>-no-pie</code></dt>
  211. <dd><a name="index-no_002dpie"></a>
  212. <p>Don&rsquo;t produce a position independent executable.
  213. </p>
  214. </dd>
  215. <dt><code>-pthread</code></dt>
  216. <dd><a name="index-pthread-1"></a>
  217. <p>Link with the POSIX threads library. This option is supported on
  218. GNU/Linux targets, most other Unix derivatives, and also on
  219. x86 Cygwin and MinGW targets. On some targets this option also sets
  220. flags for the preprocessor, so it should be used consistently for both
  221. compilation and linking.
  222. </p>
  223. </dd>
  224. <dt><code>-rdynamic</code></dt>
  225. <dd><a name="index-rdynamic"></a>
  226. <p>Pass the flag <samp>-export-dynamic</samp> to the ELF linker, on targets
  227. that support it. This instructs the linker to add all symbols, not
  228. only used ones, to the dynamic symbol table. This option is needed
  229. for some uses of <code>dlopen</code> or to allow obtaining backtraces
  230. from within a program.
  231. </p>
  232. </dd>
  233. <dt><code>-s</code></dt>
  234. <dd><a name="index-s"></a>
  235. <p>Remove all symbol table and relocation information from the executable.
  236. </p>
  237. </dd>
  238. <dt><code>-static</code></dt>
  239. <dd><a name="index-static"></a>
  240. <p>On systems that support dynamic linking, this prevents linking with the shared
  241. libraries. On other systems, this option has no effect.
  242. </p>
  243. </dd>
  244. <dt><code>-shared</code></dt>
  245. <dd><a name="index-shared"></a>
  246. <p>Produce a shared object which can then be linked with other objects to
  247. form an executable. Not all systems support this option. For predictable
  248. results, you must also specify the same set of options used for compilation
  249. (<samp>-fpic</samp>, <samp>-fPIC</samp>, or model suboptions) when
  250. you specify this linker option.<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>
  251. </p>
  252. </dd>
  253. <dt><code>-shared-libgcc</code></dt>
  254. <dt><code>-static-libgcc</code></dt>
  255. <dd><a name="index-shared_002dlibgcc"></a>
  256. <a name="index-static_002dlibgcc"></a>
  257. <p>On systems that provide <samp>libgcc</samp> as a shared library, these options
  258. force the use of either the shared or static version, respectively.
  259. If no shared version of <samp>libgcc</samp> was built when the compiler was
  260. configured, these options have no effect.
  261. </p>
  262. <p>There are several situations in which an application should use the
  263. shared <samp>libgcc</samp> instead of the static version. The most common
  264. of these is when the application wishes to throw and catch exceptions
  265. across different shared libraries. In that case, each of the libraries
  266. as well as the application itself should use the shared <samp>libgcc</samp>.
  267. </p>
  268. <p>Therefore, the G++ driver automatically adds <samp>-shared-libgcc</samp>
  269. whenever you build a shared library or a main executable, because C++
  270. programs typically use exceptions, so this is the right thing to do.
  271. </p>
  272. <p>If, instead, you use the GCC driver to create shared libraries, you may
  273. find that they are not always linked with the shared <samp>libgcc</samp>.
  274. If GCC finds, at its configuration time, that you have a non-GNU linker
  275. or a GNU linker that does not support option <samp>--eh-frame-hdr</samp>,
  276. it links the shared version of <samp>libgcc</samp> into shared libraries
  277. by default. Otherwise, it takes advantage of the linker and optimizes
  278. away the linking with the shared version of <samp>libgcc</samp>, linking with
  279. the static version of libgcc by default. This allows exceptions to
  280. propagate through such shared libraries, without incurring relocation
  281. costs at library load time.
  282. </p>
  283. <p>However, if a library or main executable is supposed to throw or catch
  284. exceptions, you must link it using the G++ driver, or using the option
  285. <samp>-shared-libgcc</samp>, such that it is linked with the shared
  286. <samp>libgcc</samp>.
  287. </p>
  288. </dd>
  289. <dt><code>-static-libasan</code></dt>
  290. <dd><a name="index-static_002dlibasan"></a>
  291. <p>When the <samp>-fsanitize=address</samp> option is used to link a program,
  292. the GCC driver automatically links against <samp>libasan</samp>. If
  293. <samp>libasan</samp> is available as a shared library, and the <samp>-static</samp>
  294. option is not used, then this links against the shared version of
  295. <samp>libasan</samp>. The <samp>-static-libasan</samp> option directs the GCC
  296. driver to link <samp>libasan</samp> statically, without necessarily linking
  297. other libraries statically.
  298. </p>
  299. </dd>
  300. <dt><code>-static-libtsan</code></dt>
  301. <dd><a name="index-static_002dlibtsan"></a>
  302. <p>When the <samp>-fsanitize=thread</samp> option is used to link a program,
  303. the GCC driver automatically links against <samp>libtsan</samp>. If
  304. <samp>libtsan</samp> is available as a shared library, and the <samp>-static</samp>
  305. option is not used, then this links against the shared version of
  306. <samp>libtsan</samp>. The <samp>-static-libtsan</samp> option directs the GCC
  307. driver to link <samp>libtsan</samp> statically, without necessarily linking
  308. other libraries statically.
  309. </p>
  310. </dd>
  311. <dt><code>-static-liblsan</code></dt>
  312. <dd><a name="index-static_002dliblsan"></a>
  313. <p>When the <samp>-fsanitize=leak</samp> option is used to link a program,
  314. the GCC driver automatically links against <samp>liblsan</samp>. If
  315. <samp>liblsan</samp> is available as a shared library, and the <samp>-static</samp>
  316. option is not used, then this links against the shared version of
  317. <samp>liblsan</samp>. The <samp>-static-liblsan</samp> option directs the GCC
  318. driver to link <samp>liblsan</samp> statically, without necessarily linking
  319. other libraries statically.
  320. </p>
  321. </dd>
  322. <dt><code>-static-libubsan</code></dt>
  323. <dd><a name="index-static_002dlibubsan"></a>
  324. <p>When the <samp>-fsanitize=undefined</samp> option is used to link a program,
  325. the GCC driver automatically links against <samp>libubsan</samp>. If
  326. <samp>libubsan</samp> is available as a shared library, and the <samp>-static</samp>
  327. option is not used, then this links against the shared version of
  328. <samp>libubsan</samp>. The <samp>-static-libubsan</samp> option directs the GCC
  329. driver to link <samp>libubsan</samp> statically, without necessarily linking
  330. other libraries statically.
  331. </p>
  332. </dd>
  333. <dt><code>-static-libmpx</code></dt>
  334. <dd><a name="index-static_002dlibmpx"></a>
  335. <p>When the <samp>-fcheck-pointer bounds</samp> and <samp>-mmpx</samp> options are
  336. used to link a program, the GCC driver automatically links against
  337. <samp>libmpx</samp>. If <samp>libmpx</samp> is available as a shared library,
  338. and the <samp>-static</samp> option is not used, then this links against
  339. the shared version of <samp>libmpx</samp>. The <samp>-static-libmpx</samp>
  340. option directs the GCC driver to link <samp>libmpx</samp> statically,
  341. without necessarily linking other libraries statically.
  342. </p>
  343. </dd>
  344. <dt><code>-static-libmpxwrappers</code></dt>
  345. <dd><a name="index-static_002dlibmpxwrappers"></a>
  346. <p>When the <samp>-fcheck-pointer bounds</samp> and <samp>-mmpx</samp> options are used
  347. to link a program without also using <samp>-fno-chkp-use-wrappers</samp>, the
  348. GCC driver automatically links against <samp>libmpxwrappers</samp>. If
  349. <samp>libmpxwrappers</samp> is available as a shared library, and the
  350. <samp>-static</samp> option is not used, then this links against the shared
  351. version of <samp>libmpxwrappers</samp>. The <samp>-static-libmpxwrappers</samp>
  352. option directs the GCC driver to link <samp>libmpxwrappers</samp> statically,
  353. without necessarily linking other libraries statically.
  354. </p>
  355. </dd>
  356. <dt><code>-static-libstdc++</code></dt>
  357. <dd><a name="index-static_002dlibstdc_002b_002b"></a>
  358. <p>When the <code>g++</code> program is used to link a C++ program, it
  359. normally automatically links against <samp>libstdc++</samp>. If
  360. <samp>libstdc++</samp> is available as a shared library, and the
  361. <samp>-static</samp> option is not used, then this links against the
  362. shared version of <samp>libstdc++</samp>. That is normally fine. However, it
  363. is sometimes useful to freeze the version of <samp>libstdc++</samp> used by
  364. the program without going all the way to a fully static link. The
  365. <samp>-static-libstdc++</samp> option directs the <code>g++</code> driver to
  366. link <samp>libstdc++</samp> statically, without necessarily linking other
  367. libraries statically.
  368. </p>
  369. </dd>
  370. <dt><code>-symbolic</code></dt>
  371. <dd><a name="index-symbolic"></a>
  372. <p>Bind references to global symbols when building a shared object. Warn
  373. about any unresolved references (unless overridden by the link editor
  374. option <samp>-Xlinker -z -Xlinker defs</samp>). Only a few systems support
  375. this option.
  376. </p>
  377. </dd>
  378. <dt><code>-T <var>script</var></code></dt>
  379. <dd><a name="index-T"></a>
  380. <a name="index-linker-script"></a>
  381. <p>Use <var>script</var> as the linker script. This option is supported by most
  382. systems using the GNU linker. On some targets, such as bare-board
  383. targets without an operating system, the <samp>-T</samp> option may be required
  384. when linking to avoid references to undefined symbols.
  385. </p>
  386. </dd>
  387. <dt><code>-Xlinker <var>option</var></code></dt>
  388. <dd><a name="index-Xlinker"></a>
  389. <p>Pass <var>option</var> as an option to the linker. You can use this to
  390. supply system-specific linker options that GCC does not recognize.
  391. </p>
  392. <p>If you want to pass an option that takes a separate argument, you must use
  393. <samp>-Xlinker</samp> twice, once for the option and once for the argument.
  394. For example, to pass <samp>-assert definitions</samp>, you must write
  395. <samp>-Xlinker -assert -Xlinker definitions</samp>. It does not work to write
  396. <samp>-Xlinker &quot;-assert definitions&quot;</samp>, because this passes the entire
  397. string as a single argument, which is not what the linker expects.
  398. </p>
  399. <p>When using the GNU linker, it is usually more convenient to pass
  400. arguments to linker options using the <samp><var>option</var>=<var>value</var></samp>
  401. syntax than as separate arguments. For example, you can specify
  402. <samp>-Xlinker -Map=output.map</samp> rather than
  403. <samp>-Xlinker -Map -Xlinker output.map</samp>. Other linkers may not support
  404. this syntax for command-line options.
  405. </p>
  406. </dd>
  407. <dt><code>-Wl,<var>option</var></code></dt>
  408. <dd><a name="index-Wl"></a>
  409. <p>Pass <var>option</var> as an option to the linker. If <var>option</var> contains
  410. commas, it is split into multiple options at the commas. You can use this
  411. syntax to pass an argument to the option.
  412. For example, <samp>-Wl,-Map,output.map</samp> passes <samp>-Map output.map</samp> to the
  413. linker. When using the GNU linker, you can also get the same effect with
  414. <samp>-Wl,-Map=output.map</samp>.
  415. </p>
  416. </dd>
  417. <dt><code>-u <var>symbol</var></code></dt>
  418. <dd><a name="index-u"></a>
  419. <p>Pretend the symbol <var>symbol</var> is undefined, to force linking of
  420. library modules to define it. You can use <samp>-u</samp> multiple times with
  421. different symbols to force loading of additional library modules.
  422. </p>
  423. </dd>
  424. <dt><code>-z <var>keyword</var></code></dt>
  425. <dd><a name="index-z"></a>
  426. <p><samp>-z</samp> is passed directly on to the linker along with the keyword
  427. <var>keyword</var>. See the section in the documentation of your linker for
  428. permitted values and their meanings.
  429. </p></dd>
  430. </dl>
  431. <div class="footnote">
  432. <hr>
  433. <h4 class="footnotes-heading">Footnotes</h4>
  434. <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
  435. <p>On some systems, &lsquo;<samp>gcc -shared</samp>&rsquo;
  436. needs to build supplementary stub code for constructors to work. On
  437. multi-libbed systems, &lsquo;<samp>gcc -shared</samp>&rsquo; must select the correct support
  438. libraries to link against. Failing to supply the correct flags may lead
  439. to subtle defects. Supplying them in cases where they are not necessary
  440. is innocuous.</p>
  441. </div>
  442. <hr>
  443. <div class="header">
  444. <p>
  445. Next: <a href="Directory-Options.html#Directory-Options" accesskey="n" rel="next">Directory Options</a>, Previous: <a href="Assembler-Options.html#Assembler-Options" accesskey="p" rel="prev">Assembler Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  446. </div>
  447. </body>
  448. </html>