2012-10-29 Wei Mi <wmi@google.com>
[official-gcc.git] / libasan / asan_mac.h
blob18aca0dd84e1dbf92afbc4865ca193aa1796703e
1 //===-- asan_mac.h ----------------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of AddressSanitizer, an address sanity checker.
9 //
10 // Mac-specific ASan definitions.
11 //===----------------------------------------------------------------------===//
12 #ifndef ASAN_MAC_H
13 #define ASAN_MAC_H
15 // CF_RC_BITS, the layout of CFRuntimeBase and __CFStrIsConstant are internal
16 // and subject to change in further CoreFoundation versions. Apple does not
17 // guarantee any binary compatibility from release to release.
19 // See http://opensource.apple.com/source/CF/CF-635.15/CFInternal.h
20 #if defined(__BIG_ENDIAN__)
21 #define CF_RC_BITS 0
22 #endif
24 #if defined(__LITTLE_ENDIAN__)
25 #define CF_RC_BITS 3
26 #endif
28 // See http://opensource.apple.com/source/CF/CF-635.15/CFRuntime.h
29 typedef struct __CFRuntimeBase {
30 uptr _cfisa;
31 u8 _cfinfo[4];
32 #if __LP64__
33 u32 _rc;
34 #endif
35 } CFRuntimeBase;
37 enum {
38 MACOS_VERSION_UNKNOWN = 0,
39 MACOS_VERSION_LEOPARD,
40 MACOS_VERSION_SNOW_LEOPARD,
41 MACOS_VERSION_LION
44 // Used by asan_malloc_mac.cc and asan_mac.cc
45 extern "C" void __CFInitialize();
47 namespace __asan {
49 int GetMacosVersion();
50 void ReplaceCFAllocator();
52 } // namespace __asan
54 #endif // ASAN_MAC_H