Alexander Potapenko | d079db6 | 2012-07-06 11:58:54 +0000 | [diff] [blame] | 1 | //===-- asan_mac.h ----------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file is a part of AddressSanitizer, an address sanity checker. |
| 11 | // |
| 12 | // Mac-specific ASan definitions. |
| 13 | //===----------------------------------------------------------------------===// |
Evgeniy Stepanov | 24e1372 | 2013-03-19 14:33:38 +0000 | [diff] [blame] | 14 | #ifndef ASAN_MAC_H |
Richard Trieu | f9262ae | 2013-06-12 22:37:22 +0000 | [diff] [blame] | 15 | #define ASAN_MAC_H |
Alexander Potapenko | d079db6 | 2012-07-06 11:58:54 +0000 | [diff] [blame] | 16 | |
Alexander Potapenko | bf9f6fb | 2012-07-06 13:04:12 +0000 | [diff] [blame] | 17 | // CF_RC_BITS, the layout of CFRuntimeBase and __CFStrIsConstant are internal |
| 18 | // and subject to change in further CoreFoundation versions. Apple does not |
| 19 | // guarantee any binary compatibility from release to release. |
| 20 | |
| 21 | // See http://opensource.apple.com/source/CF/CF-635.15/CFInternal.h |
| 22 | #if defined(__BIG_ENDIAN__) |
| 23 | #define CF_RC_BITS 0 |
| 24 | #endif |
| 25 | |
| 26 | #if defined(__LITTLE_ENDIAN__) |
| 27 | #define CF_RC_BITS 3 |
| 28 | #endif |
| 29 | |
| 30 | // See http://opensource.apple.com/source/CF/CF-635.15/CFRuntime.h |
| 31 | typedef struct __CFRuntimeBase { |
| 32 | uptr _cfisa; |
| 33 | u8 _cfinfo[4]; |
| 34 | #if __LP64__ |
| 35 | u32 _rc; |
| 36 | #endif |
| 37 | } CFRuntimeBase; |
| 38 | |
Alexander Potapenko | 31f78fd | 2013-07-16 09:29:48 +0000 | [diff] [blame] | 39 | enum MacosVersion { |
| 40 | MACOS_VERSION_UNINITIALIZED = 0, |
| 41 | MACOS_VERSION_UNKNOWN, |
Alexander Potapenko | d079db6 | 2012-07-06 11:58:54 +0000 | [diff] [blame] | 42 | MACOS_VERSION_LEOPARD, |
| 43 | MACOS_VERSION_SNOW_LEOPARD, |
Alexander Potapenko | 4e0e50a | 2012-10-16 16:48:51 +0000 | [diff] [blame] | 44 | MACOS_VERSION_LION, |
Alexander Potapenko | ad2ae54 | 2013-07-16 08:35:42 +0000 | [diff] [blame] | 45 | MACOS_VERSION_MOUNTAIN_LION, |
| 46 | MACOS_VERSION_MAVERICKS |
Alexander Potapenko | d079db6 | 2012-07-06 11:58:54 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
Alexander Potapenko | 37c4853 | 2012-08-15 12:23:36 +0000 | [diff] [blame] | 49 | // Used by asan_malloc_mac.cc and asan_mac.cc |
| 50 | extern "C" void __CFInitialize(); |
| 51 | |
Alexander Potapenko | d079db6 | 2012-07-06 11:58:54 +0000 | [diff] [blame] | 52 | namespace __asan { |
| 53 | |
Alexander Potapenko | 31f78fd | 2013-07-16 09:29:48 +0000 | [diff] [blame] | 54 | MacosVersion GetMacosVersion(); |
Alexander Potapenko | ec3a5a2 | 2012-10-24 09:35:23 +0000 | [diff] [blame] | 55 | void MaybeReplaceCFAllocator(); |
Alexander Potapenko | d079db6 | 2012-07-06 11:58:54 +0000 | [diff] [blame] | 56 | |
| 57 | } // namespace __asan |
| 58 | |
Evgeniy Stepanov | 24e1372 | 2013-03-19 14:33:38 +0000 | [diff] [blame] | 59 | #endif // ASAN_MAC_H |