[compiler-rt] Undo lsan part of #98240 (PR #98409)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 16:04:49 PDT 2024
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/98409
And 388c55a3e676a75ac242ff4f2db3fa39e5f0b0a3
Note: compiler_rt_build_runtime(ubsan) is coverad by the loop below.
>From e8daedc824843b01fd3c8b4bd83d2c1f7656dc5f Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Wed, 10 Jul 2024 16:04:39 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
compiler-rt/lib/CMakeLists.txt | 4 +-
compiler-rt/lib/lsan/CMakeLists.txt | 69 +++++++++++++++--------------
2 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/compiler-rt/lib/CMakeLists.txt b/compiler-rt/lib/CMakeLists.txt
index 0e494bfa5939d..68352d1931f7c 100644
--- a/compiler-rt/lib/CMakeLists.txt
+++ b/compiler-rt/lib/CMakeLists.txt
@@ -38,8 +38,8 @@ endif()
if(COMPILER_RT_BUILD_SANITIZERS)
if(COMPILER_RT_HAS_SANITIZER_COMMON)
add_subdirectory(stats)
- compiler_rt_build_runtime(lsan)
- compiler_rt_build_runtime(ubsan)
+ # Contains LSanCommon used even without COMPILER_RT_HAS_LSAN.
+ add_subdirectory(lsan)
endif()
foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
diff --git a/compiler-rt/lib/lsan/CMakeLists.txt b/compiler-rt/lib/lsan/CMakeLists.txt
index c7bb6449982c2..cece6238a7901 100644
--- a/compiler-rt/lib/lsan/CMakeLists.txt
+++ b/compiler-rt/lib/lsan/CMakeLists.txt
@@ -36,6 +36,7 @@ set(LSAN_HEADERS
set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+# Used by asan/hwasan even without COMPILER_RT_HAS_LSAN.
add_compiler_rt_object_libraries(RTLSanCommon
OS ${SANITIZER_COMMON_SUPPORTED_OS}
ARCHS ${LSAN_COMMON_SUPPORTED_ARCH}
@@ -43,44 +44,46 @@ add_compiler_rt_object_libraries(RTLSanCommon
ADDITIONAL_HEADERS ${LSAN_HEADERS}
CFLAGS ${LSAN_CFLAGS})
-add_compiler_rt_component(lsan)
-if(APPLE)
- set(LSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
+if(COMPILER_RT_HAS_LSAN)
+ add_compiler_rt_component(lsan)
+ if(APPLE)
+ set(LSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
- add_weak_symbols("lsan" WEAK_SYMBOL_LINK_FLAGS)
- add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
+ add_weak_symbols("lsan" WEAK_SYMBOL_LINK_FLAGS)
+ add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
- add_compiler_rt_runtime(clang_rt.lsan
- SHARED
- OS ${LSAN_SUPPORTED_OS}
- ARCHS ${LSAN_SUPPORTED_ARCH}
- SOURCES ${LSAN_SOURCES}
- ADDITIONAL_HEADERS ${LSAN_HEADERS}
- OBJECT_LIBS RTLSanCommon
- RTInterception
- RTSanitizerCommon
- RTSanitizerCommonLibc
- RTSanitizerCommonCoverage
- RTSanitizerCommonSymbolizer
- CFLAGS ${LSAN_CFLAGS}
- LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
- LINK_LIBS ${LSAN_LINK_LIBS}
- PARENT_TARGET lsan)
-else()
- foreach(arch ${LSAN_SUPPORTED_ARCH})
add_compiler_rt_runtime(clang_rt.lsan
- STATIC
- ARCHS ${arch}
+ SHARED
+ OS ${LSAN_SUPPORTED_OS}
+ ARCHS ${LSAN_SUPPORTED_ARCH}
SOURCES ${LSAN_SOURCES}
- $<TARGET_OBJECTS:RTInterception.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>
- $<TARGET_OBJECTS:RTLSanCommon.${arch}>
ADDITIONAL_HEADERS ${LSAN_HEADERS}
+ OBJECT_LIBS RTLSanCommon
+ RTInterception
+ RTSanitizerCommon
+ RTSanitizerCommonLibc
+ RTSanitizerCommonCoverage
+ RTSanitizerCommonSymbolizer
CFLAGS ${LSAN_CFLAGS}
+ LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
+ LINK_LIBS ${LSAN_LINK_LIBS}
PARENT_TARGET lsan)
- endforeach()
+ else()
+ foreach(arch ${LSAN_SUPPORTED_ARCH})
+ add_compiler_rt_runtime(clang_rt.lsan
+ STATIC
+ ARCHS ${arch}
+ SOURCES ${LSAN_SOURCES}
+ $<TARGET_OBJECTS:RTInterception.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>
+ $<TARGET_OBJECTS:RTLSanCommon.${arch}>
+ ADDITIONAL_HEADERS ${LSAN_HEADERS}
+ CFLAGS ${LSAN_CFLAGS}
+ PARENT_TARGET lsan)
+ endforeach()
+ endif()
endif()
More information about the llvm-commits
mailing list