[compiler-rt] r194813 - [ASan] Add the configure+make rules for building the ASan runtime for iOS simulator.

Alexander Potapenko glider at google.com
Fri Nov 15 05:13:01 PST 2013


Author: glider
Date: Fri Nov 15 07:13:01 2013
New Revision: 194813

URL: http://llvm.org/viewvc/llvm-project?rev=194813&view=rev
Log:
[ASan] Add the configure+make rules for building the ASan runtime for iOS simulator.

Modified:
    compiler-rt/trunk/make/platform/clang_darwin.mk

Modified: compiler-rt/trunk/make/platform/clang_darwin.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin.mk?rev=194813&r1=194812&r2=194813&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_darwin.mk (original)
+++ compiler-rt/trunk/make/platform/clang_darwin.mk Fri Nov 15 07:13:01 2013
@@ -30,7 +30,11 @@ XCRun = \
     result=`xcrun -find $(1) 2> /dev/null`; \
     if [ "$$?" != "0" ]; then result=$(1); fi; \
     echo $$result)
-
+XCRunSdkPath = \
+  $(shell \
+    result=`xcrun --sdk $(1) --show-sdk-path 2> /dev/null`; \
+    if [ "$$?" != "0" ]; then result=""; fi; \
+    echo $$result)
 ###
 
 CC       := $(call XCRun,clang)
@@ -84,6 +88,9 @@ UniversalArchs.profile_ios := $(call Che
 Configs += asan_osx_dynamic
 UniversalArchs.asan_osx_dynamic := $(call CheckArches,i386 x86_64,asan_osx_dynamic)
 
+Configs += asan_iossim_dynamic
+UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64,asan_iossim_dynamic)
+
 Configs += ubsan_osx
 UniversalArchs.ubsan_osx := $(call CheckArches,i386 x86_64,ubsan_osx)
 
@@ -143,6 +150,15 @@ CFLAGS.asan_osx_dynamic := \
 	-DMAC_INTERPOSE_FUNCTIONS=1 \
   -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
 
+IOSSIM_SDK_PATH := $(call XCRunSdkPath,iphonesimulator)
+CFLAGS.asan_iossim_dynamic := \
+	$(CFLAGS) -mios-simulator-version-min=7.0 \
+        -isysroot $(IOSSIM_SDK_PATH) \
+        -fno-builtin \
+	-gline-tables-only \
+	-DMAC_INTERPOSE_FUNCTIONS=1 \
+  -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
+
 CFLAGS.ubsan_osx	:= $(CFLAGS) -mmacosx-version-min=10.6 -fno-builtin
 
 CFLAGS.ios.i386		:= $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
@@ -176,6 +192,14 @@ CFLAGS.profile_ios.armv7s := $(CFLAGS) $
 SHARED_LIBRARY.asan_osx_dynamic := 1
 LDFLAGS.asan_osx_dynamic := -lstdc++ -undefined dynamic_lookup
 
+# Configure the asan_iossim_dynamic library to be built shared.
+SHARED_LIBRARY.asan_iossim_dynamic := 1
+# configure+make uses Clang, so we're using isysroot instead of --sysroot
+# or -Wl,-syslibroot.
+LDFLAGS.asan_iossim_dynamic := -undefined dynamic_lookup \
+  -Wl,-ios_simulator_version_min,7.0.0 \
+  -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK_PATH)
+
 FUNCTIONS.eprintf := eprintf
 FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf
 
@@ -195,6 +219,10 @@ FUNCTIONS.asan_osx_dynamic := $(AsanFunc
                               $(SanitizerCommonFunctions) \
 	                      $(AsanDynamicFunctions)
 
+FUNCTIONS.asan_iossim_dynamic := $(AsanFunctions) $(InterceptionFunctions) \
+                                 $(SanitizerCommonFunctions) \
+	                         $(AsanDynamicFunctions)
+
 FUNCTIONS.ubsan_osx := $(UbsanFunctions) $(UbsanCXXFunctions) \
                        $(SanitizerCommonFunctions)
 





More information about the llvm-commits mailing list