[llvm-bugs] [Bug 31620] New: undefined reference to '__sync_val_compare_and_swap_16'

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 12 10:20:40 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31620

            Bug ID: 31620
           Summary: undefined reference to
                    '__sync_val_compare_and_swap_16'
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dvyukov at google.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

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?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170112/b8e08817/attachment.html>


More information about the llvm-bugs mailing list