Add support for ARMv8-R architecture
[official-gcc.git] / libsanitizer / interception / interception_linux.cc
blob0a8305b0bf82aefe765ad8d34b56b776fc54888f
1 //===-- interception_linux.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 // Linux-specific interception methods.
11 //===----------------------------------------------------------------------===//
13 #if defined(__linux__) || defined(__FreeBSD__)
14 #include "interception.h"
16 #include <dlfcn.h> // for dlsym() and dlvsym()
18 namespace __interception {
19 bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
20 uptr real, uptr wrapper) {
21 *func_addr = (uptr)dlsym(RTLD_NEXT, func_name);
22 return real == wrapper;
25 #if !defined(__ANDROID__) // android does not have dlvsym
26 void *GetFuncAddrVer(const char *func_name, const char *ver) {
27 return dlvsym(RTLD_NEXT, func_name, ver);
29 #endif // !defined(__ANDROID__)
31 } // namespace __interception
34 #endif // __linux__ || __FreeBSD__