-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[TYSan][CMake] CMake build fixes #121224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TYSan][CMake] CMake build fixes #121224
Conversation
TYSan CMake build follows patterns used by other sanitizers, but there's also a number of issues, like referring to undefined variables, which breaks the build in some cases (such as cross-compiling). This change addresses the issues.
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Petr Hosek (petrhosek) ChangesTYSan CMake build follows patterns used by other sanitizers, but there's also a number of issues, like referring to undefined variables, which breaks the build in some cases (such as cross-compiling). This change addresses the issues. Full diff: https://github.com/llvm/llvm-project/pull/121224.diff 1 Files Affected:
diff --git a/compiler-rt/lib/tysan/CMakeLists.txt b/compiler-rt/lib/tysan/CMakeLists.txt
index 859b67928f004a..a041ba5ee5937a 100644
--- a/compiler-rt/lib/tysan/CMakeLists.txt
+++ b/compiler-rt/lib/tysan/CMakeLists.txt
@@ -3,12 +3,25 @@ include_directories(..)
# Runtime library sources and build flags.
set(TYSAN_SOURCES
tysan.cpp
- tysan_interceptors.cpp)
+ tysan_interceptors.cpp
+ )
+
+SET(TYSAN_HEADERS
+ tysan_flags.inc
+ )
+
set(TYSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_rtti_flag(OFF TYSAN_COMMON_CFLAGS)
# Prevent clang from generating libc calls.
append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding TYSAN_COMMON_CFLAGS)
+set(TYSAN_COMMON_DEFINITIONS "")
+set(TYSAN_DYNAMIC_DEFINITIONS ${TYSAN_COMMON_DEFINITIONS})
+
+set(TYSAN_DYNAMIC_CFLAGS ${TYSAN_COMMON_CFLAGS})
+
+# Compile TYSan sources into an object library.
+
add_compiler_rt_object_libraries(RTTysan_dynamic
OS ${SANITIZER_COMMON_SUPPORTED_OS}
ARCHS ${TYSAN_SUPPORTED_ARCH}
@@ -47,17 +60,18 @@ if(APPLE)
DEFS ${TYSAN_COMMON_DEFINITIONS}
PARENT_TARGET tysan)
else()
+ set(TYSAN_CFLAGS ${TYSAN_COMMON_CFLAGS})
+ append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE TYSAN_CFLAGS)
+
foreach(arch ${TYSAN_SUPPORTED_ARCH})
- set(TYSAN_CFLAGS ${TYSAN_COMMON_CFLAGS})
- append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE TYSAN_CFLAGS)
add_compiler_rt_runtime(clang_rt.tysan
STATIC
ARCHS ${arch}
SOURCES ${TYSAN_SOURCES}
- $<TARGET_OBJECTS:RTInterception.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
+ OBJECT_LIBS RTInterception
+ RTSanitizerCommon
+ RTSanitizerCommonLibc
+ RTSanitizerCommonSymbolizer
CFLAGS ${TYSAN_CFLAGS}
PARENT_TARGET tysan)
endforeach()
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/1826 Here is the relevant piece of the build log for the reference
|
TYSan CMake build follows patterns used by other sanitizers, but there's also a number of issues, like referring to undefined variables, which breaks the build in some cases (such as cross-compiling). This change addresses the issues.