10b57cec5SDimitry Andric //===-- interception.h ------------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file is a part of AddressSanitizer, an address sanity checker. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric // Machinery for providing replacements/wrappers for system functions. 120b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric #ifndef INTERCEPTION_H 150b57cec5SDimitry Andric #define INTERCEPTION_H 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric #include "sanitizer_common/sanitizer_internal_defs.h" 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric #if !SANITIZER_LINUX && !SANITIZER_FREEBSD && !SANITIZER_MAC && \ 200b57cec5SDimitry Andric !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_WINDOWS && \ 210b57cec5SDimitry Andric !SANITIZER_FUCHSIA && !SANITIZER_RTEMS && !SANITIZER_SOLARIS 220b57cec5SDimitry Andric # error "Interception doesn't work on this operating system." 230b57cec5SDimitry Andric #endif 240b57cec5SDimitry Andric 250b57cec5SDimitry Andric // These typedefs should be used only in the interceptor definitions to replace 260b57cec5SDimitry Andric // the standard system types (e.g. SSIZE_T instead of ssize_t) 270b57cec5SDimitry Andric typedef __sanitizer::uptr SIZE_T; 280b57cec5SDimitry Andric typedef __sanitizer::sptr SSIZE_T; 290b57cec5SDimitry Andric typedef __sanitizer::sptr PTRDIFF_T; 300b57cec5SDimitry Andric typedef __sanitizer::s64 INTMAX_T; 310b57cec5SDimitry Andric typedef __sanitizer::u64 UINTMAX_T; 320b57cec5SDimitry Andric typedef __sanitizer::OFF_T OFF_T; 330b57cec5SDimitry Andric typedef __sanitizer::OFF64_T OFF64_T; 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric // How to add an interceptor: 360b57cec5SDimitry Andric // Suppose you need to wrap/replace system function (generally, from libc): 370b57cec5SDimitry Andric // int foo(const char *bar, double baz); 380b57cec5SDimitry Andric // You'll need to: 390b57cec5SDimitry Andric // 1) define INTERCEPTOR(int, foo, const char *bar, double baz) { ... } in 400b57cec5SDimitry Andric // your source file. See the notes below for cases when 410b57cec5SDimitry Andric // INTERCEPTOR_WITH_SUFFIX(...) should be used instead. 420b57cec5SDimitry Andric // 2) Call "INTERCEPT_FUNCTION(foo)" prior to the first call of "foo". 430b57cec5SDimitry Andric // INTERCEPT_FUNCTION(foo) evaluates to "true" iff the function was 440b57cec5SDimitry Andric // intercepted successfully. 450b57cec5SDimitry Andric // You can access original function by calling REAL(foo)(bar, baz). 460b57cec5SDimitry Andric // By default, REAL(foo) will be visible only inside your interceptor, and if 470b57cec5SDimitry Andric // you want to use it in other parts of RTL, you'll need to: 480b57cec5SDimitry Andric // 3a) add DECLARE_REAL(int, foo, const char*, double) to a 490b57cec5SDimitry Andric // header file. 500b57cec5SDimitry Andric // However, if the call "INTERCEPT_FUNCTION(foo)" and definition for 510b57cec5SDimitry Andric // INTERCEPTOR(..., foo, ...) are in different files, you'll instead need to: 520b57cec5SDimitry Andric // 3b) add DECLARE_REAL_AND_INTERCEPTOR(int, foo, const char*, double) 530b57cec5SDimitry Andric // to a header file. 540b57cec5SDimitry Andric 550b57cec5SDimitry Andric // Notes: 1. Things may not work properly if macro INTERCEPTOR(...) {...} or 560b57cec5SDimitry Andric // DECLARE_REAL(...) are located inside namespaces. 570b57cec5SDimitry Andric // 2. On Mac you can also use: "OVERRIDE_FUNCTION(foo, zoo)" to 580b57cec5SDimitry Andric // effectively redirect calls from "foo" to "zoo". In this case 590b57cec5SDimitry Andric // you aren't required to implement 600b57cec5SDimitry Andric // INTERCEPTOR(int, foo, const char *bar, double baz) {...} 610b57cec5SDimitry Andric // but instead you'll have to add 620b57cec5SDimitry Andric // DECLARE_REAL(int, foo, const char *bar, double baz) in your 630b57cec5SDimitry Andric // source file (to define a pointer to overriden function). 640b57cec5SDimitry Andric // 3. Some Mac functions have symbol variants discriminated by 650b57cec5SDimitry Andric // additional suffixes, e.g. _$UNIX2003 (see 660b57cec5SDimitry Andric // https://developer.apple.com/library/mac/#releasenotes/Darwin/SymbolVariantsRelNotes/index.html 670b57cec5SDimitry Andric // for more details). To intercept such functions you need to use the 680b57cec5SDimitry Andric // INTERCEPTOR_WITH_SUFFIX(...) macro. 690b57cec5SDimitry Andric 700b57cec5SDimitry Andric // How it works: 710b57cec5SDimitry Andric // To replace system functions on Linux we just need to declare functions 720b57cec5SDimitry Andric // with same names in our library and then obtain the real function pointers 730b57cec5SDimitry Andric // using dlsym(). 740b57cec5SDimitry Andric // There is one complication. A user may also intercept some of the functions 750b57cec5SDimitry Andric // we intercept. To resolve this we declare our interceptors with __interceptor_ 760b57cec5SDimitry Andric // prefix, and then make actual interceptors weak aliases to __interceptor_ 770b57cec5SDimitry Andric // functions. 780b57cec5SDimitry Andric // 790b57cec5SDimitry Andric // This is not so on Mac OS, where the two-level namespace makes 800b57cec5SDimitry Andric // our replacement functions invisible to other libraries. This may be overcomed 810b57cec5SDimitry Andric // using the DYLD_FORCE_FLAT_NAMESPACE, but some errors loading the shared 820b57cec5SDimitry Andric // libraries in Chromium were noticed when doing so. 830b57cec5SDimitry Andric // Instead we create a dylib containing a __DATA,__interpose section that 840b57cec5SDimitry Andric // associates library functions with their wrappers. When this dylib is 850b57cec5SDimitry Andric // preloaded before an executable using DYLD_INSERT_LIBRARIES, it routes all 860b57cec5SDimitry Andric // the calls to interposed functions done through stubs to the wrapper 870b57cec5SDimitry Andric // functions. 880b57cec5SDimitry Andric // As it's decided at compile time which functions are to be intercepted on Mac, 890b57cec5SDimitry Andric // INTERCEPT_FUNCTION() is effectively a no-op on this system. 900b57cec5SDimitry Andric 910b57cec5SDimitry Andric #if SANITIZER_MAC 920b57cec5SDimitry Andric #include <sys/cdefs.h> // For __DARWIN_ALIAS_C(). 930b57cec5SDimitry Andric 940b57cec5SDimitry Andric // Just a pair of pointers. 950b57cec5SDimitry Andric struct interpose_substitution { 960b57cec5SDimitry Andric const __sanitizer::uptr replacement; 970b57cec5SDimitry Andric const __sanitizer::uptr original; 980b57cec5SDimitry Andric }; 990b57cec5SDimitry Andric 1000b57cec5SDimitry Andric // For a function foo() create a global pair of pointers { wrap_foo, foo } in 1010b57cec5SDimitry Andric // the __DATA,__interpose section. 1020b57cec5SDimitry Andric // As a result all the calls to foo() will be routed to wrap_foo() at runtime. 1030b57cec5SDimitry Andric #define INTERPOSER(func_name) __attribute__((used)) \ 1040b57cec5SDimitry Andric const interpose_substitution substitution_##func_name[] \ 1050b57cec5SDimitry Andric __attribute__((section("__DATA, __interpose"))) = { \ 1060b57cec5SDimitry Andric { reinterpret_cast<const uptr>(WRAP(func_name)), \ 1070b57cec5SDimitry Andric reinterpret_cast<const uptr>(func_name) } \ 1080b57cec5SDimitry Andric } 1090b57cec5SDimitry Andric 1100b57cec5SDimitry Andric // For a function foo() and a wrapper function bar() create a global pair 1110b57cec5SDimitry Andric // of pointers { bar, foo } in the __DATA,__interpose section. 1120b57cec5SDimitry Andric // As a result all the calls to foo() will be routed to bar() at runtime. 1130b57cec5SDimitry Andric #define INTERPOSER_2(func_name, wrapper_name) __attribute__((used)) \ 1140b57cec5SDimitry Andric const interpose_substitution substitution_##func_name[] \ 1150b57cec5SDimitry Andric __attribute__((section("__DATA, __interpose"))) = { \ 1160b57cec5SDimitry Andric { reinterpret_cast<const uptr>(wrapper_name), \ 1170b57cec5SDimitry Andric reinterpret_cast<const uptr>(func_name) } \ 1180b57cec5SDimitry Andric } 1190b57cec5SDimitry Andric 1200b57cec5SDimitry Andric # define WRAP(x) wrap_##x 1210b57cec5SDimitry Andric # define WRAPPER_NAME(x) "wrap_"#x 1220b57cec5SDimitry Andric # define INTERCEPTOR_ATTRIBUTE 1230b57cec5SDimitry Andric # define DECLARE_WRAPPER(ret_type, func, ...) 1240b57cec5SDimitry Andric 1250b57cec5SDimitry Andric #elif SANITIZER_WINDOWS 1260b57cec5SDimitry Andric # define WRAP(x) __asan_wrap_##x 1270b57cec5SDimitry Andric # define WRAPPER_NAME(x) "__asan_wrap_"#x 1280b57cec5SDimitry Andric # define INTERCEPTOR_ATTRIBUTE __declspec(dllexport) 1290b57cec5SDimitry Andric # define DECLARE_WRAPPER(ret_type, func, ...) \ 1300b57cec5SDimitry Andric extern "C" ret_type func(__VA_ARGS__); 1310b57cec5SDimitry Andric # define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \ 1320b57cec5SDimitry Andric extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__); 1330b57cec5SDimitry Andric #elif SANITIZER_RTEMS 1340b57cec5SDimitry Andric # define WRAP(x) x 1350b57cec5SDimitry Andric # define WRAPPER_NAME(x) #x 1360b57cec5SDimitry Andric # define INTERCEPTOR_ATTRIBUTE 1370b57cec5SDimitry Andric # define DECLARE_WRAPPER(ret_type, func, ...) 1380b57cec5SDimitry Andric #elif SANITIZER_FREEBSD || SANITIZER_NETBSD 1390b57cec5SDimitry Andric # define WRAP(x) __interceptor_ ## x 1400b57cec5SDimitry Andric # define WRAPPER_NAME(x) "__interceptor_" #x 1410b57cec5SDimitry Andric # define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) 1420b57cec5SDimitry Andric // FreeBSD's dynamic linker (incompliantly) gives non-weak symbols higher 1430b57cec5SDimitry Andric // priority than weak ones so weak aliases won't work for indirect calls 1440b57cec5SDimitry Andric // in position-independent (-fPIC / -fPIE) mode. 1450b57cec5SDimitry Andric # define DECLARE_WRAPPER(ret_type, func, ...) \ 1460b57cec5SDimitry Andric extern "C" ret_type func(__VA_ARGS__) \ 1470b57cec5SDimitry Andric __attribute__((alias("__interceptor_" #func), visibility("default"))); 1480b57cec5SDimitry Andric #elif !SANITIZER_FUCHSIA 1490b57cec5SDimitry Andric # define WRAP(x) __interceptor_ ## x 1500b57cec5SDimitry Andric # define WRAPPER_NAME(x) "__interceptor_" #x 1510b57cec5SDimitry Andric # define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) 1520b57cec5SDimitry Andric # define DECLARE_WRAPPER(ret_type, func, ...) \ 1530b57cec5SDimitry Andric extern "C" ret_type func(__VA_ARGS__) \ 1540b57cec5SDimitry Andric __attribute__((weak, alias("__interceptor_" #func), visibility("default"))); 1550b57cec5SDimitry Andric #endif 1560b57cec5SDimitry Andric 1570b57cec5SDimitry Andric #if SANITIZER_FUCHSIA 1580b57cec5SDimitry Andric // There is no general interception at all on Fuchsia. 1590b57cec5SDimitry Andric // Sanitizer runtimes just define functions directly to preempt them, 1600b57cec5SDimitry Andric // and have bespoke ways to access the underlying libc functions. 1610b57cec5SDimitry Andric # include <zircon/sanitizer.h> 1620b57cec5SDimitry Andric # define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) 1630b57cec5SDimitry Andric # define REAL(x) __unsanitized_##x 1640b57cec5SDimitry Andric # define DECLARE_REAL(ret_type, func, ...) 1650b57cec5SDimitry Andric #elif SANITIZER_RTEMS 1660b57cec5SDimitry Andric # define REAL(x) __real_ ## x 1670b57cec5SDimitry Andric # define DECLARE_REAL(ret_type, func, ...) \ 1680b57cec5SDimitry Andric extern "C" ret_type REAL(func)(__VA_ARGS__); 1690b57cec5SDimitry Andric #elif !SANITIZER_MAC 1700b57cec5SDimitry Andric # define PTR_TO_REAL(x) real_##x 1710b57cec5SDimitry Andric # define REAL(x) __interception::PTR_TO_REAL(x) 1720b57cec5SDimitry Andric # define FUNC_TYPE(x) x##_type 1730b57cec5SDimitry Andric 1740b57cec5SDimitry Andric # define DECLARE_REAL(ret_type, func, ...) \ 1750b57cec5SDimitry Andric typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \ 1760b57cec5SDimitry Andric namespace __interception { \ 1770b57cec5SDimitry Andric extern FUNC_TYPE(func) PTR_TO_REAL(func); \ 1780b57cec5SDimitry Andric } 1790b57cec5SDimitry Andric # define ASSIGN_REAL(dst, src) REAL(dst) = REAL(src) 1800b57cec5SDimitry Andric #else // SANITIZER_MAC 1810b57cec5SDimitry Andric # define REAL(x) x 1820b57cec5SDimitry Andric # define DECLARE_REAL(ret_type, func, ...) \ 1830b57cec5SDimitry Andric extern "C" ret_type func(__VA_ARGS__); 1840b57cec5SDimitry Andric # define ASSIGN_REAL(x, y) 1850b57cec5SDimitry Andric #endif // SANITIZER_MAC 1860b57cec5SDimitry Andric 1870b57cec5SDimitry Andric #if !SANITIZER_FUCHSIA && !SANITIZER_RTEMS 1880b57cec5SDimitry Andric # define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) \ 1890b57cec5SDimitry Andric DECLARE_REAL(ret_type, func, __VA_ARGS__) \ 1900b57cec5SDimitry Andric extern "C" ret_type WRAP(func)(__VA_ARGS__); 1910b57cec5SDimitry Andric // Declare an interceptor and its wrapper defined in a different translation 1920b57cec5SDimitry Andric // unit (ex. asm). 1930b57cec5SDimitry Andric # define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...) \ 1940b57cec5SDimitry Andric extern "C" ret_type WRAP(func)(__VA_ARGS__); \ 1950b57cec5SDimitry Andric extern "C" ret_type func(__VA_ARGS__); 1960b57cec5SDimitry Andric #else 1970b57cec5SDimitry Andric # define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) 1980b57cec5SDimitry Andric # define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...) 1990b57cec5SDimitry Andric #endif 2000b57cec5SDimitry Andric 2010b57cec5SDimitry Andric // Generally, you don't need to use DEFINE_REAL by itself, as INTERCEPTOR 2020b57cec5SDimitry Andric // macros does its job. In exceptional cases you may need to call REAL(foo) 2030b57cec5SDimitry Andric // without defining INTERCEPTOR(..., foo, ...). For example, if you override 2040b57cec5SDimitry Andric // foo with an interceptor for other function. 2050b57cec5SDimitry Andric #if !SANITIZER_MAC && !SANITIZER_FUCHSIA && !SANITIZER_RTEMS 2060b57cec5SDimitry Andric # define DEFINE_REAL(ret_type, func, ...) \ 2070b57cec5SDimitry Andric typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \ 2080b57cec5SDimitry Andric namespace __interception { \ 2090b57cec5SDimitry Andric FUNC_TYPE(func) PTR_TO_REAL(func); \ 2100b57cec5SDimitry Andric } 2110b57cec5SDimitry Andric #else 2120b57cec5SDimitry Andric # define DEFINE_REAL(ret_type, func, ...) 2130b57cec5SDimitry Andric #endif 2140b57cec5SDimitry Andric 2150b57cec5SDimitry Andric #if SANITIZER_FUCHSIA 2160b57cec5SDimitry Andric 2170b57cec5SDimitry Andric // We need to define the __interceptor_func name just to get 2180b57cec5SDimitry Andric // sanitizer_common/scripts/gen_dynamic_list.py to export func. 2190b57cec5SDimitry Andric // But we don't need to export __interceptor_func to get that. 2200b57cec5SDimitry Andric #define INTERCEPTOR(ret_type, func, ...) \ 2210b57cec5SDimitry Andric extern "C"[[ gnu::alias(#func), gnu::visibility("hidden") ]] ret_type \ 2220b57cec5SDimitry Andric __interceptor_##func(__VA_ARGS__); \ 2230b57cec5SDimitry Andric extern "C" INTERCEPTOR_ATTRIBUTE ret_type func(__VA_ARGS__) 2240b57cec5SDimitry Andric 2250b57cec5SDimitry Andric #elif !SANITIZER_MAC 2260b57cec5SDimitry Andric 2270b57cec5SDimitry Andric #define INTERCEPTOR(ret_type, func, ...) \ 2280b57cec5SDimitry Andric DEFINE_REAL(ret_type, func, __VA_ARGS__) \ 2290b57cec5SDimitry Andric DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \ 2300b57cec5SDimitry Andric extern "C" \ 2310b57cec5SDimitry Andric INTERCEPTOR_ATTRIBUTE \ 2320b57cec5SDimitry Andric ret_type WRAP(func)(__VA_ARGS__) 2330b57cec5SDimitry Andric 2340b57cec5SDimitry Andric // We don't need INTERCEPTOR_WITH_SUFFIX on non-Darwin for now. 2350b57cec5SDimitry Andric #define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \ 2360b57cec5SDimitry Andric INTERCEPTOR(ret_type, func, __VA_ARGS__) 2370b57cec5SDimitry Andric 2380b57cec5SDimitry Andric #else // SANITIZER_MAC 2390b57cec5SDimitry Andric 2400b57cec5SDimitry Andric #define INTERCEPTOR_ZZZ(suffix, ret_type, func, ...) \ 2410b57cec5SDimitry Andric extern "C" ret_type func(__VA_ARGS__) suffix; \ 2420b57cec5SDimitry Andric extern "C" ret_type WRAP(func)(__VA_ARGS__); \ 2430b57cec5SDimitry Andric INTERPOSER(func); \ 2440b57cec5SDimitry Andric extern "C" INTERCEPTOR_ATTRIBUTE ret_type WRAP(func)(__VA_ARGS__) 2450b57cec5SDimitry Andric 2460b57cec5SDimitry Andric #define INTERCEPTOR(ret_type, func, ...) \ 2470b57cec5SDimitry Andric INTERCEPTOR_ZZZ(/*no symbol variants*/, ret_type, func, __VA_ARGS__) 2480b57cec5SDimitry Andric 2490b57cec5SDimitry Andric #define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \ 2500b57cec5SDimitry Andric INTERCEPTOR_ZZZ(__DARWIN_ALIAS_C(func), ret_type, func, __VA_ARGS__) 2510b57cec5SDimitry Andric 2520b57cec5SDimitry Andric // Override |overridee| with |overrider|. 2530b57cec5SDimitry Andric #define OVERRIDE_FUNCTION(overridee, overrider) \ 2540b57cec5SDimitry Andric INTERPOSER_2(overridee, WRAP(overrider)) 2550b57cec5SDimitry Andric #endif 2560b57cec5SDimitry Andric 2570b57cec5SDimitry Andric #if SANITIZER_WINDOWS 2580b57cec5SDimitry Andric # define INTERCEPTOR_WINAPI(ret_type, func, ...) \ 2590b57cec5SDimitry Andric typedef ret_type (__stdcall *FUNC_TYPE(func))(__VA_ARGS__); \ 2600b57cec5SDimitry Andric namespace __interception { \ 2610b57cec5SDimitry Andric FUNC_TYPE(func) PTR_TO_REAL(func); \ 2620b57cec5SDimitry Andric } \ 2630b57cec5SDimitry Andric extern "C" \ 2640b57cec5SDimitry Andric INTERCEPTOR_ATTRIBUTE \ 2650b57cec5SDimitry Andric ret_type __stdcall WRAP(func)(__VA_ARGS__) 2660b57cec5SDimitry Andric #endif 2670b57cec5SDimitry Andric 2680b57cec5SDimitry Andric // ISO C++ forbids casting between pointer-to-function and pointer-to-object, 2690b57cec5SDimitry Andric // so we use casting via an integral type __interception::uptr, 2700b57cec5SDimitry Andric // assuming that system is POSIX-compliant. Using other hacks seem 2710b57cec5SDimitry Andric // challenging, as we don't even pass function type to 2720b57cec5SDimitry Andric // INTERCEPT_FUNCTION macro, only its name. 2730b57cec5SDimitry Andric namespace __interception { 2740b57cec5SDimitry Andric #if defined(_WIN64) 275*68d75effSDimitry Andric typedef unsigned long long uptr; 2760b57cec5SDimitry Andric #else 277*68d75effSDimitry Andric typedef unsigned long uptr; 2780b57cec5SDimitry Andric #endif // _WIN64 2790b57cec5SDimitry Andric } // namespace __interception 2800b57cec5SDimitry Andric 2810b57cec5SDimitry Andric #define INCLUDED_FROM_INTERCEPTION_LIB 2820b57cec5SDimitry Andric 2830b57cec5SDimitry Andric #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \ 2840b57cec5SDimitry Andric SANITIZER_OPENBSD || SANITIZER_SOLARIS 2850b57cec5SDimitry Andric 2860b57cec5SDimitry Andric # include "interception_linux.h" 2870b57cec5SDimitry Andric # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) 2880b57cec5SDimitry Andric # define INTERCEPT_FUNCTION_VER(func, symver) \ 2890b57cec5SDimitry Andric INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) 2900b57cec5SDimitry Andric #elif SANITIZER_MAC 2910b57cec5SDimitry Andric # include "interception_mac.h" 2920b57cec5SDimitry Andric # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_MAC(func) 2930b57cec5SDimitry Andric # define INTERCEPT_FUNCTION_VER(func, symver) \ 2940b57cec5SDimitry Andric INTERCEPT_FUNCTION_VER_MAC(func, symver) 2950b57cec5SDimitry Andric #elif SANITIZER_WINDOWS 2960b57cec5SDimitry Andric # include "interception_win.h" 2970b57cec5SDimitry Andric # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_WIN(func) 2980b57cec5SDimitry Andric # define INTERCEPT_FUNCTION_VER(func, symver) \ 2990b57cec5SDimitry Andric INTERCEPT_FUNCTION_VER_WIN(func, symver) 3000b57cec5SDimitry Andric #endif 3010b57cec5SDimitry Andric 3020b57cec5SDimitry Andric #undef INCLUDED_FROM_INTERCEPTION_LIB 3030b57cec5SDimitry Andric 3040b57cec5SDimitry Andric #endif // INTERCEPTION_H 305