Label-Output.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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>GNU Compiler Collection (GCC) Internals: Label Output</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Label Output">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Label Output">
  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="Assembler-Format.html#Assembler-Format" rel="up" title="Assembler Format">
  30. <link href="Initialization.html#Initialization" rel="next" title="Initialization">
  31. <link href="Uninitialized-Data.html#Uninitialized-Data" rel="prev" title="Uninitialized Data">
  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="Label-Output"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Initialization.html#Initialization" accesskey="n" rel="next">Initialization</a>, Previous: <a href="Uninitialized-Data.html#Uninitialized-Data" accesskey="p" rel="prev">Uninitialized Data</a>, Up: <a href="Assembler-Format.html#Assembler-Format" accesskey="u" rel="up">Assembler Format</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="Output-and-Generation-of-Labels"></a>
  69. <h4 class="subsection">17.20.4 Output and Generation of Labels</h4>
  70. <p>This is about outputting labels.
  71. </p>
  72. <a name="index-assemble_005fname"></a>
  73. <dl>
  74. <dt><a name="index-ASM_005fOUTPUT_005fLABEL"></a>Macro: <strong>ASM_OUTPUT_LABEL</strong> <em>(<var>stream</var>, <var>name</var>)</em></dt>
  75. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  76. <var>stream</var> the assembler definition of a label named <var>name</var>.
  77. Use the expression <code>assemble_name (<var>stream</var>, <var>name</var>)</code> to
  78. output the name itself; before and after that, output the additional
  79. assembler syntax for defining the name, and a newline. A default
  80. definition of this macro is provided which is correct for most systems.
  81. </p></dd></dl>
  82. <dl>
  83. <dt><a name="index-ASM_005fOUTPUT_005fFUNCTION_005fLABEL"></a>Macro: <strong>ASM_OUTPUT_FUNCTION_LABEL</strong> <em>(<var>stream</var>, <var>name</var>, <var>decl</var>)</em></dt>
  84. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  85. <var>stream</var> the assembler definition of a label named <var>name</var> of
  86. a function.
  87. Use the expression <code>assemble_name (<var>stream</var>, <var>name</var>)</code> to
  88. output the name itself; before and after that, output the additional
  89. assembler syntax for defining the name, and a newline. A default
  90. definition of this macro is provided which is correct for most systems.
  91. </p>
  92. <p>If this macro is not defined, then the function name is defined in the
  93. usual manner as a label (by means of <code>ASM_OUTPUT_LABEL</code>).
  94. </p></dd></dl>
  95. <a name="index-assemble_005fname_005fraw"></a>
  96. <dl>
  97. <dt><a name="index-ASM_005fOUTPUT_005fINTERNAL_005fLABEL"></a>Macro: <strong>ASM_OUTPUT_INTERNAL_LABEL</strong> <em>(<var>stream</var>, <var>name</var>)</em></dt>
  98. <dd><p>Identical to <code>ASM_OUTPUT_LABEL</code>, except that <var>name</var> is known
  99. to refer to a compiler-generated label. The default definition uses
  100. <code>assemble_name_raw</code>, which is like <code>assemble_name</code> except
  101. that it is more efficient.
  102. </p></dd></dl>
  103. <dl>
  104. <dt><a name="index-SIZE_005fASM_005fOP"></a>Macro: <strong>SIZE_ASM_OP</strong></dt>
  105. <dd><p>A C string containing the appropriate assembler directive to specify the
  106. size of a symbol, without any arguments. On systems that use ELF, the
  107. default (in <samp>config/elfos.h</samp>) is &lsquo;<samp>&quot;\t.size\t&quot;</samp>&rsquo;; on other
  108. systems, the default is not to define this macro.
  109. </p>
  110. <p>Define this macro only if it is correct to use the default definitions
  111. of <code>ASM_OUTPUT_SIZE_DIRECTIVE</code> and <code>ASM_OUTPUT_MEASURED_SIZE</code>
  112. for your system. If you need your own custom definitions of those
  113. macros, or if you do not need explicit symbol sizes at all, do not
  114. define this macro.
  115. </p></dd></dl>
  116. <dl>
  117. <dt><a name="index-ASM_005fOUTPUT_005fSIZE_005fDIRECTIVE"></a>Macro: <strong>ASM_OUTPUT_SIZE_DIRECTIVE</strong> <em>(<var>stream</var>, <var>name</var>, <var>size</var>)</em></dt>
  118. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  119. <var>stream</var> a directive telling the assembler that the size of the
  120. symbol <var>name</var> is <var>size</var>. <var>size</var> is a <code>HOST_WIDE_INT</code>.
  121. If you define <code>SIZE_ASM_OP</code>, a default definition of this macro is
  122. provided.
  123. </p></dd></dl>
  124. <dl>
  125. <dt><a name="index-ASM_005fOUTPUT_005fMEASURED_005fSIZE"></a>Macro: <strong>ASM_OUTPUT_MEASURED_SIZE</strong> <em>(<var>stream</var>, <var>name</var>)</em></dt>
  126. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  127. <var>stream</var> a directive telling the assembler to calculate the size of
  128. the symbol <var>name</var> by subtracting its address from the current
  129. address.
  130. </p>
  131. <p>If you define <code>SIZE_ASM_OP</code>, a default definition of this macro is
  132. provided. The default assumes that the assembler recognizes a special
  133. &lsquo;<samp>.</samp>&rsquo; symbol as referring to the current address, and can calculate
  134. the difference between this and another symbol. If your assembler does
  135. not recognize &lsquo;<samp>.</samp>&rsquo; or cannot do calculations with it, you will need
  136. to redefine <code>ASM_OUTPUT_MEASURED_SIZE</code> to use some other technique.
  137. </p></dd></dl>
  138. <dl>
  139. <dt><a name="index-NO_005fDOLLAR_005fIN_005fLABEL"></a>Macro: <strong>NO_DOLLAR_IN_LABEL</strong></dt>
  140. <dd><p>Define this macro if the assembler does not accept the character
  141. &lsquo;<samp>$</samp>&rsquo; in label names. By default constructors and destructors in
  142. G++ have &lsquo;<samp>$</samp>&rsquo; in the identifiers. If this macro is defined,
  143. &lsquo;<samp>.</samp>&rsquo; is used instead.
  144. </p></dd></dl>
  145. <dl>
  146. <dt><a name="index-NO_005fDOT_005fIN_005fLABEL"></a>Macro: <strong>NO_DOT_IN_LABEL</strong></dt>
  147. <dd><p>Define this macro if the assembler does not accept the character
  148. &lsquo;<samp>.</samp>&rsquo; in label names. By default constructors and destructors in G++
  149. have names that use &lsquo;<samp>.</samp>&rsquo;. If this macro is defined, these names
  150. are rewritten to avoid &lsquo;<samp>.</samp>&rsquo;.
  151. </p></dd></dl>
  152. <dl>
  153. <dt><a name="index-TYPE_005fASM_005fOP"></a>Macro: <strong>TYPE_ASM_OP</strong></dt>
  154. <dd><p>A C string containing the appropriate assembler directive to specify the
  155. type of a symbol, without any arguments. On systems that use ELF, the
  156. default (in <samp>config/elfos.h</samp>) is &lsquo;<samp>&quot;\t.type\t&quot;</samp>&rsquo;; on other
  157. systems, the default is not to define this macro.
  158. </p>
  159. <p>Define this macro only if it is correct to use the default definition of
  160. <code>ASM_OUTPUT_TYPE_DIRECTIVE</code> for your system. If you need your own
  161. custom definition of this macro, or if you do not need explicit symbol
  162. types at all, do not define this macro.
  163. </p></dd></dl>
  164. <dl>
  165. <dt><a name="index-TYPE_005fOPERAND_005fFMT"></a>Macro: <strong>TYPE_OPERAND_FMT</strong></dt>
  166. <dd><p>A C string which specifies (using <code>printf</code> syntax) the format of
  167. the second operand to <code>TYPE_ASM_OP</code>. On systems that use ELF, the
  168. default (in <samp>config/elfos.h</samp>) is &lsquo;<samp>&quot;@%s&quot;</samp>&rsquo;; on other systems,
  169. the default is not to define this macro.
  170. </p>
  171. <p>Define this macro only if it is correct to use the default definition of
  172. <code>ASM_OUTPUT_TYPE_DIRECTIVE</code> for your system. If you need your own
  173. custom definition of this macro, or if you do not need explicit symbol
  174. types at all, do not define this macro.
  175. </p></dd></dl>
  176. <dl>
  177. <dt><a name="index-ASM_005fOUTPUT_005fTYPE_005fDIRECTIVE"></a>Macro: <strong>ASM_OUTPUT_TYPE_DIRECTIVE</strong> <em>(<var>stream</var>, <var>type</var>)</em></dt>
  178. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  179. <var>stream</var> a directive telling the assembler that the type of the
  180. symbol <var>name</var> is <var>type</var>. <var>type</var> is a C string; currently,
  181. that string is always either &lsquo;<samp>&quot;function&quot;</samp>&rsquo; or &lsquo;<samp>&quot;object&quot;</samp>&rsquo;, but
  182. you should not count on this.
  183. </p>
  184. <p>If you define <code>TYPE_ASM_OP</code> and <code>TYPE_OPERAND_FMT</code>, a default
  185. definition of this macro is provided.
  186. </p></dd></dl>
  187. <dl>
  188. <dt><a name="index-ASM_005fDECLARE_005fFUNCTION_005fNAME"></a>Macro: <strong>ASM_DECLARE_FUNCTION_NAME</strong> <em>(<var>stream</var>, <var>name</var>, <var>decl</var>)</em></dt>
  189. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  190. <var>stream</var> any text necessary for declaring the name <var>name</var> of a
  191. function which is being defined. This macro is responsible for
  192. outputting the label definition (perhaps using
  193. <code>ASM_OUTPUT_FUNCTION_LABEL</code>). The argument <var>decl</var> is the
  194. <code>FUNCTION_DECL</code> tree node representing the function.
  195. </p>
  196. <p>If this macro is not defined, then the function name is defined in the
  197. usual manner as a label (by means of <code>ASM_OUTPUT_FUNCTION_LABEL</code>).
  198. </p>
  199. <p>You may wish to use <code>ASM_OUTPUT_TYPE_DIRECTIVE</code> in the definition
  200. of this macro.
  201. </p></dd></dl>
  202. <dl>
  203. <dt><a name="index-ASM_005fDECLARE_005fFUNCTION_005fSIZE"></a>Macro: <strong>ASM_DECLARE_FUNCTION_SIZE</strong> <em>(<var>stream</var>, <var>name</var>, <var>decl</var>)</em></dt>
  204. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  205. <var>stream</var> any text necessary for declaring the size of a function
  206. which is being defined. The argument <var>name</var> is the name of the
  207. function. The argument <var>decl</var> is the <code>FUNCTION_DECL</code> tree node
  208. representing the function.
  209. </p>
  210. <p>If this macro is not defined, then the function size is not defined.
  211. </p>
  212. <p>You may wish to use <code>ASM_OUTPUT_MEASURED_SIZE</code> in the definition
  213. of this macro.
  214. </p></dd></dl>
  215. <dl>
  216. <dt><a name="index-ASM_005fDECLARE_005fCOLD_005fFUNCTION_005fNAME"></a>Macro: <strong>ASM_DECLARE_COLD_FUNCTION_NAME</strong> <em>(<var>stream</var>, <var>name</var>, <var>decl</var>)</em></dt>
  217. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  218. <var>stream</var> any text necessary for declaring the name <var>name</var> of a
  219. cold function partition which is being defined. This macro is responsible
  220. for outputting the label definition (perhaps using
  221. <code>ASM_OUTPUT_FUNCTION_LABEL</code>). The argument <var>decl</var> is the
  222. <code>FUNCTION_DECL</code> tree node representing the function.
  223. </p>
  224. <p>If this macro is not defined, then the cold partition name is defined in the
  225. usual manner as a label (by means of <code>ASM_OUTPUT_LABEL</code>).
  226. </p>
  227. <p>You may wish to use <code>ASM_OUTPUT_TYPE_DIRECTIVE</code> in the definition
  228. of this macro.
  229. </p></dd></dl>
  230. <dl>
  231. <dt><a name="index-ASM_005fDECLARE_005fCOLD_005fFUNCTION_005fSIZE"></a>Macro: <strong>ASM_DECLARE_COLD_FUNCTION_SIZE</strong> <em>(<var>stream</var>, <var>name</var>, <var>decl</var>)</em></dt>
  232. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  233. <var>stream</var> any text necessary for declaring the size of a cold function
  234. partition which is being defined. The argument <var>name</var> is the name of the
  235. cold partition of the function. The argument <var>decl</var> is the
  236. <code>FUNCTION_DECL</code> tree node representing the function.
  237. </p>
  238. <p>If this macro is not defined, then the partition size is not defined.
  239. </p>
  240. <p>You may wish to use <code>ASM_OUTPUT_MEASURED_SIZE</code> in the definition
  241. of this macro.
  242. </p></dd></dl>
  243. <dl>
  244. <dt><a name="index-ASM_005fDECLARE_005fOBJECT_005fNAME"></a>Macro: <strong>ASM_DECLARE_OBJECT_NAME</strong> <em>(<var>stream</var>, <var>name</var>, <var>decl</var>)</em></dt>
  245. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  246. <var>stream</var> any text necessary for declaring the name <var>name</var> of an
  247. initialized variable which is being defined. This macro must output the
  248. label definition (perhaps using <code>ASM_OUTPUT_LABEL</code>). The argument
  249. <var>decl</var> is the <code>VAR_DECL</code> tree node representing the variable.
  250. </p>
  251. <p>If this macro is not defined, then the variable name is defined in the
  252. usual manner as a label (by means of <code>ASM_OUTPUT_LABEL</code>).
  253. </p>
  254. <p>You may wish to use <code>ASM_OUTPUT_TYPE_DIRECTIVE</code> and/or
  255. <code>ASM_OUTPUT_SIZE_DIRECTIVE</code> in the definition of this macro.
  256. </p></dd></dl>
  257. <dl>
  258. <dt><a name="index-TARGET_005fASM_005fDECLARE_005fCONSTANT_005fNAME"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_DECLARE_CONSTANT_NAME</strong> <em>(FILE *<var>file</var>, const char *<var>name</var>, const_tree <var>expr</var>, HOST_WIDE_INT <var>size</var>)</em></dt>
  259. <dd><p>A target hook to output to the stdio stream <var>file</var> any text necessary
  260. for declaring the name <var>name</var> of a constant which is being defined. This
  261. target hook is responsible for outputting the label definition (perhaps using
  262. <code>assemble_label</code>). The argument <var>exp</var> is the value of the constant,
  263. and <var>size</var> is the size of the constant in bytes. The <var>name</var>
  264. will be an internal label.
  265. </p>
  266. <p>The default version of this target hook, define the <var>name</var> in the
  267. usual manner as a label (by means of <code>assemble_label</code>).
  268. </p>
  269. <p>You may wish to use <code>ASM_OUTPUT_TYPE_DIRECTIVE</code> in this target hook.
  270. </p></dd></dl>
  271. <dl>
  272. <dt><a name="index-ASM_005fDECLARE_005fREGISTER_005fGLOBAL"></a>Macro: <strong>ASM_DECLARE_REGISTER_GLOBAL</strong> <em>(<var>stream</var>, <var>decl</var>, <var>regno</var>, <var>name</var>)</em></dt>
  273. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  274. <var>stream</var> any text necessary for claiming a register <var>regno</var>
  275. for a global variable <var>decl</var> with name <var>name</var>.
  276. </p>
  277. <p>If you don&rsquo;t define this macro, that is equivalent to defining it to do
  278. nothing.
  279. </p></dd></dl>
  280. <dl>
  281. <dt><a name="index-ASM_005fFINISH_005fDECLARE_005fOBJECT"></a>Macro: <strong>ASM_FINISH_DECLARE_OBJECT</strong> <em>(<var>stream</var>, <var>decl</var>, <var>toplevel</var>, <var>atend</var>)</em></dt>
  282. <dd><p>A C statement (sans semicolon) to finish up declaring a variable name
  283. once the compiler has processed its initializer fully and thus has had a
  284. chance to determine the size of an array when controlled by an
  285. initializer. This is used on systems where it&rsquo;s necessary to declare
  286. something about the size of the object.
  287. </p>
  288. <p>If you don&rsquo;t define this macro, that is equivalent to defining it to do
  289. nothing.
  290. </p>
  291. <p>You may wish to use <code>ASM_OUTPUT_SIZE_DIRECTIVE</code> and/or
  292. <code>ASM_OUTPUT_MEASURED_SIZE</code> in the definition of this macro.
  293. </p></dd></dl>
  294. <dl>
  295. <dt><a name="index-TARGET_005fASM_005fGLOBALIZE_005fLABEL"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_GLOBALIZE_LABEL</strong> <em>(FILE *<var>stream</var>, const char *<var>name</var>)</em></dt>
  296. <dd><p>This target hook is a function to output to the stdio stream
  297. <var>stream</var> some commands that will make the label <var>name</var> global;
  298. that is, available for reference from other files.
  299. </p>
  300. <p>The default implementation relies on a proper definition of
  301. <code>GLOBAL_ASM_OP</code>.
  302. </p></dd></dl>
  303. <dl>
  304. <dt><a name="index-TARGET_005fASM_005fGLOBALIZE_005fDECL_005fNAME"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_GLOBALIZE_DECL_NAME</strong> <em>(FILE *<var>stream</var>, tree <var>decl</var>)</em></dt>
  305. <dd><p>This target hook is a function to output to the stdio stream
  306. <var>stream</var> some commands that will make the name associated with <var>decl</var>
  307. global; that is, available for reference from other files.
  308. </p>
  309. <p>The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL target hook.
  310. </p></dd></dl>
  311. <dl>
  312. <dt><a name="index-TARGET_005fASM_005fASSEMBLE_005fUNDEFINED_005fDECL"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_ASSEMBLE_UNDEFINED_DECL</strong> <em>(FILE *<var>stream</var>, const char *<var>name</var>, const_tree <var>decl</var>)</em></dt>
  313. <dd><p>This target hook is a function to output to the stdio stream
  314. <var>stream</var> some commands that will declare the name associated with
  315. <var>decl</var> which is not defined in the current translation unit. Most
  316. assemblers do not require anything to be output in this case.
  317. </p></dd></dl>
  318. <dl>
  319. <dt><a name="index-ASM_005fWEAKEN_005fLABEL"></a>Macro: <strong>ASM_WEAKEN_LABEL</strong> <em>(<var>stream</var>, <var>name</var>)</em></dt>
  320. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  321. <var>stream</var> some commands that will make the label <var>name</var> weak;
  322. that is, available for reference from other files but only used if
  323. no other definition is available. Use the expression
  324. <code>assemble_name (<var>stream</var>, <var>name</var>)</code> to output the name
  325. itself; before and after that, output the additional assembler syntax
  326. for making that name weak, and a newline.
  327. </p>
  328. <p>If you don&rsquo;t define this macro or <code>ASM_WEAKEN_DECL</code>, GCC will not
  329. support weak symbols and you should not define the <code>SUPPORTS_WEAK</code>
  330. macro.
  331. </p></dd></dl>
  332. <dl>
  333. <dt><a name="index-ASM_005fWEAKEN_005fDECL"></a>Macro: <strong>ASM_WEAKEN_DECL</strong> <em>(<var>stream</var>, <var>decl</var>, <var>name</var>, <var>value</var>)</em></dt>
  334. <dd><p>Combines (and replaces) the function of <code>ASM_WEAKEN_LABEL</code> and
  335. <code>ASM_OUTPUT_WEAK_ALIAS</code>, allowing access to the associated function
  336. or variable decl. If <var>value</var> is not <code>NULL</code>, this C statement
  337. should output to the stdio stream <var>stream</var> assembler code which
  338. defines (equates) the weak symbol <var>name</var> to have the value
  339. <var>value</var>. If <var>value</var> is <code>NULL</code>, it should output commands
  340. to make <var>name</var> weak.
  341. </p></dd></dl>
  342. <dl>
  343. <dt><a name="index-ASM_005fOUTPUT_005fWEAKREF"></a>Macro: <strong>ASM_OUTPUT_WEAKREF</strong> <em>(<var>stream</var>, <var>decl</var>, <var>name</var>, <var>value</var>)</em></dt>
  344. <dd><p>Outputs a directive that enables <var>name</var> to be used to refer to
  345. symbol <var>value</var> with weak-symbol semantics. <code>decl</code> is the
  346. declaration of <code>name</code>.
  347. </p></dd></dl>
  348. <dl>
  349. <dt><a name="index-SUPPORTS_005fWEAK"></a>Macro: <strong>SUPPORTS_WEAK</strong></dt>
  350. <dd><p>A preprocessor constant expression which evaluates to true if the target
  351. supports weak symbols.
  352. </p>
  353. <p>If you don&rsquo;t define this macro, <samp>defaults.h</samp> provides a default
  354. definition. If either <code>ASM_WEAKEN_LABEL</code> or <code>ASM_WEAKEN_DECL</code>
  355. is defined, the default definition is &lsquo;<samp>1</samp>&rsquo;; otherwise, it is &lsquo;<samp>0</samp>&rsquo;.
  356. </p></dd></dl>
  357. <dl>
  358. <dt><a name="index-TARGET_005fSUPPORTS_005fWEAK"></a>Macro: <strong>TARGET_SUPPORTS_WEAK</strong></dt>
  359. <dd><p>A C expression which evaluates to true if the target supports weak symbols.
  360. </p>
  361. <p>If you don&rsquo;t define this macro, <samp>defaults.h</samp> provides a default
  362. definition. The default definition is &lsquo;<samp>(SUPPORTS_WEAK)</samp>&rsquo;. Define
  363. this macro if you want to control weak symbol support with a compiler
  364. flag such as <samp>-melf</samp>.
  365. </p></dd></dl>
  366. <dl>
  367. <dt><a name="index-MAKE_005fDECL_005fONE_005fONLY"></a>Macro: <strong>MAKE_DECL_ONE_ONLY</strong> <em>(<var>decl</var>)</em></dt>
  368. <dd><p>A C statement (sans semicolon) to mark <var>decl</var> to be emitted as a
  369. public symbol such that extra copies in multiple translation units will
  370. be discarded by the linker. Define this macro if your object file
  371. format provides support for this concept, such as the &lsquo;<samp>COMDAT</samp>&rsquo;
  372. section flags in the Microsoft Windows PE/COFF format, and this support
  373. requires changes to <var>decl</var>, such as putting it in a separate section.
  374. </p></dd></dl>
  375. <dl>
  376. <dt><a name="index-SUPPORTS_005fONE_005fONLY"></a>Macro: <strong>SUPPORTS_ONE_ONLY</strong></dt>
  377. <dd><p>A C expression which evaluates to true if the target supports one-only
  378. semantics.
  379. </p>
  380. <p>If you don&rsquo;t define this macro, <samp>varasm.c</samp> provides a default
  381. definition. If <code>MAKE_DECL_ONE_ONLY</code> is defined, the default
  382. definition is &lsquo;<samp>1</samp>&rsquo;; otherwise, it is &lsquo;<samp>0</samp>&rsquo;. Define this macro if
  383. you want to control one-only symbol support with a compiler flag, or if
  384. setting the <code>DECL_ONE_ONLY</code> flag is enough to mark a declaration to
  385. be emitted as one-only.
  386. </p></dd></dl>
  387. <dl>
  388. <dt><a name="index-TARGET_005fASM_005fASSEMBLE_005fVISIBILITY"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_ASSEMBLE_VISIBILITY</strong> <em>(tree <var>decl</var>, int <var>visibility</var>)</em></dt>
  389. <dd><p>This target hook is a function to output to <var>asm_out_file</var> some
  390. commands that will make the symbol(s) associated with <var>decl</var> have
  391. hidden, protected or internal visibility as specified by <var>visibility</var>.
  392. </p></dd></dl>
  393. <dl>
  394. <dt><a name="index-TARGET_005fWEAK_005fNOT_005fIN_005fARCHIVE_005fTOC"></a>Macro: <strong>TARGET_WEAK_NOT_IN_ARCHIVE_TOC</strong></dt>
  395. <dd><p>A C expression that evaluates to true if the target&rsquo;s linker expects
  396. that weak symbols do not appear in a static archive&rsquo;s table of contents.
  397. The default is <code>0</code>.
  398. </p>
  399. <p>Leaving weak symbols out of an archive&rsquo;s table of contents means that,
  400. if a symbol will only have a definition in one translation unit and
  401. will have undefined references from other translation units, that
  402. symbol should not be weak. Defining this macro to be nonzero will
  403. thus have the effect that certain symbols that would normally be weak
  404. (explicit template instantiations, and vtables for polymorphic classes
  405. with noninline key methods) will instead be nonweak.
  406. </p>
  407. <p>The C++ ABI requires this macro to be zero. Define this macro for
  408. targets where full C++ ABI compliance is impossible and where linker
  409. restrictions require weak symbols to be left out of a static archive&rsquo;s
  410. table of contents.
  411. </p></dd></dl>
  412. <dl>
  413. <dt><a name="index-ASM_005fOUTPUT_005fEXTERNAL"></a>Macro: <strong>ASM_OUTPUT_EXTERNAL</strong> <em>(<var>stream</var>, <var>decl</var>, <var>name</var>)</em></dt>
  414. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  415. <var>stream</var> any text necessary for declaring the name of an external
  416. symbol named <var>name</var> which is referenced in this compilation but
  417. not defined. The value of <var>decl</var> is the tree node for the
  418. declaration.
  419. </p>
  420. <p>This macro need not be defined if it does not need to output anything.
  421. The GNU assembler and most Unix assemblers don&rsquo;t require anything.
  422. </p></dd></dl>
  423. <dl>
  424. <dt><a name="index-TARGET_005fASM_005fEXTERNAL_005fLIBCALL"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_EXTERNAL_LIBCALL</strong> <em>(rtx <var>symref</var>)</em></dt>
  425. <dd><p>This target hook is a function to output to <var>asm_out_file</var> an assembler
  426. pseudo-op to declare a library function name external. The name of the
  427. library function is given by <var>symref</var>, which is a <code>symbol_ref</code>.
  428. </p></dd></dl>
  429. <dl>
  430. <dt><a name="index-TARGET_005fASM_005fMARK_005fDECL_005fPRESERVED"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_MARK_DECL_PRESERVED</strong> <em>(const char *<var>symbol</var>)</em></dt>
  431. <dd><p>This target hook is a function to output to <var>asm_out_file</var> an assembler
  432. directive to annotate <var>symbol</var> as used. The Darwin target uses the
  433. .no_dead_code_strip directive.
  434. </p></dd></dl>
  435. <dl>
  436. <dt><a name="index-ASM_005fOUTPUT_005fLABELREF"></a>Macro: <strong>ASM_OUTPUT_LABELREF</strong> <em>(<var>stream</var>, <var>name</var>)</em></dt>
  437. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  438. <var>stream</var> a reference in assembler syntax to a label named
  439. <var>name</var>. This should add &lsquo;<samp>_</samp>&rsquo; to the front of the name, if that
  440. is customary on your operating system, as it is in most Berkeley Unix
  441. systems. This macro is used in <code>assemble_name</code>.
  442. </p></dd></dl>
  443. <dl>
  444. <dt><a name="index-TARGET_005fMANGLE_005fASSEMBLER_005fNAME"></a>Target Hook: <em>tree</em> <strong>TARGET_MANGLE_ASSEMBLER_NAME</strong> <em>(const char *<var>name</var>)</em></dt>
  445. <dd><p>Given a symbol <var>name</var>, perform same mangling as <code>varasm.c</code>&rsquo;s <code>assemble_name</code>, but in memory rather than to a file stream, returning result as an <code>IDENTIFIER_NODE</code>. Required for correct LTO symtabs. The default implementation calls the <code>TARGET_STRIP_NAME_ENCODING</code> hook and then prepends the <code>USER_LABEL_PREFIX</code>, if any.
  446. </p></dd></dl>
  447. <dl>
  448. <dt><a name="index-ASM_005fOUTPUT_005fSYMBOL_005fREF"></a>Macro: <strong>ASM_OUTPUT_SYMBOL_REF</strong> <em>(<var>stream</var>, <var>sym</var>)</em></dt>
  449. <dd><p>A C statement (sans semicolon) to output a reference to
  450. <code>SYMBOL_REF</code> <var>sym</var>. If not defined, <code>assemble_name</code>
  451. will be used to output the name of the symbol. This macro may be used
  452. to modify the way a symbol is referenced depending on information
  453. encoded by <code>TARGET_ENCODE_SECTION_INFO</code>.
  454. </p></dd></dl>
  455. <dl>
  456. <dt><a name="index-ASM_005fOUTPUT_005fLABEL_005fREF"></a>Macro: <strong>ASM_OUTPUT_LABEL_REF</strong> <em>(<var>stream</var>, <var>buf</var>)</em></dt>
  457. <dd><p>A C statement (sans semicolon) to output a reference to <var>buf</var>, the
  458. result of <code>ASM_GENERATE_INTERNAL_LABEL</code>. If not defined,
  459. <code>assemble_name</code> will be used to output the name of the symbol.
  460. This macro is not used by <code>output_asm_label</code>, or the <code>%l</code>
  461. specifier that calls it; the intention is that this macro should be set
  462. when it is necessary to output a label differently when its address is
  463. being taken.
  464. </p></dd></dl>
  465. <dl>
  466. <dt><a name="index-TARGET_005fASM_005fINTERNAL_005fLABEL"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_INTERNAL_LABEL</strong> <em>(FILE *<var>stream</var>, const char *<var>prefix</var>, unsigned long <var>labelno</var>)</em></dt>
  467. <dd><p>A function to output to the stdio stream <var>stream</var> a label whose
  468. name is made from the string <var>prefix</var> and the number <var>labelno</var>.
  469. </p>
  470. <p>It is absolutely essential that these labels be distinct from the labels
  471. used for user-level functions and variables. Otherwise, certain programs
  472. will have name conflicts with internal labels.
  473. </p>
  474. <p>It is desirable to exclude internal labels from the symbol table of the
  475. object file. Most assemblers have a naming convention for labels that
  476. should be excluded; on many systems, the letter &lsquo;<samp>L</samp>&rsquo; at the
  477. beginning of a label has this effect. You should find out what
  478. convention your system uses, and follow it.
  479. </p>
  480. <p>The default version of this function utilizes <code>ASM_GENERATE_INTERNAL_LABEL</code>.
  481. </p></dd></dl>
  482. <dl>
  483. <dt><a name="index-ASM_005fOUTPUT_005fDEBUG_005fLABEL"></a>Macro: <strong>ASM_OUTPUT_DEBUG_LABEL</strong> <em>(<var>stream</var>, <var>prefix</var>, <var>num</var>)</em></dt>
  484. <dd><p>A C statement to output to the stdio stream <var>stream</var> a debug info
  485. label whose name is made from the string <var>prefix</var> and the number
  486. <var>num</var>. This is useful for VLIW targets, where debug info labels
  487. may need to be treated differently than branch target labels. On some
  488. systems, branch target labels must be at the beginning of instruction
  489. bundles, but debug info labels can occur in the middle of instruction
  490. bundles.
  491. </p>
  492. <p>If this macro is not defined, then <code>(*targetm.asm_out.internal_label)</code> will be
  493. used.
  494. </p></dd></dl>
  495. <dl>
  496. <dt><a name="index-ASM_005fGENERATE_005fINTERNAL_005fLABEL"></a>Macro: <strong>ASM_GENERATE_INTERNAL_LABEL</strong> <em>(<var>string</var>, <var>prefix</var>, <var>num</var>)</em></dt>
  497. <dd><p>A C statement to store into the string <var>string</var> a label whose name
  498. is made from the string <var>prefix</var> and the number <var>num</var>.
  499. </p>
  500. <p>This string, when output subsequently by <code>assemble_name</code>, should
  501. produce the output that <code>(*targetm.asm_out.internal_label)</code> would produce
  502. with the same <var>prefix</var> and <var>num</var>.
  503. </p>
  504. <p>If the string begins with &lsquo;<samp>*</samp>&rsquo;, then <code>assemble_name</code> will
  505. output the rest of the string unchanged. It is often convenient for
  506. <code>ASM_GENERATE_INTERNAL_LABEL</code> to use &lsquo;<samp>*</samp>&rsquo; in this way. If the
  507. string doesn&rsquo;t start with &lsquo;<samp>*</samp>&rsquo;, then <code>ASM_OUTPUT_LABELREF</code> gets
  508. to output the string, and may change it. (Of course,
  509. <code>ASM_OUTPUT_LABELREF</code> is also part of your machine description, so
  510. you should know what it does on your machine.)
  511. </p></dd></dl>
  512. <dl>
  513. <dt><a name="index-ASM_005fFORMAT_005fPRIVATE_005fNAME"></a>Macro: <strong>ASM_FORMAT_PRIVATE_NAME</strong> <em>(<var>outvar</var>, <var>name</var>, <var>number</var>)</em></dt>
  514. <dd><p>A C expression to assign to <var>outvar</var> (which is a variable of type
  515. <code>char *</code>) a newly allocated string made from the string
  516. <var>name</var> and the number <var>number</var>, with some suitable punctuation
  517. added. Use <code>alloca</code> to get space for the string.
  518. </p>
  519. <p>The string will be used as an argument to <code>ASM_OUTPUT_LABELREF</code> to
  520. produce an assembler label for an internal static variable whose name is
  521. <var>name</var>. Therefore, the string must be such as to result in valid
  522. assembler code. The argument <var>number</var> is different each time this
  523. macro is executed; it prevents conflicts between similarly-named
  524. internal static variables in different scopes.
  525. </p>
  526. <p>Ideally this string should not be a valid C identifier, to prevent any
  527. conflict with the user&rsquo;s own symbols. Most assemblers allow periods
  528. or percent signs in assembler symbols; putting at least one of these
  529. between the name and the number will suffice.
  530. </p>
  531. <p>If this macro is not defined, a default definition will be provided
  532. which is correct for most systems.
  533. </p></dd></dl>
  534. <dl>
  535. <dt><a name="index-ASM_005fOUTPUT_005fDEF"></a>Macro: <strong>ASM_OUTPUT_DEF</strong> <em>(<var>stream</var>, <var>name</var>, <var>value</var>)</em></dt>
  536. <dd><p>A C statement to output to the stdio stream <var>stream</var> assembler code
  537. which defines (equates) the symbol <var>name</var> to have the value <var>value</var>.
  538. </p>
  539. <a name="index-SET_005fASM_005fOP"></a>
  540. <p>If <code>SET_ASM_OP</code> is defined, a default definition is provided which is
  541. correct for most systems.
  542. </p></dd></dl>
  543. <dl>
  544. <dt><a name="index-ASM_005fOUTPUT_005fDEF_005fFROM_005fDECLS"></a>Macro: <strong>ASM_OUTPUT_DEF_FROM_DECLS</strong> <em>(<var>stream</var>, <var>decl_of_name</var>, <var>decl_of_value</var>)</em></dt>
  545. <dd><p>A C statement to output to the stdio stream <var>stream</var> assembler code
  546. which defines (equates) the symbol whose tree node is <var>decl_of_name</var>
  547. to have the value of the tree node <var>decl_of_value</var>. This macro will
  548. be used in preference to &lsquo;<samp>ASM_OUTPUT_DEF</samp>&rsquo; if it is defined and if
  549. the tree nodes are available.
  550. </p>
  551. <a name="index-SET_005fASM_005fOP-1"></a>
  552. <p>If <code>SET_ASM_OP</code> is defined, a default definition is provided which is
  553. correct for most systems.
  554. </p></dd></dl>
  555. <dl>
  556. <dt><a name="index-TARGET_005fDEFERRED_005fOUTPUT_005fDEFS"></a>Macro: <strong>TARGET_DEFERRED_OUTPUT_DEFS</strong> <em>(<var>decl_of_name</var>, <var>decl_of_value</var>)</em></dt>
  557. <dd><p>A C statement that evaluates to true if the assembler code which defines
  558. (equates) the symbol whose tree node is <var>decl_of_name</var> to have the value
  559. of the tree node <var>decl_of_value</var> should be emitted near the end of the
  560. current compilation unit. The default is to not defer output of defines.
  561. This macro affects defines output by &lsquo;<samp>ASM_OUTPUT_DEF</samp>&rsquo; and
  562. &lsquo;<samp>ASM_OUTPUT_DEF_FROM_DECLS</samp>&rsquo;.
  563. </p></dd></dl>
  564. <dl>
  565. <dt><a name="index-ASM_005fOUTPUT_005fWEAK_005fALIAS"></a>Macro: <strong>ASM_OUTPUT_WEAK_ALIAS</strong> <em>(<var>stream</var>, <var>name</var>, <var>value</var>)</em></dt>
  566. <dd><p>A C statement to output to the stdio stream <var>stream</var> assembler code
  567. which defines (equates) the weak symbol <var>name</var> to have the value
  568. <var>value</var>. If <var>value</var> is <code>NULL</code>, it defines <var>name</var> as
  569. an undefined weak symbol.
  570. </p>
  571. <p>Define this macro if the target only supports weak aliases; define
  572. <code>ASM_OUTPUT_DEF</code> instead if possible.
  573. </p></dd></dl>
  574. <dl>
  575. <dt><a name="index-OBJC_005fGEN_005fMETHOD_005fLABEL"></a>Macro: <strong>OBJC_GEN_METHOD_LABEL</strong> <em>(<var>buf</var>, <var>is_inst</var>, <var>class_name</var>, <var>cat_name</var>, <var>sel_name</var>)</em></dt>
  576. <dd><p>Define this macro to override the default assembler names used for
  577. Objective-C methods.
  578. </p>
  579. <p>The default name is a unique method number followed by the name of the
  580. class (e.g. &lsquo;<samp>_1_Foo</samp>&rsquo;). For methods in categories, the name of
  581. the category is also included in the assembler name (e.g.
  582. &lsquo;<samp>_1_Foo_Bar</samp>&rsquo;).
  583. </p>
  584. <p>These names are safe on most systems, but make debugging difficult since
  585. the method&rsquo;s selector is not present in the name. Therefore, particular
  586. systems define other ways of computing names.
  587. </p>
  588. <p><var>buf</var> is an expression of type <code>char *</code> which gives you a
  589. buffer in which to store the name; its length is as long as
  590. <var>class_name</var>, <var>cat_name</var> and <var>sel_name</var> put together, plus
  591. 50 characters extra.
  592. </p>
  593. <p>The argument <var>is_inst</var> specifies whether the method is an instance
  594. method or a class method; <var>class_name</var> is the name of the class;
  595. <var>cat_name</var> is the name of the category (or <code>NULL</code> if the method is not
  596. in a category); and <var>sel_name</var> is the name of the selector.
  597. </p>
  598. <p>On systems where the assembler can handle quoted names, you can use this
  599. macro to provide more human-readable names.
  600. </p></dd></dl>
  601. <hr>
  602. <div class="header">
  603. <p>
  604. Next: <a href="Initialization.html#Initialization" accesskey="n" rel="next">Initialization</a>, Previous: <a href="Uninitialized-Data.html#Uninitialized-Data" accesskey="p" rel="prev">Uninitialized Data</a>, Up: <a href="Assembler-Format.html#Assembler-Format" accesskey="u" rel="up">Assembler Format</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>
  605. </div>
  606. </body>
  607. </html>