platform/clang_linux: Switch builtin and profile libraries to build using the
stub SDK.
 - This allows us to build both the m32 and m64 variants without worrying about
   whether or not the user has the headers for the alternate arch installed.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@146132 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/make/platform/clang_linux.mk b/make/platform/clang_linux.mk
index 92763a5..b3a7759 100644
--- a/make/platform/clang_linux.mk
+++ b/make/platform/clang_linux.mk
@@ -24,22 +24,16 @@
 ifneq ($(findstring -linux-,$(CompilerTargetTriple)),)
 
 # Configurations which just include all the runtime functions.
-ifeq ($(CompilerTargetArch),i386)
-Configs += full-i386
+ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true)
+Configs += full-i386 full-x86_64
 Arch.full-i386 := i386
-endif
-ifeq ($(CompilerTargetArch),x86_64)
-Configs += full-x86_64
 Arch.full-x86_64 := x86_64
 endif
 
 # Configuration for profile runtime.
-ifeq ($(CompilerTargetArch),i386)
-Configs += profile-i386
+ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true)
+Configs += profile-i386 profile-x86_64
 Arch.profile-i386 := i386
-endif
-ifeq ($(CompilerTargetArch),x86_64)
-Configs += profile-x86_64
 Arch.profile-x86_64 := x86_64
 endif
 
@@ -66,6 +60,14 @@
 CFLAGS.asan-i386 := $(CFLAGS) -m32
 CFLAGS.asan-x86_64 := $(CFLAGS) -m64
 
+# Use our stub SDK as the sysroot to support more portable building. For now we
+# just do this for the non-ASAN modules, because the stub SDK doesn't have
+# enough support to build ASAN.
+CFLAGS.full-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux
+CFLAGS.full-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux
+CFLAGS.profile-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux
+CFLAGS.profile-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux
+
 FUNCTIONS.full-i386 := $(CommonFunctions) $(ArchFunctions.i386)
 FUNCTIONS.full-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64)
 FUNCTIONS.profile-i386 := GCDAProfiling