* configure.ac: Change target-libasan to target-libsanitizer.
[official-gcc.git] / libsanitizer / interception / interception_mac.cc
blobc9b7dd32d0f6b592e961430e38e72173a2935c0a
1 //===-- interception_mac.cc -------------------------------------*- 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 interception methods.
11 //===----------------------------------------------------------------------===//
13 #ifdef __APPLE__
15 #include "interception.h"
16 #include "mach_override/mach_override.h"
18 namespace __interception {
19 bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) {
20 *orig_old_func = 0;
21 int res = __asan_mach_override_ptr_custom((void*)old_func, (void*)new_func,
22 (void**)orig_old_func,
23 __interception_allocate_island,
24 __interception_deallocate_island);
25 return (res == 0) && (*orig_old_func != 0);
27 } // namespace __interception
29 #endif // __APPLE__