diff options
author | Alexander Potapenko <glider@google.com> | 2013-11-07 10:08:19 +0000 |
---|---|---|
committer | Alexander Potapenko <glider@google.com> | 2013-11-07 10:08:19 +0000 |
commit | 49496747758bf44163768ce3e07e40c8f95ccba9 (patch) | |
tree | 894adbc0718aac47996d64de69114deb53d72953 /lib/asan/CMakeLists.txt | |
parent | f16dc4234098a22a9d0d56f0198d87905481e7fd (diff) | |
download | compiler-rt-49496747758bf44163768ce3e07e40c8f95ccba9.tar.gz compiler-rt-49496747758bf44163768ce3e07e40c8f95ccba9.tar.bz2 compiler-rt-49496747758bf44163768ce3e07e40c8f95ccba9.tar.xz |
[ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib
CMake changes to build the ASan runtime for the iOS simulator. This is a universal library targeting the same architectures as the OSX ASan runtime does, thus the iossim version can't live in the same universal libclang_rt.asan_osx_dynamic.dylib
The difference between the OSX and iossim builds is in the -mios-simulator-version-min and -ios_simulator_version_min flags that tell Clang to compile and link iossim code.
The iossim runtime can only be built on a machine with both Xcode and the iOS Simulator SDK installed. If xcodebuild -version -sdk iphonesimulator Path returns a nonempty path, it is used when compiling and linking the iossim runtime.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@194199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/CMakeLists.txt')
-rw-r--r-- | lib/asan/CMakeLists.txt | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/lib/asan/CMakeLists.txt b/lib/asan/CMakeLists.txt index 17552b3a..ba5dc05d 100644 --- a/lib/asan/CMakeLists.txt +++ b/lib/asan/CMakeLists.txt @@ -57,11 +57,13 @@ filter_available_targets(ASAN_SUPPORTED_ARCH # Compile ASan sources into an object library. if(APPLE) - add_compiler_rt_osx_object_library(RTAsan - ARCH ${ASAN_SUPPORTED_ARCH} - SOURCES ${ASAN_SOURCES} - CFLAGS ${ASAN_CFLAGS} - DEFS ${ASAN_COMMON_DEFINITIONS}) + foreach(os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS}) + add_compiler_rt_darwin_object_library(RTAsan ${os} + ARCH ${ASAN_SUPPORTED_ARCH} + SOURCES ${ASAN_SOURCES} + CFLAGS ${ASAN_CFLAGS} + DEFS ${ASAN_COMMON_DEFINITIONS}) + endforeach() elseif(ANDROID) add_library(RTAsan.arm.android OBJECT ${ASAN_SOURCES}) set_target_compile_flags(RTAsan.arm.android ${ASAN_CFLAGS}) @@ -78,19 +80,26 @@ endif() # Build ASan runtimes shipped with Clang. set(ASAN_RUNTIME_LIBRARIES) if(APPLE) - add_compiler_rt_osx_dynamic_runtime(clang_rt.asan_osx_dynamic - ARCH ${ASAN_SUPPORTED_ARCH} - SOURCES $<TARGET_OBJECTS:RTAsan.osx> - $<TARGET_OBJECTS:RTInterception.osx> - $<TARGET_OBJECTS:RTSanitizerCommon.osx> - $<TARGET_OBJECTS:RTLSanCommon.osx> - CFLAGS ${ASAN_CFLAGS} - DEFS ${ASAN_COMMON_DEFINITIONS} + foreach (os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS}) # Dynamic lookup is needed because shadow scale and offset are # provided by the instrumented modules. - LINKFLAGS "-framework Foundation" - "-undefined dynamic_lookup") - list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan_osx_dynamic) + set(ASAN_RUNTIME_LDFLAGS + "-undefined dynamic_lookup") + if (os STREQUAL "osx") + list(APPEND ASAN_RUNTIME_LDFLAGS "-framework Foundation") + endif() + add_compiler_rt_darwin_dynamic_runtime(clang_rt.asan_${os}_dynamic ${os} + ARCH ${ASAN_SUPPORTED_ARCH} + SOURCES $<TARGET_OBJECTS:RTAsan.${os}> + $<TARGET_OBJECTS:RTInterception.${os}> + $<TARGET_OBJECTS:RTSanitizerCommon.${os}> + $<TARGET_OBJECTS:RTLSanCommon.${os}> + CFLAGS ${ASAN_CFLAGS} + DEFS ${ASAN_COMMON_DEFINITIONS} + LINKFLAGS ${ASAN_RUNTIME_LDFLAGS}) + list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan_${os}_dynamic) + endforeach() + elseif(ANDROID) add_library(clang_rt.asan-arm-android SHARED $<TARGET_OBJECTS:RTAsan.arm.android> |