diff options
author | dim <dim@FreeBSD.org> | 2015-01-08 19:47:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-01-08 19:47:10 +0000 |
commit | ab328f15cea04a45750ef56019d2b3d971e033f3 (patch) | |
tree | f47eabbd2a48be6d6fec3ddeeefae5b4aeb87dbc /contrib/compiler-rt/lib/interception/interception_linux.h | |
parent | 8189659be8e499f37c87fdd05ef5ec9f88619d56 (diff) | |
parent | 2f1c5cc1039d86db0037cb086bd58f4b90dc6f66 (diff) | |
download | FreeBSD-src-ab328f15cea04a45750ef56019d2b3d971e033f3.zip FreeBSD-src-ab328f15cea04a45750ef56019d2b3d971e033f3.tar.gz |
Update compiler-rt to trunk r224034. This brings a number of new
builtins, and also the various sanitizers. Support for these will be
added in a later commit.
Diffstat (limited to 'contrib/compiler-rt/lib/interception/interception_linux.h')
-rw-r--r-- | contrib/compiler-rt/lib/interception/interception_linux.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/contrib/compiler-rt/lib/interception/interception_linux.h b/contrib/compiler-rt/lib/interception/interception_linux.h new file mode 100644 index 0000000..d3f774b --- /dev/null +++ b/contrib/compiler-rt/lib/interception/interception_linux.h @@ -0,0 +1,47 @@ +//===-- interception_linux.h ------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Linux-specific interception methods. +//===----------------------------------------------------------------------===// + +#if defined(__linux__) || defined(__FreeBSD__) + +#if !defined(INCLUDED_FROM_INTERCEPTION_LIB) +# error "interception_linux.h should be included from interception library only" +#endif + +#ifndef INTERCEPTION_LINUX_H +#define INTERCEPTION_LINUX_H + +namespace __interception { +// returns true if a function with the given name was found. +bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, + uptr real, uptr wrapper); +void *GetFuncAddrVer(const char *func_name, const char *ver); +} // namespace __interception + +#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \ + ::__interception::GetRealFunctionAddress( \ + #func, (::__interception::uptr *)&__interception::PTR_TO_REAL(func), \ + (::__interception::uptr) & (func), \ + (::__interception::uptr) & WRAP(func)) + +#if !defined(__ANDROID__) // android does not have dlvsym +# define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ + ::__interception::real_##func = (func##_f)(unsigned long) \ + ::__interception::GetFuncAddrVer(#func, symver) +#else +# define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ + INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) +#endif // !defined(__ANDROID__) + +#endif // INTERCEPTION_LINUX_H +#endif // __linux__ || __FreeBSD__ |