[libcxx-commits] [PATCH] D88818: [libc++][FreeBSD] XFAIL tests that need __atomic_* libcalls on older versions

Alexander Richardson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 19 06:19:30 PDT 2020


arichardson added a comment.

In D88818#2328026 <https://reviews.llvm.org/D88818#2328026>, @ldionne wrote:

> What is the error that you're seeing? How are you running the test suite?
>
> It looks like you are running against the system library, right? If so, we already have a feature to handle these sorts of `XFAIL`s, it's `with_system_cxx_lib=<system>`. It's only used by macOS for the time being, but it can (and should) be used by other systems as well.

I am running the tests against a just-build libc++: `mkdir -p libcxx/build && cd libcxx/build && cmake -GNinja .. && ninja check-cxx`
Most of the atomics tests need libatomic since they perform large atomic operations that are not natively supported and therefore call __atomic_store/__atomic_load, etc. This works on Linux since `LinuxLocalTI` adds -latomic to the linker flags but FreeBSD does not ship a libatomic.
As of https://reviews.freebsd.org/rS364753 the __atomic atomic functions are included in libcompiler-rt.a and libgcc_s.so.

Here is an example of a failing test with a full command line:

  FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
  Target: x86_64-unknown-freebsd12
  Thread model: posix
  InstalledDir: /usr/bin
   "/usr/bin/c++" -cc1 -triple x86_64-unknown-freebsd12 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name atomic_load_explicit.pass.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -nostdinc++ -resource-dir /usr/lib/clang/8.0.1 -include /exports/users/alr48/sources/upstream-llvm-project/libcxx/build/__config_site -include /exports/users/alr48/sources/upstream-llvm-project/libcxx/test/support/nasty_macros.h -I /exports/users/alr48/sources/upstream-llvm-project/libcxx/include -I /exports/users/alr48/sources/upstream-llvm-project/libcxx/build/include/c++build -I /exports/users/alr48/sources/upstream-llvm-project/libcxx/test/support -D _LIBCPP_DISABLE_AVAILABILITY -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Werror=thread-safety -Wuser-defined-warnings -std=c++2a -fdeprecated-macro -fdebug-compilation-dir /exports/users/alr48/sources/upstream-llvm-project/libcxx/build/test/std/atomics/atomics.types.operations/atomics.types.operations.req -ferror-limit 19 -fmessage-length 0 -fcoroutines-ts -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/atomic_load_explicit-edb87d.o -x c++ /exports/users/alr48/sources/upstream-llvm-project/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp -faddrsig
  clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target x86_64-unknown-freebsd12.1
  #include "..." search starts here:
  #include <...> search starts here:
   /exports/users/alr48/sources/upstream-llvm-project/libcxx/include
   /exports/users/alr48/sources/upstream-llvm-project/libcxx/build/include/c++build
   /exports/users/alr48/sources/upstream-llvm-project/libcxx/test/support
   /usr/lib/clang/8.0.1/include
   /usr/include
  End of search list.
   "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o /exports/users/alr48/sources/upstream-llvm-project/libcxx/build/test/std/atomics/atomics.types.operations/atomics.types.operations.req/Output/atomic_load_explicit.pass.cpp.dir/t.tmp.exe /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/exports/users/alr48/sources/upstream-llvm-project/libcxx/build/lib -L/usr/lib /tmp/atomic_load_explicit-edb87d.o -rpath /exports/users/alr48/sources/upstream-llvm-project/libcxx/build/lib -lc++ -lc -lm -lpthread -lgcc_s -lcxxrt -lc++experimental /usr/lib/crtend.o /usr/lib/crtn.o
  ld: error: undefined symbol: __atomic_load
  >>> referenced by atomic_load_explicit.pass.cpp
  >>>               /tmp/atomic_load_explicit-edb87d.o:(LargeUserAtomicType std::__1::__cxx_atomic_load<LargeUserAtomicType>(std::__1::__cxx_atomic_base_impl<LargeUserAtomicType> const*, std::__1::memory_order))
  
  ld: error: undefined symbol: __atomic_load
  >>> referenced by atomic_load_explicit.pass.cpp
  >>>               /tmp/atomic_load_explicit-edb87d.o:(LargeUserAtomicType std::__1::__cxx_atomic_load<LargeUserAtomicType>(std::__1::__cxx_atomic_base_impl<LargeUserAtomicType> const volatile*, std::__1::memory_order))
  c++: error: linker command failed with exit code 1 (use -v to see invocation)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88818/new/

https://reviews.llvm.org/D88818



More information about the libcxx-commits mailing list