[PATCH] Working on reconciling out-of-tree patches to compiler-rt for building for iOS.
Chris Bieneman
beanz at apple.com
Wed Jun 17 13:18:29 PDT 2015
This is one of many changes needed for compiler-rt to get it building on iOS.
This change ifdefs out headers and functionality that aren't available on iOS, and adds support for iOS and the iOS simulator to as an.
Note: this change does not enable building for iOS, as there are more changes to come.
http://reviews.llvm.org/D10515
Files:
lib/asan/asan_mac.cc
lib/asan/asan_mapping.h
Index: lib/asan/asan_mac.cc
===================================================================
--- lib/asan/asan_mac.cc
+++ lib/asan/asan_mac.cc
@@ -24,7 +24,15 @@
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_mac.h"
-#include <crt_externs.h> // for _NSGetArgv
+#if !TARGET_OS_IPHONE
+#include <crt_externs.h> // for _NSGetArgv and _NSGetEnviron
+#else
+extern char **environ;
+extern "C" {
+ extern char ***_NSGetArgv(void);
+}
+#endif
+
#include <dlfcn.h> // for dladdr()
#include <mach-o/dyld.h>
#include <mach-o/loader.h>
@@ -62,9 +70,11 @@
// otherwise the corresponding "NAME=value" string is replaced with
// |name_value|.
void LeakyResetEnv(const char *name, const char *name_value) {
+#if !TARGET_OS_IPHONE
char ***env_ptr = _NSGetEnviron();
CHECK(env_ptr);
char **environ = *env_ptr;
+#endif
CHECK(environ);
uptr name_len = internal_strlen(name);
while (*environ != 0) {
Index: lib/asan/asan_mapping.h
===================================================================
--- lib/asan/asan_mapping.h
+++ lib/asan/asan_mapping.h
@@ -100,6 +100,9 @@
static const u64 kDefaultShadowOffset32 = 1ULL << 29; // 0x20000000
static const u64 kIosShadowOffset32 = 1ULL << 30; // 0x40000000
static const u64 kDefaultShadowOffset64 = 1ULL << 44;
+static const u64 kIosShadowOffset64 = 0x130000000;
+static const u64 kIosSimShadowOffset32 = 1ULL << 30;
+static const u64 kIosSimShadowOffset64 = kDefaultShadowOffset64;
static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G.
static const u64 kAArch64_ShadowOffset64 = 1ULL << 36;
static const u64 kMIPS32_ShadowOffset32 = 0x0aaa0000;
@@ -112,6 +115,20 @@
#define SHADOW_SCALE kDefaultShadowScale
#if SANITIZER_ANDROID
# define SHADOW_OFFSET (0)
+#elif SANITIZER_IOS
+# if SANITIZER_WORDSIZE == 32
+# if SANITIZER_IOSSIM
+# define SHADOW_OFFSET kIosSimShadowOffset32
+# else
+# define SHADOW_OFFSET kIosShadowOffset32
+# endif
+# else
+# if SANITIZER_IOSSIM
+# define SHADOW_OFFSET kIosSimShadowOffset64
+# else
+# define SHADOW_OFFSET kIosShadowOffset64
+# endif
+# endif
#else
# if SANITIZER_WORDSIZE == 32
# if defined(__mips__)
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10515.27864.patch
Type: text/x-patch
Size: 2204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150617/34bda3d0/attachment.bin>
More information about the llvm-commits
mailing list