<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 --- - undefined reference to '__sync_val_compare_and_swap_16'"
href="https://llvm.org/bugs/show_bug.cgi?id=31620">31620</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>undefined reference to '__sync_val_compare_and_swap_16'
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dvyukov@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I am on r291667. Linux/x86_64. libcxx and libcxxabi are checked out into
projects.
The program is:
#include <atomic>
int main()
{
struct X { int a, b, c, d; };
std::atomic<X> x;
X b, c;
x.compare_exchange_strong(b, c);
}
$ clang++ test.cc -std=c++11 -stdlib=libc++
/tmp/test-7383d8.o: In function `main':
/tmp/test.cc:(.text+0xd): undefined reference to
`__sync_val_compare_and_swap_16'
clang-4.0: error: linker command failed with exit code 1 (use -v to see
invocation)
Adding -latomic does not help, libatomic does not provide such function.
A new tsan test fails with a more elaborate error pointing to exact location,
for some reason it's generated for load function:
/tmp/lit_tmp_3Uws7l/atomic_test-af5f74.o: In function `load':
/llvm4/build/projects/compiler-rt/lib/tsan/libcxx_tsan_x86_64/include/c++/v1/atomic:893:
undefined reference to `__sync_val_compare_and_swap_16'
/tmp/lit_tmp_3Uws7l/atomic_test-af5f74.o:/llvm4/build/projects/compiler-rt/lib/tsan/libcxx_tsan_x86_64/include/c++/v1/atomic:893:
more undefined references to `__sync_val_compare_and_swap_16' follow
clang-3.9: error: linker command failed with exit code 1 (use -v to see
invocation)
What am I doing wrong?</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>