[compiler-rt] 77d5ccd - [compiler-rt][test] Add shared_unwind requirement

Leonard Chan via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 11:10:53 PDT 2021


Author: Leonard Chan
Date: 2021-10-06T11:10:36-07:00
New Revision: 77d5ccdc6f460732942c8630c7356e72f48ccf39

URL: https://github.com/llvm/llvm-project/commit/77d5ccdc6f460732942c8630c7356e72f48ccf39
DIFF: https://github.com/llvm/llvm-project/commit/77d5ccdc6f460732942c8630c7356e72f48ccf39.diff

LOG: [compiler-rt][test] Add shared_unwind requirement

When using a static libunwind, the check_memcpy.c can fail because it checks
that tsan intercepted all memcpy/memmoves in the final binary. Though if the
static libunwind is not instrumented, then this will fail because it may contain
regular memcpy/memmoves.

This adds a new REQUIRES check for ensuring that this test won't run unless a
dynamic libunwind.so is provided.

Differential Revision: https://reviews.llvm.org/D111194

Added: 
    

Modified: 
    compiler-rt/CMakeLists.txt
    compiler-rt/test/lit.common.cfg.py
    compiler-rt/test/lit.common.configured.in
    compiler-rt/test/tsan/Linux/check_memcpy.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 4bbcf9aca4e8..aa14ceff495a 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -233,6 +233,7 @@ endif()
 
 option(SANITIZER_USE_STATIC_LLVM_UNWINDER
   "Use static LLVM unwinder." ${DEFAULT_SANITIZER_USE_STATIC_LLVM_UNWINDER})
+pythonize_bool(SANITIZER_USE_STATIC_LLVM_UNWINDER)
 
 set(DEFAULT_SANITIZER_USE_STATIC_CXX_ABI OFF)
 if (DEFINED LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_SHARED)

diff  --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index ca9047b319fa..a5ef10faac5c 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -366,6 +366,9 @@ def get_ios_commands_dir():
 if not getattr(config, 'sanitizer_uses_static_cxxabi', False):
   config.available_features.add('shared_cxxabi')
 
+if not getattr(config, 'sanitizer_uses_static_unwind', False):
+  config.available_features.add('shared_unwind')
+
 if config.has_lld:
   config.available_features.add('lld-available')
 

diff  --git a/compiler-rt/test/lit.common.configured.in b/compiler-rt/test/lit.common.configured.in
index be4501be87e6..42a5b559b913 100644
--- a/compiler-rt/test/lit.common.configured.in
+++ b/compiler-rt/test/lit.common.configured.in
@@ -34,6 +34,7 @@ set_default("apple_platform", "osx")
 set_default("apple_platform_min_deployment_target_flag", "-mmacosx-version-min")
 set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
 set_default("sanitizer_uses_static_cxxabi", @SANITIZER_USE_STATIC_CXX_ABI_PYBOOL@)
+set_default("sanitizer_uses_static_unwind", @SANITIZER_USE_STATIC_LLVM_UNWINDER_PYBOOL@)
 set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
 set_default("can_symbolize", @CAN_SYMBOLIZE@)
 set_default("use_lld", @COMPILER_RT_TEST_USE_LLD_PYBOOL@)

diff  --git a/compiler-rt/test/tsan/Linux/check_memcpy.c b/compiler-rt/test/tsan/Linux/check_memcpy.c
index 55705ce8154c..26f99612e50f 100644
--- a/compiler-rt/test/tsan/Linux/check_memcpy.c
+++ b/compiler-rt/test/tsan/Linux/check_memcpy.c
@@ -2,6 +2,11 @@
 // memcpy/memmove calls. It builds the binary with TSan and check's
 // its objdump.
 
+// This could fail if using a static libunwind because that static libunwind
+// could be uninstrumented and contain memcpy/memmove calls not intercepted by
+// tsan.
+// REQUIRES: shared_unwind
+
 // RUN: %clang_tsan -O1 %s -o %t
 // RUN: llvm-objdump -d -l %t | FileCheck %s
 


        


More information about the llvm-commits mailing list