Fix internal_clone for x32
[gcc.git] / libsanitizer / asan / asan_mac.h
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
14
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.
18
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
23
24 #if defined(__LITTLE_ENDIAN__)
25 #define CF_RC_BITS 3
26 #endif
27
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;
36
37 enum MacosVersion {
38 MACOS_VERSION_UNINITIALIZED = 0,
39 MACOS_VERSION_UNKNOWN,
40 MACOS_VERSION_LEOPARD,
41 MACOS_VERSION_SNOW_LEOPARD,
42 MACOS_VERSION_LION,
43 MACOS_VERSION_MOUNTAIN_LION,
44 MACOS_VERSION_MAVERICKS
45 };
46
47 // Used by asan_malloc_mac.cc and asan_mac.cc
48 extern "C" void __CFInitialize();
49
50 namespace __asan {
51
52 MacosVersion GetMacosVersion();
53 void MaybeReplaceCFAllocator();
54
55 } // namespace __asan
56
57 #endif // ASAN_MAC_H