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