Index: compiler-rt/CMakeLists.txt =================================================================== --- compiler-rt/CMakeLists.txt +++ compiler-rt/CMakeLists.txt @@ -114,6 +114,7 @@ if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$") if (${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "^arm") set(COMPILER_RT_DEFAULT_TARGET_ARCH "armhf") + CHECK_SYMBOL_EXISTS (__thumb__ "" COMPILER_RT_ARM_THUMB) endif() endif() if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*android.*") Index: compiler-rt/lib/sanitizer_common/sanitizer_flags.inc =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_flags.inc +++ compiler-rt/lib/sanitizer_common/sanitizer_flags.inc @@ -40,7 +40,12 @@ COMMON_FLAG(bool, fast_unwind_on_fatal, false, "If available, use the fast frame-pointer-based unwinder on fatal " "errors.") -COMMON_FLAG(bool, fast_unwind_on_malloc, true, +// ARM thumb/thumb2 frame pointer is inconsistent on GCC and Clang [1] +// and fast-unwider is also unreliable with mixing arm and thumb code [2]. +// [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92172 +// [2] https://bugs.llvm.org/show_bug.cgi?id=44158 +COMMON_FLAG(bool, fast_unwind_on_malloc, + !(SANITIZER_LINUX && !SANITIZER_ANDROID && SANITIZER_ARM), "If available, use the fast frame-pointer-based unwinder on " "malloc/free.") COMMON_FLAG(bool, handle_ioctl, false, "Intercept and handle ioctl requests.") Index: compiler-rt/test/asan/TestCases/Linux/clang_gcc_abi.cpp =================================================================== --- compiler-rt/test/asan/TestCases/Linux/clang_gcc_abi.cpp +++ compiler-rt/test/asan/TestCases/Linux/clang_gcc_abi.cpp @@ -1,7 +1,7 @@ -// RUN: %clangxx_asan -O0 -x c %s -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O1 -x c %s -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O2 -x c %s -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 -x c %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 -x c %s -o %t && not %env_asan_opts=fast_unwind_on_malloc=1 %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O1 -x c %s -o %t && not %env_asan_opts=fast_unwind_on_malloc=1 %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O2 -x c %s -o %t && not %env_asan_opts=fast_unwind_on_malloc=1 %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 -x c %s -o %t && not %env_asan_opts=fast_unwind_on_malloc=1 %run %t 2>&1 | FileCheck %s // REQUIRES: (arm-target-arch || armhf-target-arch), fast-unwinder-works Index: compiler-rt/test/asan/lit.cfg.py =================================================================== --- compiler-rt/test/asan/lit.cfg.py +++ compiler-rt/test/asan/lit.cfg.py @@ -205,7 +205,7 @@ config.available_features.add("asan-" + config.bits + "-bits") # Fast unwinder doesn't work with Thumb -if re.search('mthumb', config.target_cflags) is None: +if not config.arm_thumb: config.available_features.add('fast-unwinder-works') # Turn on leak detection on 64-bit Linux. Index: compiler-rt/test/asan/lit.site.cfg.py.in =================================================================== --- compiler-rt/test/asan/lit.site.cfg.py.in +++ compiler-rt/test/asan/lit.site.cfg.py.in @@ -5,6 +5,7 @@ config.target_cflags = "@ASAN_TEST_TARGET_CFLAGS@" config.clang = "@ASAN_TEST_TARGET_CC@" config.bits = "@ASAN_TEST_BITS@" +config.arm_thumb = "@COMPILER_RT_ARM_THUMB@" config.apple_platform = "@ASAN_TEST_APPLE_PLATFORM@" config.apple_platform_min_deployment_target_flag = "@ASAN_TEST_MIN_DEPLOYMENT_TARGET_FLAG@" config.asan_dynamic = @ASAN_TEST_DYNAMIC@