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 /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 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d968beb..2cd09be9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,15 +180,31 @@ endif() check_cxx_compiler_flag(-Wglobal-constructors SUPPORTS_GLOBAL_CONSTRUCTORS_FLAG) # Not all sanitizers forbid global constructors. -# Setup min Mac OS X version. if(APPLE) + # Obtain the iOS Simulator SDK path from xcodebuild. + execute_process( + COMMAND xcodebuild -version -sdk iphonesimulator Path + OUTPUT_VARIABLE IOSSIM_SDK_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + set(SANITIZER_COMMON_SUPPORTED_DARWIN_OS osx) + if (IOSSIM_SDK_DIR) + list(APPEND SANITIZER_COMMON_SUPPORTED_DARWIN_OS iossim) + endif() + if(COMPILER_RT_USES_LIBCXX) set(SANITIZER_MIN_OSX_VERSION 10.7) else() set(SANITIZER_MIN_OSX_VERSION 10.6) endif() - list(APPEND SANITIZER_COMMON_CFLAGS - -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}) + set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}) + set(DARWIN_iossim_CFLAGS + -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR}) + set(DARWIN_osx_LINKFLAGS) + set(DARWIN_iossim_LINKFLAGS + -Wl,-ios_simulator_version_min,7.0.0 + -mios-simulator-version-min=7.0 + -Wl,-syslibroot,${IOSSIM_SDK_DIR}) endif() # Architectures supported by Sanitizer runtimes. Specific sanitizers may |