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