summaryrefslogtreecommitdiffstats
path: root/lib/asan/asan_mac.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asan/asan_mac.h')
-rw-r--r--lib/asan/asan_mac.h92
1 files changed, 29 insertions, 63 deletions
diff --git a/lib/asan/asan_mac.h b/lib/asan/asan_mac.h
index 32739e7..6c65765 100644
--- a/lib/asan/asan_mac.h
+++ b/lib/asan/asan_mac.h
@@ -9,79 +9,45 @@
//
// This file is a part of AddressSanitizer, an address sanity checker.
//
-// ASan-private header for asan_mac.cc
+// Mac-specific ASan definitions.
//===----------------------------------------------------------------------===//
-#ifdef __APPLE__
-
#ifndef ASAN_MAC_H
#define ASAN_MAC_H
-#include "asan_interceptors.h"
-
-// TODO(glider): need to check if the OS X version is 10.6 or greater.
-#include <dispatch/dispatch.h>
-#include <setjmp.h>
+// CF_RC_BITS, the layout of CFRuntimeBase and __CFStrIsConstant are internal
+// and subject to change in further CoreFoundation versions. Apple does not
+// guarantee any binary compatibility from release to release.
-typedef void* pthread_workqueue_t;
-typedef void* pthread_workitem_handle_t;
+// See http://opensource.apple.com/source/CF/CF-635.15/CFInternal.h
+#if defined(__BIG_ENDIAN__)
+#define CF_RC_BITS 0
+#endif
-typedef void (*dispatch_function_t)(void *block);
-typedef void* (*worker_t)(void *block);
-typedef int (*dispatch_async_f_f)(dispatch_queue_t dq, void *ctxt,
- dispatch_function_t func);
-typedef int (*dispatch_sync_f_f)(dispatch_queue_t dq, void *ctxt,
- dispatch_function_t func);
-typedef int (*dispatch_after_f_f)(dispatch_time_t when,
- dispatch_queue_t dq, void *ctxt,
- dispatch_function_t func);
-typedef void (*dispatch_barrier_async_f_f)(dispatch_queue_t dq,
- void *ctxt,
- dispatch_function_t func);
-typedef void (*dispatch_group_async_f_f)(dispatch_group_t group,
- dispatch_queue_t dq,
- void *ctxt, dispatch_function_t func);
-typedef int (*pthread_workqueue_additem_np_f)(pthread_workqueue_t workq,
- void *(*workitem_func)(void *), void * workitem_arg,
- pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
+#if defined(__LITTLE_ENDIAN__)
+#define CF_RC_BITS 3
+#endif
+// See http://opensource.apple.com/source/CF/CF-635.15/CFRuntime.h
+typedef struct __CFRuntimeBase {
+ uptr _cfisa;
+ u8 _cfinfo[4];
+#if __LP64__
+ u32 _rc;
+#endif
+} CFRuntimeBase;
-// A wrapper for the ObjC blocks used to support libdispatch.
-typedef struct {
- void *block;
- dispatch_function_t func;
- int parent_tid;
-} asan_block_context_t;
+enum {
+ MACOS_VERSION_UNKNOWN = 0,
+ MACOS_VERSION_LEOPARD,
+ MACOS_VERSION_SNOW_LEOPARD,
+ MACOS_VERSION_LION
+};
+namespace __asan {
-extern "C" {
-// dispatch_barrier_async_f() is not declared in <dispatch/dispatch.h>.
-void dispatch_barrier_async_f(dispatch_queue_t dq,
- void *ctxt, dispatch_function_t func);
-// Neither is pthread_workqueue_additem_np().
-int pthread_workqueue_additem_np(pthread_workqueue_t workq,
- void *(*workitem_func)(void *), void * workitem_arg,
- pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
+int GetMacosVersion();
+void ReplaceCFAllocator();
-int WRAP(dispatch_async_f)(dispatch_queue_t dq,
- void *ctxt,
- dispatch_function_t func);
-int WRAP(dispatch_sync_f)(dispatch_queue_t dq,
- void *ctxt,
- dispatch_function_t func);
-int WRAP(dispatch_after_f)(dispatch_time_t when,
- dispatch_queue_t dq,
- void *ctxt,
- dispatch_function_t func);
-void WRAP(dispatch_barrier_async_f)(dispatch_queue_t dq,
- void *ctxt, dispatch_function_t func);
-void WRAP(dispatch_group_async_f)(dispatch_group_t group,
- dispatch_queue_t dq,
- void *ctxt, dispatch_function_t func);
-int WRAP(pthread_workqueue_additem_np)(pthread_workqueue_t workq,
- void *(*workitem_func)(void *), void * workitem_arg,
- pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
-}
+} // namespace __asan
#endif // ASAN_MAC_H
-
-#endif // __APPLE__
OpenPOWER on IntegriCloud