summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/CMakeLists.txt1
-rw-r--r--compiler-rt/SDKs/darwin/README.txt3
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/errno.h17
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/fcntl.h17
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/inttypes.h86
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/limits.h23
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/stdio.h90
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/stdlib.h32
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/string.h52
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/sys/errno.h31
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/sys/fcntl.h52
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/sys/mman.h42
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/sys/stat.h25
-rw-r--r--compiler-rt/SDKs/darwin/usr/include/sys/types.h20
-rw-r--r--compiler-rt/make/platform/clang_darwin.mk88
15 files changed, 52 insertions, 527 deletions
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 76e1cbb7a19..b7c85a7da42 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -160,7 +160,6 @@ include(CompilerRTUtils)
set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(COMPILER_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
# Setup custom SDK sysroots.
-set(COMPILER_RT_DARWIN_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/darwin)
set(COMPILER_RT_LINUX_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/linux)
set(COMPILER_RT_EXTRA_ANDROID_HEADERS ${COMPILER_RT_SOURCE_DIR}/android/include)
diff --git a/compiler-rt/SDKs/darwin/README.txt b/compiler-rt/SDKs/darwin/README.txt
deleted file mode 100644
index ea30af358b2..00000000000
--- a/compiler-rt/SDKs/darwin/README.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-The Darwin platforms are all similar enough we roll them into one SDK, and use
-preprocessor tricks to get the right definitions for the few things which
-diverge between OS X and iOS.
diff --git a/compiler-rt/SDKs/darwin/usr/include/errno.h b/compiler-rt/SDKs/darwin/usr/include/errno.h
deleted file mode 100644
index f06e5371339..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/errno.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* ===-- errno.h - stub SDK header for compiler-rt --------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#include <sys/errno.h>
diff --git a/compiler-rt/SDKs/darwin/usr/include/fcntl.h b/compiler-rt/SDKs/darwin/usr/include/fcntl.h
deleted file mode 100644
index a5f91e3a5bc..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/fcntl.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* ===-- fcntl.h - stub SDK header for compiler-rt --------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#include <sys/fcntl.h>
diff --git a/compiler-rt/SDKs/darwin/usr/include/inttypes.h b/compiler-rt/SDKs/darwin/usr/include/inttypes.h
deleted file mode 100644
index 406fa6fada4..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/inttypes.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ===-- inttypes.h - stub SDK header for compiler-rt -----------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __INTTYPES_H__
-#define __INTTYPES_H__
-
-#if __WORDSIZE == 64
-#define __INTTYPE_PRI64__ "l"
-#else
-#define __INTTYPE_PRI64__ "ll"
-#endif
-
-#define PRId8 "hhd"
-#define PRId16 "hd"
-#define PRId32 "d"
-#define PRId64 __INTTYPE_PRI64__ "d"
-
-#define PRIi8 "hhi"
-#define PRIi16 "hi"
-#define PRIi32 "i"
-#define PRIi64 __INTTYPE_PRI64__ "i"
-
-#define PRIo8 "hho"
-#define PRIo16 "ho"
-#define PRIo32 "o"
-#define PRIo64 __INTTYPE_PRI64__ "o"
-
-#define PRIu8 "hhu"
-#define PRIu16 "hu"
-#define PRIu32 "u"
-#define PRIu64 __INTTYPE_PRI64__ "u"
-
-#define PRIx8 "hhx"
-#define PRIx16 "hx"
-#define PRIx32 "x"
-#define PRIx64 __INTTYPE_PRI64__ "x"
-
-#define PRIX8 "hhX"
-#define PRIX16 "hX"
-#define PRIX32 "X"
-#define PRIX64 __INTTYPE_PRI64__ "X"
-
-#define SCNd8 "hhd"
-#define SCNd16 "hd"
-#define SCNd32 "d"
-#define SCNd64 __INTTYPE_PRI64__ "d"
-
-#define SCNi8 "hhi"
-#define SCNi16 "hi"
-#define SCNi32 "i"
-#define SCNi64 __INTTYPE_PRI64__ "i"
-
-#define SCNo8 "hho"
-#define SCNo16 "ho"
-#define SCNo32 "o"
-#define SCNo64 __INTTYPE_PRI64__ "o"
-
-#define SCNu8 "hhu"
-#define SCNu16 "hu"
-#define SCNu32 "u"
-#define SCNu64 __INTTYPE_PRI64__ "u"
-
-#define SCNx8 "hhx"
-#define SCNx16 "hx"
-#define SCNx32 "x"
-#define SCNx64 __INTTYPE_PRI64__ "x"
-
-#define SCNX8 "hhX"
-#define SCNX16 "hX"
-#define SCNX32 "X"
-#define SCNX64 __INTTYPE_PRI64__ "X"
-
-#endif /* __INTTYPES_H__ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/limits.h b/compiler-rt/SDKs/darwin/usr/include/limits.h
deleted file mode 100644
index 5495a784f12..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/limits.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* ===-- limits.h - stub SDK header for compiler-rt -------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __LIMITS_H__
-#define __LIMITS_H__
-
-/* This is only here as a landing pad for the include_next from the compiler's
- built-in limits.h. */
-
-#endif /* __LIMITS_H__ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/stdio.h b/compiler-rt/SDKs/darwin/usr/include/stdio.h
deleted file mode 100644
index 1a8781f2074..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/stdio.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* ===-- stdio.h - stub SDK header for compiler-rt --------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __STDIO_H__
-#define __STDIO_H__
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-typedef struct __sFILE FILE;
-typedef __SIZE_TYPE__ size_t;
-
-/* Determine the appropriate fdopen, fopen(), and fwrite() functions. */
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-# if defined(__i386)
-# define __FDOPEN_NAME "_fdopen$UNIX2003"
-# define __FOPEN_NAME "_fopen$UNIX2003"
-# define __FWRITE_NAME "_fwrite$UNIX2003"
-# elif defined(__x86_64__)
-# define __FDOPEN_NAME "_fdopen"
-# define __FOPEN_NAME "_fopen"
-# define __FWRITE_NAME "_fwrite"
-# elif defined(__arm) || defined(__arm64)
-# define __FDOPEN_NAME "_fdopen"
-# define __FOPEN_NAME "_fopen"
-# define __FWRITE_NAME "_fwrite"
-# else
-# error "unrecognized architecture for targeting OS X"
-# endif
-#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
-# if defined(__i386) || defined (__x86_64)
-# define __FDOPEN_NAME "_fdopen"
-# define __FOPEN_NAME "_fopen"
-# define __FWRITE_NAME "_fwrite"
-# elif defined(__arm) || defined(__arm64)
-# define __FDOPEN_NAME "_fdopen"
-# define __FOPEN_NAME "_fopen"
-# define __FWRITE_NAME "_fwrite"
-# else
-# error "unrecognized architecture for targeting iOS"
-# endif
-#else
-# error "unrecognized architecture for targeting Darwin"
-#endif
-
-# define stderr __stderrp
-extern FILE *__stderrp;
-
-#ifndef SEEK_SET
-#define SEEK_SET 0 /* set file offset to offset */
-#endif
-#ifndef SEEK_CUR
-#define SEEK_CUR 1 /* set file offset to current plus offset */
-#endif
-#ifndef SEEK_END
-#define SEEK_END 2 /* set file offset to EOF plus offset */
-#endif
-
-int fclose(FILE *);
-int fflush(FILE *);
-FILE *fopen(const char * __restrict, const char * __restrict) __asm(__FOPEN_NAME);
-FILE *fdopen(int, const char *) __asm(__FDOPEN_NAME);
-int fprintf(FILE * __restrict, const char * __restrict, ...);
-int fputc(int, FILE *);
-size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict)
- __asm(__FWRITE_NAME);
-size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
-long ftell(FILE *);
-int fseek(FILE *, long, int);
-int snprintf(char * __restrict, size_t, const char * __restrict, ...);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __STDIO_H__ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/stdlib.h b/compiler-rt/SDKs/darwin/usr/include/stdlib.h
deleted file mode 100644
index b6d3171cff4..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/stdlib.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* ===-- stdlib.h - stub SDK header for compiler-rt -------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __STDLIB_H__
-#define __STDLIB_H__
-
-#define NULL ((void *)0)
-
-typedef __SIZE_TYPE__ size_t;
-
-void abort(void) __attribute__((__noreturn__));
-int atexit(void (*)(void));
-int atoi(const char *);
-void free(void *);
-char *getenv(const char *);
-void *malloc(size_t);
-void *realloc(void *, size_t);
-
-#endif /* __STDLIB_H__ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/string.h b/compiler-rt/SDKs/darwin/usr/include/string.h
deleted file mode 100644
index 048fdba8f6d..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/string.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ===-- string.h - stub SDK header for compiler-rt -------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __STRING_H__
-#define __STRING_H__
-
-typedef __SIZE_TYPE__ size_t;
-
-int memcmp(const void *, const void *, size_t);
-void *memcpy(void *, const void *, size_t);
-void *memset(void *, int, size_t);
-char *strcat(char *, const char *);
-char *strcpy(char *, const char *);
-char *strdup(const char *);
-size_t strlen(const char *);
-char *strncpy(char *, const char *, size_t);
-
-/* Determine the appropriate strerror() function. */
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-# if defined(__i386)
-# define __STRERROR_NAME "_strerror$UNIX2003"
-# elif defined(__x86_64__) || defined(__arm) || defined(__arm64)
-# define __STRERROR_NAME "_strerror"
-# else
-# error "unrecognized architecture for targeting OS X"
-# endif
-#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
-# if defined(__i386) || defined (__x86_64) || defined(__arm) || defined(__arm64)
-# define __STRERROR_NAME "_strerror"
-# else
-# error "unrecognized architecture for targeting iOS"
-# endif
-#else
-# error "unrecognized architecture for targeting Darwin"
-#endif
-
-char *strerror(int) __asm(__STRERROR_NAME);
-
-#endif /* __STRING_H__ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/sys/errno.h b/compiler-rt/SDKs/darwin/usr/include/sys/errno.h
deleted file mode 100644
index 4befe385535..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/sys/errno.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ===-- errno.h - stub SDK header for compiler-rt --------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef _SYS_ERRNO_H_
-#define _SYS_ERRNO_H_
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-extern int *__error(void);
-#define errno (*__error())
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
diff --git a/compiler-rt/SDKs/darwin/usr/include/sys/fcntl.h b/compiler-rt/SDKs/darwin/usr/include/sys/fcntl.h
deleted file mode 100644
index 96b24384aa6..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/sys/fcntl.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ===-- fcntl.h - stub SDK header for compiler-rt --------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef _SYS_FCNTL_H_
-#define _SYS_FCNTL_H_
-
-/* Determine the appropriate open function. */
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-# if defined(__i386)
-# define __OPEN_NAME "_open$UNIX2003"
-# elif defined(__x86_64__)
-# define __OPEN_NAME "_open"
-# elif defined(__arm) || defined(__arm64)
-# define __OPEN_NAME "_open"
-# else
-# error "unrecognized architecture for targeting OS X"
-# endif
-#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
-# if defined(__i386) || defined (__x86_64)
-# define __OPEN_NAME "_open"
-# elif defined(__arm) || defined(__arm64)
-# define __OPEN_NAME "_open"
-# else
-# error "unrecognized architecture for targeting iOS"
-# endif
-#else
-# error "unrecognized architecture for targeting Darwin"
-#endif
-
-#define O_RDONLY 0x0000 /* open for reading only */
-#define O_WRONLY 0x0001 /* open for writing only */
-#define O_RDWR 0x0002 /* open for reading and writing */
-#define O_ACCMODE 0x0003 /* mask for above modes */
-
-#define O_CREAT 0x0200 /* create if nonexistent */
-
-int open(const char *, int, ...) __asm(__OPEN_NAME);
-
-#endif /* !_SYS_FCNTL_H_ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/sys/mman.h b/compiler-rt/SDKs/darwin/usr/include/sys/mman.h
deleted file mode 100644
index 84561f1b6ab..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/sys/mman.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ===-- mman.h - stub SDK header for compiler-rt ---------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __SYS_MMAN_H__
-#define __SYS_MMAN_H__
-
-typedef __SIZE_TYPE__ size_t;
-
-#define PROT_NONE 0x00
-#define PROT_READ 0x01
-#define PROT_WRITE 0x02
-#define PROT_EXEC 0x04
-
-#define MAP_SHARED 0x0001
-#define MAP_PRIVATE 0x0002
-
-#define MAP_FILE 0x0000
-#define MAP_ANON 0x1000
-
-#define MS_ASYNC 0x0001
-#define MS_INVALIDATE 0x0002
-#define MS_SYNC 0x0010
-
-void *mmap(void *addr, size_t len, int prot, int flags, int fd,
- long long offset);
-int munmap(void *addr, size_t len);
-int msync(void *addr, size_t len, int flags);
-
-#endif /* __SYS_MMAN_H__ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/sys/stat.h b/compiler-rt/SDKs/darwin/usr/include/sys/stat.h
deleted file mode 100644
index 6225f908168..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/sys/stat.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* ===-- stat.h - stub SDK header for compiler-rt ---------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __SYS_STAT_H__
-#define __SYS_STAT_H__
-
-typedef unsigned short uint16_t;
-typedef uint16_t mode_t;
-
-int mkdir(const char *, mode_t);
-
-#endif /* __SYS_STAT_H__ */
diff --git a/compiler-rt/SDKs/darwin/usr/include/sys/types.h b/compiler-rt/SDKs/darwin/usr/include/sys/types.h
deleted file mode 100644
index b425767b831..00000000000
--- a/compiler-rt/SDKs/darwin/usr/include/sys/types.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* ===-- types.h - stub SDK header for compiler-rt --------------------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
- *
- * ===-----------------------------------------------------------------------===
- *
- * This is a stub SDK header file. This file is not part of the interface of
- * this library nor an official version of the appropriate SDK header. It is
- * intended only to stub the features of this header required by compiler-rt.
- *
- * ===-----------------------------------------------------------------------===
- */
-
-#ifndef __SYS_TYPES_H__
-#define __SYS_TYPES_H__
-
-#endif /* __SYS_TYPES_H__ */
diff --git a/compiler-rt/make/platform/clang_darwin.mk b/compiler-rt/make/platform/clang_darwin.mk
index ad79f77bfb4..7b73dc54ae6 100644
--- a/compiler-rt/make/platform/clang_darwin.mk
+++ b/compiler-rt/make/platform/clang_darwin.mk
@@ -6,16 +6,21 @@
Description := Static runtime libraries for clang/Darwin.
-# A function that ensures we don't try to build for architectures that we
-# don't have working toolchains for.
+# A function that ensures we don't try to build for architectures and SDKs
+# that we don't have working toolchains for. Arguments:
+# (1): List of architectures
+# (2): Library name
+# (3): SDK path
+# The result is a possibly empty subset of the architectures from argument 1.
CheckArches = \
$(shell \
result=""; \
- for arch in $(1); do \
+ if [ "X$(3)" != X ]; then \
+ for arch in $(1); do \
if $(CC) -arch $$arch -c \
-integrated-as \
$(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \
- -isysroot $(ProjSrcRoot)/SDKs/darwin \
+ -isysroot $(3) \
-o /dev/null > /dev/null 2> /dev/null; then \
if $(LD) -v 2>&1 | grep "configured to support" \
| tr ' ' '\n' | grep "^$$arch$$" >/dev/null 2>/dev/null; then \
@@ -30,7 +35,8 @@ CheckArches = \
"warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \
printf 1>&2 " (clang does not support it)\n"; \
fi; \
- done; \
+ done; \
+ fi; \
echo $$result)
XCRun = \
@@ -53,6 +59,10 @@ STRIP := $(call XCRun,strip)
LIPO := $(call XCRun,lipo)
DSYMUTIL := $(call XCRun,dsymutil)
+OSX_SDK := $(call XCRunSdkPath,macosx)
+IOS_SDK := $(call XCRunSdkPath,iphoneos)
+IOSSIM_SDK := $(call XCRunSdkPath,iphonesimulator)
+
Configs :=
UniversalArchs :=
@@ -60,51 +70,53 @@ UniversalArchs :=
# still be referenced from Darwin system headers. This symbol is only ever
# needed on i386.
Configs += eprintf
-UniversalArchs.eprintf := $(call CheckArches,i386,eprintf)
+UniversalArchs.eprintf := $(call CheckArches,i386,eprintf,$(OSX_SDK))
# Configuration for targeting 10.4. We need a few functions missing from
# libgcc_s.10.4.dylib. We only build x86 slices since clang doesn't really
# support targeting PowerPC.
Configs += 10.4
-UniversalArchs.10.4 := $(call CheckArches,i386 x86_64,10.4)
+UniversalArchs.10.4 := $(call CheckArches,i386 x86_64,10.4,$(OSX_SDK))
# Configuration for targeting iOS for a couple of functions that didn't
# make it into libSystem.
Configs += ios
-UniversalArchs.ios := $(call CheckArches,i386 x86_64 armv7 arm64,ios)
+UniversalArchs.ios := $(call CheckArches,i386 x86_64,ios,$(IOSSIM_SDK))
+UniversalArchs.ios += $(call CheckArches,armv7 arm64,ios,$(IOS_SDK))
# Configuration for targeting OSX. These functions may not be in libSystem
# so we should provide our own.
Configs += osx
-UniversalArchs.osx := $(call CheckArches,i386 x86_64 x86_64h,osx)
+UniversalArchs.osx := $(call CheckArches,i386 x86_64 x86_64h,osx,$(OSX_SDK))
# Configuration for use with kernel/kexts.
Configs += cc_kext
-UniversalArchs.cc_kext := $(call CheckArches,armv7 arm64 i386 x86_64 x86_64h,cc_kext)
+UniversalArchs.cc_kext := $(call CheckArches,i386 x86_64 x86_64h,cc_kext,$(OSX_SDK))
+UniversalArchs.cc_kext += $(call CheckArches,armv7 arm64,cc_kext,$(IOS_SDK))
# Configuration for use with kernel/kexts for iOS 5.0 and earlier (which used
-# a different code generation strategy).
+# a different code generation strategy). Note: the x86_64 slice is unused but
+# it avoids build problems (see pr14013).
Configs += cc_kext_ios5
-UniversalArchs.cc_kext_ios5 := $(call CheckArches,x86_64 armv7,cc_kext_ios5)
+UniversalArchs.cc_kext_ios5 := $(call CheckArches,x86_64,cc_kext_ios5,$(IOSSIM_SDK))
+UniversalArchs.cc_kext_ios5 += $(call CheckArches,armv7,cc_kext_ios5,$(IOS_SDK))
# Configurations which define the profiling support functions.
Configs += profile_osx
-UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64 x86_64h,profile_osx)
+UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64 x86_64h,profile_osx,$(OSX_SDK))
Configs += profile_ios
-UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 armv7 arm64,profile_ios)
+UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64,profile_ios,$(IOSSIM_SDK))
+UniversalArchs.profile_ios += $(call CheckArches,armv7 arm64,profile_ios,$(IOS_SDK))
# Configurations which define the ASAN support functions.
Configs += asan_osx_dynamic
-UniversalArchs.asan_osx_dynamic := $(call CheckArches,i386 x86_64 x86_64h,asan_osx_dynamic)
+UniversalArchs.asan_osx_dynamic := $(call CheckArches,i386 x86_64 x86_64h,asan_osx_dynamic,$(OSX_SDK))
-IOSSIM_SDK_PATH := $(call XCRunSdkPath,iphonesimulator)
-ifneq ($(IOSSIM_SDK_PATH),)
Configs += asan_iossim_dynamic
-UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64,asan_iossim_dynamic)
-endif
+UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64,asan_iossim_dynamic,$(IOSSIM_SDK))
Configs += ubsan_osx
-UniversalArchs.ubsan_osx := $(call CheckArches,i386 x86_64 x86_64h,ubsan_osx)
+UniversalArchs.ubsan_osx := $(call CheckArches,i386 x86_64 x86_64h,ubsan_osx,$(OSX_SDK))
# Darwin 10.6 has a bug in cctools that makes it unable to use ranlib on our ARM
# object files. If we are on that platform, strip out all ARM archs. We still
@@ -119,17 +131,18 @@ endif
# If RC_SUPPORTED_ARCHS is defined, treat it as a list of the architectures we
# are intended to support and limit what we try to build to that.
-#
-# We make sure to remove empty configs if we end up dropping all the requested
-# archs for a particular config.
ifneq ($(RC_SUPPORTED_ARCHS),)
$(foreach config,$(Configs),\
$(call Set,UniversalArchs.$(config),\
- $(filter $(RC_SUPPORTED_ARCHS),$(UniversalArchs.$(config))))\
- $(if $(UniversalArchs.$(config)),,\
- $(call Set,Configs,$(filter-out $(config),$(Configs)))))
+ $(filter $(RC_SUPPORTED_ARCHS),$(UniversalArchs.$(config))))
endif
+# Remove empty configs if we end up dropping all the requested
+# archs for a particular config.
+$(foreach config,$(Configs),\
+ $(if $(strip $(UniversalArchs.$(config))),,\
+ $(call Set,Configs,$(filter-out $(config),$(Configs)))))
+
###
# Forcibly strip off any -arch, as that totally breaks our universal support.
@@ -147,28 +160,31 @@ IOS_DEPLOYMENT_ARGS := -mios-version-min=1.0
IOS6_DEPLOYMENT_ARGS := -mios-version-min=6.0
IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=1.0
-# Use our stub SDK as the sysroot to support more portable building.
-OSX_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin
-IOS_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin
-IOS6_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin
-IOSSIM_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin
+OSX_DEPLOYMENT_ARGS += -isysroot $(OSX_SDK)
+IOS_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK)
+IOS6_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK)
+IOSSIM_DEPLOYMENT_ARGS += -isysroot $(IOSSIM_SDK)
CFLAGS.eprintf := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
CFLAGS.10.4 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
-# FIXME: We can't build ASAN with our stub SDK yet.
+
CFLAGS.asan_osx_dynamic := \
- $(CFLAGS) -mmacosx-version-min=10.7 -fno-builtin \
+ $(CFLAGS) -mmacosx-version-min=10.7 \
+ -isysroot $(OSX_SDK) \
+ -fno-builtin \
-gline-tables-only \
-DMAC_INTERPOSE_FUNCTIONS=1
CFLAGS.asan_iossim_dynamic := \
$(CFLAGS) -mios-simulator-version-min=7.0 \
- -isysroot $(IOSSIM_SDK_PATH) \
+ -isysroot $(IOSSIM_SDK) \
-fno-builtin \
-gline-tables-only \
-DMAC_INTERPOSE_FUNCTIONS=1
-CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.6 -fno-builtin
+CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.6 \
+ -isysroot $(OSX_SDK) \
+ -fno-builtin
CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
@@ -209,7 +225,7 @@ SHARED_LIBRARY.asan_iossim_dynamic := 1
# or -Wl,-syslibroot.
LDFLAGS.asan_iossim_dynamic := -undefined dynamic_lookup -install_name @rpath/libclang_rt.asan_iossim_dynamic.dylib \
-Wl,-ios_simulator_version_min,7.0.0 \
- -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK_PATH)
+ -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK)
FUNCTIONS.eprintf := eprintf
FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf
OpenPOWER on IntegriCloud