您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

667 行
36KB

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