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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Comm (Using as)</title>
  16. <meta name="description" content="Comm (Using as)">
  17. <meta name="keywords" content="Comm (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Pseudo-Ops.html#Pseudo-Ops" rel="up" title="Pseudo Ops">
  25. <link href="Data.html#Data" rel="next" title="Data">
  26. <link href="CFI-directives.html#CFI-directives" rel="prev" title="CFI directives">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Comm"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Data.html#Data" accesskey="n" rel="next">Data</a>, Previous: <a href="CFI-directives.html#CFI-directives" accesskey="p" rel="prev">CFI directives</a>, Up: <a href="Pseudo-Ops.html#Pseudo-Ops" accesskey="u" rel="up">Pseudo Ops</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="g_t_002ecomm-symbol-_002c-length-"></a>
  63. <h3 class="section">7.11 <code>.comm <var>symbol</var> , <var>length</var> </code></h3>
  64. <a name="index-comm-directive"></a>
  65. <a name="index-symbol_002c-common"></a>
  66. <p><code>.comm</code> declares a common symbol named <var>symbol</var>. When linking, a
  67. common symbol in one object file may be merged with a defined or common symbol
  68. of the same name in another object file. If <code>ld</code> does not see a
  69. definition for the symbol&ndash;just one or more common symbols&ndash;then it will
  70. allocate <var>length</var> bytes of uninitialized memory. <var>length</var> must be an
  71. absolute expression. If <code>ld</code> sees multiple common symbols with
  72. the same name, and they do not all have the same size, it will allocate space
  73. using the largest size.
  74. </p>
  75. <p>When using ELF or (as a GNU extension) PE, the <code>.comm</code> directive takes
  76. an optional third argument. This is the desired alignment of the symbol,
  77. specified for ELF as a byte boundary (for example, an alignment of 16 means
  78. that the least significant 4 bits of the address should be zero), and for PE
  79. as a power of two (for example, an alignment of 5 means aligned to a 32-byte
  80. boundary). The alignment must be an absolute expression, and it must be a
  81. power of two. If <code>ld</code> allocates uninitialized memory for the
  82. common symbol, it will use the alignment when placing the symbol. If no
  83. alignment is specified, <code>as</code> will set the alignment to the
  84. largest power of two less than or equal to the size of the symbol, up to a
  85. maximum of 16 on ELF, or the default section alignment of 4 on PE<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>.
  86. </p>
  87. <p>The syntax for <code>.comm</code> differs slightly on the HPPA. The syntax is
  88. &lsquo;<samp><var>symbol</var> .comm, <var>length</var></samp>&rsquo;; <var>symbol</var> is optional.
  89. </p>
  90. <div class="footnote">
  91. <hr>
  92. <h4 class="footnotes-heading">Footnotes</h4>
  93. <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
  94. <p>This
  95. is not the same as the executable image file alignment controlled by <code>ld</code>&rsquo;s
  96. &lsquo;<samp>--section-alignment</samp>&rsquo; option; image file sections in PE are aligned to
  97. multiples of 4096, which is far too large an alignment for ordinary variables.
  98. It is rather the default alignment for (non-debug) sections within object
  99. (&lsquo;<samp>*.o</samp>&rsquo;) files, which are less strictly aligned.</p>
  100. </div>
  101. <hr>
  102. <div class="header">
  103. <p>
  104. Next: <a href="Data.html#Data" accesskey="n" rel="next">Data</a>, Previous: <a href="CFI-directives.html#CFI-directives" accesskey="p" rel="prev">CFI directives</a>, Up: <a href="Pseudo-Ops.html#Pseudo-Ops" accesskey="u" rel="up">Pseudo Ops</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  105. </div>
  106. </body>
  107. </html>