[PATCH] Change CMakeLists to build the common LSan module for ASan.
Sergey Matveev
earthdok at google.com
Mon May 20 08:03:28 PDT 2013
Hi kcc, samsonov,
http://llvm-reviews.chandlerc.com/D828
Files:
lib/asan/CMakeLists.txt
lib/lsan/CMakeLists.txt
lib/lsan/lsan_common.cc
lib/lsan/lsan_common_linux.cc
Index: lib/asan/CMakeLists.txt
===================================================================
--- lib/asan/CMakeLists.txt
+++ lib/asan/CMakeLists.txt
@@ -85,6 +85,7 @@
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+ $<TARGET_OBJECTS:RTLSanCommon.${arch}>
CFLAGS ${ASAN_CFLAGS}
DEFS ${ASAN_COMMON_DEFINITIONS}
SYMS asan.syms)
Index: lib/lsan/CMakeLists.txt
===================================================================
--- lib/lsan/CMakeLists.txt
+++ lib/lsan/CMakeLists.txt
@@ -3,24 +3,46 @@
set(LSAN_CFLAGS
${SANITIZER_COMMON_CFLAGS})
+set(LSAN_COMMON_SOURCES
+ lsan_common.cc
+ lsan_common_linux.cc)
+
set(LSAN_SOURCES
lsan_interceptors.cc
lsan_allocator.cc
lsan_thread.cc
- lsan.cc
- lsan_common.cc
- lsan_common_linux.cc)
+ lsan.cc)
set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+# The common files need to build on every arch supported by ASan.
+# (Even if they build into dummy object files.)
+filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH
+ x86_64 i386 powerpc64 powerpc)
+
+# Architectures supported by the standalone LSan.
+filter_available_targets(LSAN_SUPPORTED_ARCH
+ x86_64)
+
set(LSAN_RUNTIME_LIBRARIES)
-set(arch "x86_64")
-add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch}
- SOURCES ${LSAN_SOURCES}
- $<TARGET_OBJECTS:RTInterception.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
- CFLAGS ${LSAN_CFLAGS})
-list(APPEND LSAN_RUNTIME_LIBRARIES clang_rt.lsan-${arch})
+
+if (NOT APPLE AND NOT ANDROID)
+ foreach(arch ${LSAN_COMMON_SUPPORTED_ARCH})
+ add_compiler_rt_object_library(RTLSanCommon ${arch}
+ SOURCES ${LSAN_COMMON_SOURCES}
+ CFLAGS ${LSAN_CFLAGS})
+ endforeach()
+
+ foreach(arch ${LSAN_SUPPORTED_ARCH})
+ add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch}
+ SOURCES ${LSAN_SOURCES}
+ $<TARGET_OBJECTS:RTInterception.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+ $<TARGET_OBJECTS:RTLSanCommon.${arch}>
+ CFLAGS ${LSAN_CFLAGS})
+ list(APPEND LSAN_RUNTIME_LIBRARIES clang_rt.lsan-${arch})
+ endforeach()
+endif()
add_subdirectory(tests)
Index: lib/lsan/lsan_common.cc
===================================================================
--- lib/lsan/lsan_common.cc
+++ lib/lsan/lsan_common.cc
@@ -12,6 +12,8 @@
//
//===----------------------------------------------------------------------===//
+#include "sanitizer_common/sanitizer_platform.h"
+#if SANITIZER_LINUX && defined(__x86_64__)
#include "lsan_common.h"
#include "sanitizer_common/sanitizer_common.h"
@@ -383,3 +385,4 @@
}
} // namespace __lsan
+#endif // SANITIZER_LINUX && defined(__x86_64__)
Index: lib/lsan/lsan_common_linux.cc
===================================================================
--- lib/lsan/lsan_common_linux.cc
+++ lib/lsan/lsan_common_linux.cc
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common/sanitizer_platform.h"
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX && defined(__x86_64__)
#include "lsan_common.h"
#include <link.h>
@@ -120,4 +120,4 @@
}
} // namespace __lsan
-#endif // SANITIZER_LINUX
+#endif // SANITIZER_LINUX && defined(__x86_64__)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D828.1.patch
Type: text/x-patch
Size: 3525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130520/88b6b07e/attachment.bin>
More information about the llvm-commits
mailing list