[compiler-rt] 9bf2e7e - [TSan] Add SystemZ SANITIZER_GO support
Ilya Leoshkevich via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 15 03:19:35 PDT 2021
Author: Ilya Leoshkevich
Date: 2021-07-15T12:18:48+02:00
New Revision: 9bf2e7eeebbd7524cfa3c448b40196fcd0a1a4cb
URL: https://github.com/llvm/llvm-project/commit/9bf2e7eeebbd7524cfa3c448b40196fcd0a1a4cb
DIFF: https://github.com/llvm/llvm-project/commit/9bf2e7eeebbd7524cfa3c448b40196fcd0a1a4cb.diff
LOG: [TSan] Add SystemZ SANITIZER_GO support
Define the address ranges (similar to the C/C++ ones, but with the heap
range merged into the app range) and enable the sanity check.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D105629
Added:
Modified:
compiler-rt/lib/tsan/CMakeLists.txt
compiler-rt/lib/tsan/go/buildgo.sh
compiler-rt/lib/tsan/rtl/tsan_platform.h
compiler-rt/test/tsan/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt
index e0d3d6abea4e..c1fa34fdf205 100644
--- a/compiler-rt/lib/tsan/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/CMakeLists.txt
@@ -223,6 +223,16 @@ else()
add_asm_sources(TSAN_ASM_SOURCES
rtl/tsan_rtl_s390x.S
)
+ # Sanity check for Go runtime.
+ set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
+ add_custom_target(GotsanRuntimeCheck
+ COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
+ EXTRA_CFLAGS=${EXTRA_CFLAGS}
+ IN_TMPDIR=1 SILENT=1 ${BUILDGO_SCRIPT}
+ DEPENDS clang_rt.tsan-${arch} ${BUILDGO_SCRIPT}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
+ COMMENT "Checking TSan Go runtime..."
+ VERBATIM)
else()
set(TSAN_ASM_SOURCES)
endif()
diff --git a/compiler-rt/lib/tsan/go/buildgo.sh b/compiler-rt/lib/tsan/go/buildgo.sh
index 0902d10f4f15..87f2f3b95a96 100755
--- a/compiler-rt/lib/tsan/go/buildgo.sh
+++ b/compiler-rt/lib/tsan/go/buildgo.sh
@@ -72,6 +72,10 @@ if [ "`uname -a | grep Linux`" != "" ]; then
SUFFIX="linux_mips64"
ARCHCFLAGS="-mips64 -EB"
fi
+ elif [ "`uname -a | grep s390x`" != "" ]; then
+ SRCS="$SRCS ../../sanitizer_common/sanitizer_linux_s390.cpp"
+ SUFFIX="linux_s390x"
+ ARCHCFLAGS=""
fi
elif [ "`uname -a | grep FreeBSD`" != "" ]; then
# The resulting object still depends on libc.
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform.h b/compiler-rt/lib/tsan/rtl/tsan_platform.h
index 1893ca3ed0e1..8bd218e25fd6 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform.h
@@ -560,6 +560,28 @@ struct Mapping47 {
#define TSAN_RUNTIME_VMA 1
+#elif SANITIZER_GO && defined(__s390x__)
+/*
+Go on linux/s390x
+0000 0000 1000 - 1000 0000 0000: executable and heap - 16 TiB
+1000 0000 0000 - 4000 0000 0000: -
+4000 0000 0000 - 8000 0000 0000: shadow - 64TiB (4 * app)
+8000 0000 0000 - 9000 0000 0000: -
+9000 0000 0000 - 9800 0000 0000: metainfo - 8TiB (0.5 * app)
+9800 0000 0000 - a000 0000 0000: -
+a000 0000 0000 - b000 0000 0000: traces - 16TiB (max history * 128k threads)
+*/
+struct Mapping {
+ static const uptr kMetaShadowBeg = 0x900000000000ull;
+ static const uptr kMetaShadowEnd = 0x980000000000ull;
+ static const uptr kTraceMemBeg = 0xa00000000000ull;
+ static const uptr kTraceMemEnd = 0xb00000000000ull;
+ static const uptr kShadowBeg = 0x400000000000ull;
+ static const uptr kShadowEnd = 0x800000000000ull;
+ static const uptr kAppMemBeg = 0x000000001000ull;
+ static const uptr kAppMemEnd = 0x100000000000ull;
+};
+
#else
# error "Unknown platform"
#endif
diff --git a/compiler-rt/test/tsan/CMakeLists.txt b/compiler-rt/test/tsan/CMakeLists.txt
index c8f8eba50dfc..318a91f73ef7 100644
--- a/compiler-rt/test/tsan/CMakeLists.txt
+++ b/compiler-rt/test/tsan/CMakeLists.txt
@@ -1,7 +1,7 @@
set(TSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(TSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
-if(${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "x86_64")
+if(${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "(x86_64|s390x)")
list(APPEND TSAN_TEST_DEPS GotsanRuntimeCheck)
endif()
if(NOT COMPILER_RT_STANDALONE_BUILD)
More information about the llvm-commits
mailing list