mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-28 16:11:29 +00:00
Revert "Reland "[compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests""
This reverts commit 255c3e3dcb
, which
breaks Msan-x86_64-Test.
This commit is contained in:
parent
4eaccea4f1
commit
beb3fa2d2e
@ -436,12 +436,9 @@ if (NOT MSVC)
|
||||
|
||||
# Build with optimization, unless we're in debug mode.
|
||||
if(COMPILER_RT_DEBUG)
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS -O0)
|
||||
string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " -O0")
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS -O1)
|
||||
else()
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS -O3)
|
||||
# FIXME: Omit for now, causes testsuite failures.
|
||||
#string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " -O3")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -476,7 +473,6 @@ if(MSVC)
|
||||
string(REGEX REPLACE "(^| )/Z[i7I]($| )" " /Z7 "
|
||||
"${var_to_update}" "${${var_to_update}}")
|
||||
endforeach()
|
||||
list(APPEND COMPILER_RT_UNITTEST_CFLAGS -gcodeview)
|
||||
elseif(APPLE)
|
||||
# On Apple platforms use full debug info (i.e. not `-gline-tables-only`)
|
||||
# for all build types so that the runtime can be debugged.
|
||||
@ -486,13 +482,8 @@ elseif(APPLE)
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS -g)
|
||||
elseif(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG AND NOT COMPILER_RT_DEBUG)
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
|
||||
# -gline-tables-only must be enough for these tests, so use it if possible.
|
||||
string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " -gline-tables-only")
|
||||
list(APPEND COMPILER_RT_UNITTEST_CFLAGS -gline-tables-only)
|
||||
elseif(COMPILER_RT_HAS_G_FLAG)
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS -g)
|
||||
string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " -g")
|
||||
list(APPEND COMPILER_RT_UNITTEST_CFLAGS -g)
|
||||
endif()
|
||||
|
||||
if(LLVM_ENABLE_MODULES)
|
||||
|
@ -29,6 +29,7 @@ set(ASAN_UNITTEST_COMMON_CFLAGS
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib/asan
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/tests
|
||||
-fno-rtti
|
||||
-O2
|
||||
-Wno-format
|
||||
-Werror=sign-compare)
|
||||
append_list_if(COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG -Wno-variadic-macros ASAN_UNITTEST_COMMON_CFLAGS)
|
||||
@ -39,6 +40,16 @@ set(ASAN_UNITTEST_COMMON_LINK_FLAGS
|
||||
${COMPILER_RT_UNITTEST_LINK_FLAGS}
|
||||
${COMPILER_RT_UNWINDER_LINK_LIBS}
|
||||
${SANITIZER_TEST_CXX_LIBRARIES})
|
||||
|
||||
# -gline-tables-only must be enough for ASan, so use it if possible.
|
||||
if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -gline-tables-only)
|
||||
else()
|
||||
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -g)
|
||||
endif()
|
||||
if(MSVC)
|
||||
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -gcodeview)
|
||||
endif()
|
||||
list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS -g)
|
||||
|
||||
# Use -D instead of definitions to please custom compile command.
|
||||
|
@ -4,7 +4,8 @@ set(LIBFUZZER_UNITTEST_CFLAGS
|
||||
${COMPILER_RT_UNITTEST_CFLAGS}
|
||||
${COMPILER_RT_GTEST_CFLAGS}
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib/fuzzer
|
||||
-fno-rtti)
|
||||
-fno-rtti
|
||||
-O2)
|
||||
|
||||
if (APPLE)
|
||||
set(FUZZER_SUPPORTED_OS osx)
|
||||
|
@ -6,6 +6,7 @@ set(GWP_ASAN_UNITTEST_CFLAGS
|
||||
${SANITIZER_TEST_CXX_CFLAGS}
|
||||
-std=c++17
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib/
|
||||
-O2
|
||||
-g
|
||||
-fno-omit-frame-pointer)
|
||||
|
||||
|
@ -18,6 +18,7 @@ set(INTERCEPTION_TEST_CFLAGS_COMMON
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib/interception
|
||||
-fno-rtti
|
||||
-O2
|
||||
-Werror=sign-compare)
|
||||
|
||||
set(INTERCEPTION_TEST_LINK_FLAGS_COMMON
|
||||
@ -25,7 +26,14 @@ set(INTERCEPTION_TEST_LINK_FLAGS_COMMON
|
||||
${COMPILER_RT_UNWINDER_LINK_LIBS}
|
||||
${SANITIZER_TEST_CXX_LIBRARIES})
|
||||
|
||||
# -gline-tables-only must be enough for these tests, so use it if possible.
|
||||
if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND INTERCEPTION_TEST_CFLAGS_COMMON -gline-tables-only)
|
||||
else()
|
||||
list(APPEND INTERCEPTION_TEST_CFLAGS_COMMON -g)
|
||||
endif()
|
||||
if(MSVC)
|
||||
list(APPEND INTERCEPTION_TEST_CFLAGS_COMMON -gcodeview)
|
||||
list(APPEND INTERCEPTION_TEST_LINK_FLAGS_COMMON
|
||||
-Wl,-largeaddressaware
|
||||
-Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames
|
||||
|
@ -33,6 +33,7 @@ set(MSAN_UNITTEST_COMMON_CFLAGS
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib/msan
|
||||
-g
|
||||
-O2
|
||||
-fno-omit-frame-pointer
|
||||
-mno-omit-leaf-frame-pointer
|
||||
-Wno-deprecated-declarations
|
||||
|
@ -98,11 +98,6 @@ struct integral_constant {
|
||||
constexpr value_type operator()() const { return value; }
|
||||
};
|
||||
|
||||
#if !__cpp_inline_variables
|
||||
template <typename T, T v>
|
||||
constexpr T integral_constant<T, v>::value;
|
||||
#endif
|
||||
|
||||
#ifndef __has_builtin
|
||||
# define __has_builtin(x) 0
|
||||
#endif
|
||||
|
@ -67,6 +67,7 @@ set(SANITIZER_TEST_CFLAGS_COMMON
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib
|
||||
-I${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common
|
||||
-fno-rtti
|
||||
-O2
|
||||
-Werror=sign-compare
|
||||
-Wno-gnu-zero-variadic-macro-arguments
|
||||
)
|
||||
@ -75,6 +76,16 @@ set(SANITIZER_TEST_LINK_FLAGS_COMMON
|
||||
${COMPILER_RT_UNITTEST_LINK_FLAGS}
|
||||
${COMPILER_RT_UNWINDER_LINK_LIBS}
|
||||
${SANITIZER_TEST_CXX_LIBRARIES})
|
||||
|
||||
# -gline-tables-only must be enough for these tests, so use it if possible.
|
||||
if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND SANITIZER_TEST_CFLAGS_COMMON -gline-tables-only)
|
||||
else()
|
||||
list(APPEND SANITIZER_TEST_CFLAGS_COMMON -g)
|
||||
endif()
|
||||
if(MSVC)
|
||||
list(APPEND SANITIZER_TEST_CFLAGS_COMMON -gcodeview)
|
||||
endif()
|
||||
list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -g)
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -80,4 +80,4 @@ TEST(SanitizerCommon, IsTriviallyCopyable) {
|
||||
ASSERT_FALSE((is_trivially_copyable<std::vector<int>>::value));
|
||||
}
|
||||
|
||||
} // namespace __sanitizer
|
||||
} // namespace __sanitizer
|
@ -23,15 +23,8 @@
|
||||
// There must be some difference in thread initialization
|
||||
// between normal execution and unit tests.
|
||||
# define TRACE_TEST(SUITE, NAME) TEST(SUITE, DISABLED_##NAME)
|
||||
# define TRACE_TEST_OPTIMIZED(SUITE, NAME) TEST(SUITE, DISABLED_##NAME)
|
||||
#else
|
||||
# define TRACE_TEST(SUITE, NAME) TEST(SUITE, NAME)
|
||||
// Some tests deadlock in debug builds.
|
||||
# if !SANITIZER_DEBUG
|
||||
# define TRACE_TEST_OPTIMIZED(SUITE, NAME) TEST(SUITE, NAME)
|
||||
# else
|
||||
# define TRACE_TEST_OPTIMIZED(SUITE, NAME) TEST(SUITE, DISABLED_##NAME)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace __tsan {
|
||||
@ -74,7 +67,7 @@ struct ThreadArray {
|
||||
operator ThreadState *() { return threads[0]; }
|
||||
};
|
||||
|
||||
TRACE_TEST_OPTIMIZED(Trace, RestoreAccess) {
|
||||
TRACE_TEST(Trace, RestoreAccess) {
|
||||
// A basic test with some function entry/exit events,
|
||||
// some mutex lock/unlock events and some other distracting
|
||||
// memory events.
|
||||
@ -119,7 +112,7 @@ TRACE_TEST_OPTIMIZED(Trace, RestoreAccess) {
|
||||
CHECK_EQ(tag, kExternalTagNone);
|
||||
}
|
||||
|
||||
TRACE_TEST_OPTIMIZED(Trace, MemoryAccessSize) {
|
||||
TRACE_TEST(Trace, MemoryAccessSize) {
|
||||
// Test tracing and matching of accesses of different sizes.
|
||||
struct Params {
|
||||
uptr access_size, offset, size;
|
||||
@ -174,7 +167,7 @@ TRACE_TEST_OPTIMIZED(Trace, MemoryAccessSize) {
|
||||
}
|
||||
}
|
||||
|
||||
TRACE_TEST_OPTIMIZED(Trace, RestoreMutexLock) {
|
||||
TRACE_TEST(Trace, RestoreMutexLock) {
|
||||
// Check of restoration of a mutex lock event.
|
||||
ThreadArray<1> thr;
|
||||
TraceFunc(thr, 0x1000);
|
||||
@ -204,7 +197,7 @@ TRACE_TEST_OPTIMIZED(Trace, RestoreMutexLock) {
|
||||
CHECK_EQ(mset.Get(1).write, false);
|
||||
}
|
||||
|
||||
TRACE_TEST_OPTIMIZED(Trace, MultiPart) {
|
||||
TRACE_TEST(Trace, MultiPart) {
|
||||
// Check replay of a trace with multiple parts.
|
||||
ThreadArray<1> thr;
|
||||
FuncEntry(thr, 0x1000);
|
||||
|
@ -7,8 +7,6 @@
|
||||
// tsan.
|
||||
// REQUIRES: shared_unwind
|
||||
|
||||
// XFAIL: !compiler-rt-optimized
|
||||
|
||||
// RUN: %clang_tsan -O1 %s -o %t
|
||||
// RUN: llvm-objdump -d -l %t | FileCheck %s
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user