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 //===----------------------------------------------------------------------===// 14 #ifndef ASAN_MAC_H 15 #define ASAN_MAC_H 16 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 39 enum MacosVersion { 40 MACOS_VERSION_UNINITIALIZED = 0, 41 MACOS_VERSION_UNKNOWN, 42 MACOS_VERSION_LEOPARD, 43 MACOS_VERSION_SNOW_LEOPARD, 44 MACOS_VERSION_LION, 45 MACOS_VERSION_MOUNTAIN_LION, 46 MACOS_VERSION_MAVERICKS 47 }; 48 49 // Used by asan_malloc_mac.cc and asan_mac.cc 50 extern "C" void __CFInitialize(); 51 52 namespace __asan { 53 54 MacosVersion GetMacosVersion(); 55 void MaybeReplaceCFAllocator(); 56 57 } // namespace __asan 58 59 #endif // ASAN_MAC_H 60