Update LOCAL_PATCHES after libsanitizer merge.
[official-gcc.git] / libsanitizer / interception / interception_linux.h
blob37e6386df5b435cd716256a083be30eb5c6659e9
1 //===-- interception_linux.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 // Linux-specific interception methods.
11 //===----------------------------------------------------------------------===//
13 #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \
14 SANITIZER_OPENBSD || SANITIZER_SOLARIS
16 #if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
17 # error "interception_linux.h should be included from interception library only"
18 #endif
20 #ifndef INTERCEPTION_LINUX_H
21 #define INTERCEPTION_LINUX_H
23 namespace __interception {
24 // returns true if a function with the given name was found.
25 bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
26 uptr real, uptr wrapper);
27 void *GetFuncAddrVer(const char *func_name, const char *ver);
28 } // namespace __interception
30 #define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \
31 ::__interception::GetRealFunctionAddress( \
32 #func, (::__interception::uptr *)&__interception::PTR_TO_REAL(func), \
33 (::__interception::uptr) & (func), \
34 (::__interception::uptr) & WRAP(func))
36 // Android, Solaris and OpenBSD do not have dlvsym
37 #if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD
38 #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
39 (::__interception::real_##func = (func##_type)( \
40 unsigned long)::__interception::GetFuncAddrVer(#func, symver))
41 #else
42 #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
43 INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
44 #endif // !SANITIZER_ANDROID && !SANITIZER_SOLARIS
46 #endif // INTERCEPTION_LINUX_H
47 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD ||
48 // SANITIZER_OPENBSD || SANITIZER_SOLARIS