r194168 - [build] Update runtime library and tests to work with relocatable SDKs on OS X 10.9.

Daniel Dunbar daniel at zuster.org
Wed Nov 6 13:44:54 PST 2013


Author: ddunbar
Date: Wed Nov  6 15:44:54 2013
New Revision: 194168

URL: http://llvm.org/viewvc/llvm-project?rev=194168&view=rev
Log:
[build] Update runtime library and tests to work with relocatable SDKs on OS X 10.9.

Modified:
    cfe/trunk/runtime/compiler-rt/Makefile
    cfe/trunk/test/lit.cfg

Modified: cfe/trunk/runtime/compiler-rt/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/compiler-rt/Makefile?rev=194168&r1=194167&r2=194168&view=diff
==============================================================================
--- cfe/trunk/runtime/compiler-rt/Makefile (original)
+++ cfe/trunk/runtime/compiler-rt/Makefile Wed Nov  6 15:44:54 2013
@@ -27,6 +27,10 @@ ResourceIncludeDir := $(ResourceDir)/inc
 PROJ_resources_lib := $(PROJ_resources)/lib
 PROJ_resources_include := $(PROJ_resources)/include
 
+# Initialize a variable to use for extra flags to pass to the
+# compiler-rt make process.
+COMPILERRT_MAKE_FLAGS :=
+
 # Expect compiler-rt to be in llvm/projects/compiler-rt
 COMPILERRT_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/compiler-rt
 
@@ -80,6 +84,17 @@ RuntimeLibrary.darwin.Configs := \
 	asan_osx_dynamic.dylib \
 	profile_osx.a profile_ios.a \
 	ubsan_osx.a
+
+# Support building compiler-rt with relocatable SDKs.
+#
+# This will cause make to put SDKROOT in the environment, and since we
+# are using the built Clang to build compiler-rt, it to pick up that
+# location as the default value for the include system root.
+ACTIVE_SDK_PATH := $(shell xcrun --show-sdk-path 2> /dev/null)
+ifneq ($(ACTIVE_SDK_PATH),)
+COMPILERRT_MAKE_FLAGS := SDKROOT=$(ACTIVE_SDK_PATH)
+endif
+
 endif
 
 # On Linux, include a library which has all the runtime functions.
@@ -144,12 +159,14 @@ BuildRuntimeLibraries:
 	  ProjObjRoot=$(PROJ_OBJ_DIR) \
 	  CC="$(ToolDir)/clang" \
 	  LLVM_ANDROID_TOOLCHAIN_DIR="$(LLVM_ANDROID_TOOLCHAIN_DIR)" \
+	  $(COMPILERRT_MAKE_FLAGS) \
 	  $(RuntimeDirs:%=clang_%)
 .PHONY: BuildRuntimeLibraries
 CleanRuntimeLibraries:
 	$(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \
 	  ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \
 	  ProjObjRoot=$(PROJ_OBJ_DIR) \
+	  $(COMPILERRT_MAKE_FLAGS) \
 	  clean
 .PHONY: CleanRuntimeLibraries
 RuntimeHeader: $(ResourceIncludeDir)/sanitizer

Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=194168&r1=194167&r2=194168&view=diff
==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Wed Nov  6 15:44:54 2013
@@ -353,6 +353,18 @@ else:
 # Will default to '/usr/lib/libgmalloc.dylib' if not set.
 gmalloc_path_str = lit_config.params.get('gmalloc_path',
                                          '/usr/lib/libgmalloc.dylib')
-
 if use_gmalloc:
      config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str})
+
+# On Darwin, support relocatable SDKs by providing Clang with a
+# default system root path.
+if 'darwin' in config.target_triple:
+    cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],
+                           stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    out, err = cmd.communicate()
+    out = out.strip()
+    res = cmd.wait()
+    if res == 0 and out:
+        sdk_path = out
+        lit_config.note('using SDKROOT: %r' % sdk_path)
+        config.environment['SDKROOT'] = sdk_path





More information about the cfe-commits mailing list