You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
10KB

  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>Uninitialized Data (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Uninitialized Data (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Uninitialized Data (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="Label-Output.html#Label-Output" rel="next" title="Label Output">
  31. <link href="Data-Output.html#Data-Output" rel="prev" title="Data Output">
  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="Uninitialized-Data"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Label-Output.html#Label-Output" accesskey="n" rel="next">Label Output</a>, Previous: <a href="Data-Output.html#Data-Output" accesskey="p" rel="prev">Data Output</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-of-Uninitialized-Variables"></a>
  68. <h4 class="subsection">18.20.3 Output of Uninitialized Variables</h4>
  69. <p>Each of the macros in this section is used to do the whole job of
  70. outputting a single uninitialized variable.
  71. </p>
  72. <dl>
  73. <dt><a name="index-ASM_005fOUTPUT_005fCOMMON"></a>Macro: <strong>ASM_OUTPUT_COMMON</strong> <em>(<var>stream</var>, <var>name</var>, <var>size</var>, <var>rounded</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 common-label named
  76. <var>name</var> whose size is <var>size</var> bytes. The variable <var>rounded</var>
  77. is the size rounded up to whatever alignment the caller wants. It is
  78. possible that <var>size</var> may be zero, for instance if a struct with no
  79. other member than a zero-length array is defined. In this case, the
  80. backend must output a symbol definition that allocates at least one
  81. byte, both so that the address of the resulting object does not compare
  82. equal to any other, and because some object formats cannot even express
  83. the concept of a zero-sized common symbol, as that is how they represent
  84. an ordinary undefined external.
  85. </p>
  86. <p>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.
  89. </p>
  90. <p>This macro controls how the assembler definitions of uninitialized
  91. common global variables are output.
  92. </p></dd></dl>
  93. <dl>
  94. <dt><a name="index-ASM_005fOUTPUT_005fALIGNED_005fCOMMON"></a>Macro: <strong>ASM_OUTPUT_ALIGNED_COMMON</strong> <em>(<var>stream</var>, <var>name</var>, <var>size</var>, <var>alignment</var>)</em></dt>
  95. <dd><p>Like <code>ASM_OUTPUT_COMMON</code> except takes the required alignment as a
  96. separate, explicit argument. If you define this macro, it is used in
  97. place of <code>ASM_OUTPUT_COMMON</code>, and gives you more flexibility in
  98. handling the required alignment of the variable. The alignment is specified
  99. as the number of bits.
  100. </p></dd></dl>
  101. <dl>
  102. <dt><a name="index-ASM_005fOUTPUT_005fALIGNED_005fDECL_005fCOMMON"></a>Macro: <strong>ASM_OUTPUT_ALIGNED_DECL_COMMON</strong> <em>(<var>stream</var>, <var>decl</var>, <var>name</var>, <var>size</var>, <var>alignment</var>)</em></dt>
  103. <dd><p>Like <code>ASM_OUTPUT_ALIGNED_COMMON</code> except that <var>decl</var> of the
  104. variable to be output, if there is one, or <code>NULL_TREE</code> if there
  105. is no corresponding variable. If you define this macro, GCC will use it
  106. in place of both <code>ASM_OUTPUT_COMMON</code> and
  107. <code>ASM_OUTPUT_ALIGNED_COMMON</code>. Define this macro when you need to see
  108. the variable&rsquo;s decl in order to chose what to output.
  109. </p></dd></dl>
  110. <dl>
  111. <dt><a name="index-ASM_005fOUTPUT_005fALIGNED_005fBSS"></a>Macro: <strong>ASM_OUTPUT_ALIGNED_BSS</strong> <em>(<var>stream</var>, <var>decl</var>, <var>name</var>, <var>size</var>, <var>alignment</var>)</em></dt>
  112. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  113. <var>stream</var> the assembler definition of uninitialized global <var>decl</var> named
  114. <var>name</var> whose size is <var>size</var> bytes. The variable <var>alignment</var>
  115. is the alignment specified as the number of bits.
  116. </p>
  117. <p>Try to use function <code>asm_output_aligned_bss</code> defined in file
  118. <samp>varasm.c</samp> when defining this macro. If unable, use the expression
  119. <code>assemble_name (<var>stream</var>, <var>name</var>)</code> to output the name itself;
  120. before and after that, output the additional assembler syntax for defining
  121. the name, and a newline.
  122. </p>
  123. <p>There are two ways of handling global BSS. One is to define this macro.
  124. The other is to have <code>TARGET_ASM_SELECT_SECTION</code> return a
  125. switchable BSS section (see <a href="File-Framework.html#TARGET_005fHAVE_005fSWITCHABLE_005fBSS_005fSECTIONS">TARGET_HAVE_SWITCHABLE_BSS_SECTIONS</a>).
  126. You do not need to do both.
  127. </p>
  128. <p>Some languages do not have <code>common</code> data, and require a
  129. non-common form of global BSS in order to handle uninitialized globals
  130. efficiently. C++ is one example of this. However, if the target does
  131. not support global BSS, the front end may choose to make globals
  132. common in order to save space in the object file.
  133. </p></dd></dl>
  134. <dl>
  135. <dt><a name="index-ASM_005fOUTPUT_005fLOCAL"></a>Macro: <strong>ASM_OUTPUT_LOCAL</strong> <em>(<var>stream</var>, <var>name</var>, <var>size</var>, <var>rounded</var>)</em></dt>
  136. <dd><p>A C statement (sans semicolon) to output to the stdio stream
  137. <var>stream</var> the assembler definition of a local-common-label named
  138. <var>name</var> whose size is <var>size</var> bytes. The variable <var>rounded</var>
  139. is the size rounded up to whatever alignment the caller wants.
  140. </p>
  141. <p>Use the expression <code>assemble_name (<var>stream</var>, <var>name</var>)</code> to
  142. output the name itself; before and after that, output the additional
  143. assembler syntax for defining the name, and a newline.
  144. </p>
  145. <p>This macro controls how the assembler definitions of uninitialized
  146. static variables are output.
  147. </p></dd></dl>
  148. <dl>
  149. <dt><a name="index-ASM_005fOUTPUT_005fALIGNED_005fLOCAL"></a>Macro: <strong>ASM_OUTPUT_ALIGNED_LOCAL</strong> <em>(<var>stream</var>, <var>name</var>, <var>size</var>, <var>alignment</var>)</em></dt>
  150. <dd><p>Like <code>ASM_OUTPUT_LOCAL</code> except takes the required alignment as a
  151. separate, explicit argument. If you define this macro, it is used in
  152. place of <code>ASM_OUTPUT_LOCAL</code>, and gives you more flexibility in
  153. handling the required alignment of the variable. The alignment is specified
  154. as the number of bits.
  155. </p></dd></dl>
  156. <dl>
  157. <dt><a name="index-ASM_005fOUTPUT_005fALIGNED_005fDECL_005fLOCAL"></a>Macro: <strong>ASM_OUTPUT_ALIGNED_DECL_LOCAL</strong> <em>(<var>stream</var>, <var>decl</var>, <var>name</var>, <var>size</var>, <var>alignment</var>)</em></dt>
  158. <dd><p>Like <code>ASM_OUTPUT_ALIGNED_LOCAL</code> except that <var>decl</var> of the
  159. variable to be output, if there is one, or <code>NULL_TREE</code> if there
  160. is no corresponding variable. If you define this macro, GCC will use it
  161. in place of both <code>ASM_OUTPUT_LOCAL</code> and
  162. <code>ASM_OUTPUT_ALIGNED_LOCAL</code>. Define this macro when you need to see
  163. the variable&rsquo;s decl in order to chose what to output.
  164. </p></dd></dl>
  165. <hr>
  166. <div class="header">
  167. <p>
  168. Next: <a href="Label-Output.html#Label-Output" accesskey="n" rel="next">Label Output</a>, Previous: <a href="Data-Output.html#Data-Output" accesskey="p" rel="prev">Data Output</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>
  169. </div>
  170. </body>
  171. </html>