<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 --- - llvm-nm -P violates POSIX specification"
href="https://llvm.org/bugs/show_bug.cgi?id=27049">27049</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-nm -P violates POSIX specification
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>llvm-nm
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hvr@gnu.org
</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>On Linux/amd64 with a recent llvm-nm snapshot (same with llvm-nm-3.8):
$ echo 'char foo[200];' >> foo.c
$ cc -c foo.c
$ llvm-nm-3.9 -P foo.o
foo C 00000000000000c80000000000000000
whearas GNU binutils' `nm` says:
$ nm -P foo.o
foo C 00000000000000c8 00000000000000c8
So `llvm-nm` violates the portable format mandated by POSIX
(<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/nm.html">http://pubs.opengroup.org/onlinepubs/9699919799/utilities/nm.html</a>) by leaving
out the space,
which specifically states:
<span class="quote">> `-P`
> Write information in a portable output format, as specified in the STDOUT section.</span >
...
<span class="quote">> If the `-P` option is specified, the previous information shall be displayed using the following portable format. The three versions differ depending on whether `-t d`, `-t o`, or `-t x` was specified, respectively:</span >
>
<span class="quote">> "%s%s %s %d %d\n", <library/object name>, <name>, <type>, <value>, <size></span >
>
<span class="quote">> "%s%s %s %o %o\n", <library/object name>, <name>, <type>, <value>, <size></span >
>
<span class="quote">> "%s%s %s %x %x\n", <library/object name>, <name>, <type>, <value>, <size></span >
...
<span class="quote">> If `-P` is specified, but `-t` is not, the format shall be as if `-t x` had been specified.</span >
...
<span class="quote">> The format given in nm STDOUT uses <space> characters between the fields, which may be any number of <blank> characters required to align the columns. The single-character types were selected to match historical practice, and the requirement that implementation additions also be single characters made parsing the information easier for shell scripts.</span ></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>