<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Absent alignment field in .comm differs from GAS"
href="https://llvm.org/bugs/show_bug.cgi?id=25837">25837</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Absent alignment field in .comm differs from GAS
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>MC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dan433584@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The interpretation of an absent alignment field in .comm (and .lcomm)
directives in llvm-mc differs from GAS:
$ cat comm.s
.comm foo,256
$ as comm.s -o comm.o
$ readelf -sW comm.o |grep foo
4: 0000000000000010 256 OBJECT GLOBAL DEFAULT COM foo
$ llvm-mc -filetype=obj -o comm.o comm.s
$ readelf -sW comm.o |grep foo
1: 0000000000000001 256 OBJECT GLOBAL DEFAULT COM foo
Note that for COMMON symbols, the Value field holds the alignment, so it's 16
for GAS here and 1 for llvm-mc.
The GAS behavior is documented on this page:
<a href="https://sourceware.org/binutils/docs/as/Comm.html#Comm">https://sourceware.org/binutils/docs/as/Comm.html#Comm</a>
"If no alignment is specified, as will set the alignment to the largest power
of two less than or equal to the size of the symbol, up to a maximum of 16 on
ELF, or the default section alignment of 4 on PE."</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>