Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2019 14:57:51 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 234976] Clang: undefined reference to __atomic_exchange and __atomic_load
Message-ID:  <bug-234976-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234976

            Bug ID: 234976
           Summary: Clang: undefined reference to __atomic_exchange and
                    __atomic_load
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: vallentin@icir.org

I'm having trouble with compiling the following code snippet:

#include <atomic>
#include <cstdint>

struct sixteen {
  uint64_t x =3D 1;
  int64_t  y =3D -1;
};

std::atomic<sixteen> x;

int main() {
  auto v =3D x.load(std::memory_order_relaxed);
  return std::atomic_is_lock_free(&x);
}

I've attempted to compile this as follows:

c++ -std=3Dc++17 -stdlib=3Dlibc++ test.cpp
/tmp/test-3fe722.o: In function `main':
test.cpp:(.text+0x34): undefined reference to `__atomic_load'
test.cpp:(.text+0x86): undefined reference to `__atomic_is_lock_free'
c++: error: linker command failed with exit code 1 (use -v to see invocatio=
n)

The same snippet compiles fine with GCC 8 and -latomic.

This issue appears to be related to bug #233725 and bug #220822.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-234976-227>