Index: libcxx/utils/ci/Dockerfile =================================================================== --- libcxx/utils/ci/Dockerfile +++ libcxx/utils/ci/Dockerfile @@ -65,7 +65,7 @@ # Install the most recent GCC ENV GCC_LATEST_VERSION=11 RUN add-apt-repository ppa:ubuntu-toolchain-r/test -RUN apt-get update && apt install -y gcc-$GCC_LATEST_VERSION g++-$GCC_LATEST_VERSION +RUN apt-get update && apt install -y gcc-$GCC_LATEST_VERSION g++-$GCC_LATEST_VERSION gcc-$GCC_LATEST_VERSION-multilib g++-$GCC_LATEST_VERSION-multilib # Install a recent CMake RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1-linux-x86_64.sh -O /tmp/install-cmake.sh Index: libcxx/utils/libcxx/test/target_info.py =================================================================== --- libcxx/utils/libcxx/test/target_info.py +++ libcxx/utils/libcxx/test/target_info.py @@ -74,7 +74,12 @@ super(FreeBSDLocalTI, self).__init__(full_config) def add_cxx_link_flags(self, flags): - flags += ['-lc', '-lm', '-lpthread', '-lgcc_s', '-lcxxrt'] + flags += ['-lc', '-lm', '-lpthread', '-lcxxrt'] + llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False) + if llvm_unwinder: + flags += ['-lunwind', '-ldl'] + else: + flags += ['-lgcc_s'] class NetBSDLocalTI(DefaultTargetInfo): Index: libunwind/test/floatregister.pass.cpp =================================================================== --- libunwind/test/floatregister.pass.cpp +++ libunwind/test/floatregister.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: linux && target={{aarch64-.+}} +// REQUIRES: (linux || freebsd) && target={{aarch64-.+}} // Basic test for float registers number are accepted. Index: libunwind/test/forceunwind.pass.cpp =================================================================== --- libunwind/test/forceunwind.pass.cpp +++ libunwind/test/forceunwind.pass.cpp @@ -7,13 +7,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: linux - -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits +// REQUIRES: linux || freebsd // Basic test for _Unwind_ForcedUnwind. // See libcxxabi/test/forced_unwind* tests too. Index: libunwind/test/frameheadercache_test.pass.cpp =================================================================== --- libunwind/test/frameheadercache_test.pass.cpp +++ libunwind/test/frameheadercache_test.pass.cpp @@ -1,9 +1,3 @@ -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits - // The other libunwind tests don't test internal interfaces, so the include path // is a little wonky. #include "../src/config.h" Index: libunwind/test/libunwind/test/config.py =================================================================== --- libunwind/test/libunwind/test/config.py +++ libunwind/test/libunwind/test/config.py @@ -45,7 +45,7 @@ self.cxx.compile_flags += ['-funwind-tables'] # Make symbols available in the tests. triple = self.get_lit_conf('target_triple', None) - if triple is not None and 'linux' in triple: + if triple is not None and ('linux' in triple or 'freebsd' in triple): self.cxx.link_flags += ['-Wl,--export-dynamic'] if not self.get_lit_bool('enable_threads', True): self.cxx.compile_flags += ['-D_LIBUNWIND_HAS_NO_THREADS'] @@ -68,5 +68,10 @@ pass def configure_link_flags_abi_library(self): - # libunwind tests should not link with libc++abi - pass + # libunwind tests should not link with libcabi++ except when a sanitizer is used. + sanitizers = getattr(self.config, 'use_sanitizer', None) + if sanitizers is not None: + super().configure_link_flags_abi_library() + if 'Thread' in sanitizers: + # -fsanitize=thread depends on __gcc_personality_v0 + self.cxx.link_flags += ['-lgcc_s'] Index: libunwind/test/libunwind_01.pass.cpp =================================================================== --- libunwind/test/libunwind_01.pass.cpp +++ libunwind/test/libunwind_01.pass.cpp @@ -1,12 +1,3 @@ -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate these failures on x86_64 macOS -// XFAIL: target=x86_64-apple-darwin{{.+}} - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits - #include #include #include @@ -77,6 +68,8 @@ max_reg_num = 7; #elif defined(__x86_64__) max_reg_num = 32; +#elif defined(__aarch64__) + max_reg_num = 32; #endif const char prefix[] = "unknown"; Index: libunwind/test/libunwind_02.pass.cpp =================================================================== --- libunwind/test/libunwind_02.pass.cpp +++ libunwind/test/libunwind_02.pass.cpp @@ -1,9 +1,3 @@ -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits - #include #include #include Index: libunwind/test/lit.site.cfg.in =================================================================== --- libunwind/test/lit.site.cfg.in +++ libunwind/test/lit.site.cfg.in @@ -3,6 +3,8 @@ @SERIALIZED_LIT_PARAMS@ import os +import platform +import pipes import site config.cxx_under_test = "@CMAKE_CXX_COMPILER@" @@ -44,6 +46,13 @@ # Allow expanding substitutions that are based on other substitutions config.recursiveExpansionLimit = 10 +if platform.system() == 'Darwin': + config.substitutions.append(('%{exec}', + '{} --execdir %T --env DYLD_LIBRARY_PATH={} -- '.format( + config.executor, + pipes.quote(config.abi_library_root)) + )) + # Infer the test_exec_root from the build directory. config.test_exec_root = os.path.join(config.libunwind_obj_root, 'test') Index: libunwind/test/remember_state_leak.pass.sh.s =================================================================== --- libunwind/test/remember_state_leak.pass.sh.s +++ libunwind/test/remember_state_leak.pass.sh.s @@ -1,16 +1,8 @@ # REQUIRES: target={{x86_64-.+-linux-gnu}} +# UNSUPPORTED: 32bits-on-64bits # RUN: %{build} # RUN: %{run} -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits - -# TODO: Investigate this failure on GCC. -# XFAIL: gcc - # The following assembly is a translation of this code: # # _Unwind_Reason_Code callback(int, _Unwind_Action, long unsigned int, @@ -52,7 +44,7 @@ movq %rsp, %rdi movabsq $callback, %rsi xorl %edx, %edx - callq _Unwind_ForcedUnwind + callq *_Unwind_ForcedUnwind@GOTPCREL(%rip) .cfi_restore_state xorl %eax, %eax addq $SIZEOF_UNWIND_EXCEPTION, %rsp Index: libunwind/test/signal_frame.pass.cpp =================================================================== --- libunwind/test/signal_frame.pass.cpp +++ libunwind/test/signal_frame.pass.cpp @@ -8,16 +8,8 @@ //===----------------------------------------------------------------------===// // Ensure that functions marked as signal frames are reported as such. - -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate this failure on macOS -// XFAIL: target={{.+}}-apple-darwin{{.+}} - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits - +// cfi_signal_frame is only supported on DWARF based systems. +// REQUIRED: linux || freebsd // UNSUPPORTED: libunwind-arm-ehabi #include Index: libunwind/test/signal_unwind.pass.cpp =================================================================== --- libunwind/test/signal_unwind.pass.cpp +++ libunwind/test/signal_unwind.pass.cpp @@ -10,12 +10,6 @@ // Ensure that the unwinder can cope with the signal handler. // REQUIRES: linux && (target={{aarch64-.+}} || target={{x86_64-.+}}) -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits - #include #include #include Index: libunwind/test/unw_getcontext.pass.cpp =================================================================== --- libunwind/test/unw_getcontext.pass.cpp +++ libunwind/test/unw_getcontext.pass.cpp @@ -1,6 +1,3 @@ -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - #include #include Index: libunwind/test/unwind_leaffunction.pass.cpp =================================================================== --- libunwind/test/unwind_leaffunction.pass.cpp +++ libunwind/test/unwind_leaffunction.pass.cpp @@ -10,12 +10,6 @@ // Ensure that leaf function can be unwund. // REQUIRES: linux && (target={{aarch64-.+}} || target={{x86_64-.+}}) -// TODO: Investigate these failures -// XFAIL: asan, tsan, ubsan - -// TODO: Investigate this failure -// XFAIL: 32bits-on-64bits - #include #include #include @@ -46,7 +40,7 @@ int* faultyPointer = NULL; -__attribute__((noinline)) void crashing_leaf_func(void) { +__attribute__((noinline,no_sanitize("undefined"))) void crashing_leaf_func(void) { *faultyPointer = 0; }