summaryrefslogtreecommitdiffstats
path: root/contrib/compiler-rt/lib/interception/interception_linux.cc
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-01-08 19:47:10 +0000
committerdim <dim@FreeBSD.org>2015-01-08 19:47:10 +0000
commitab328f15cea04a45750ef56019d2b3d971e033f3 (patch)
treef47eabbd2a48be6d6fec3ddeeefae5b4aeb87dbc /contrib/compiler-rt/lib/interception/interception_linux.cc
parent8189659be8e499f37c87fdd05ef5ec9f88619d56 (diff)
parent2f1c5cc1039d86db0037cb086bd58f4b90dc6f66 (diff)
downloadFreeBSD-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.cc')
-rw-r--r--contrib/compiler-rt/lib/interception/interception_linux.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/contrib/compiler-rt/lib/interception/interception_linux.cc b/contrib/compiler-rt/lib/interception/interception_linux.cc
new file mode 100644
index 0000000..6e908ac
--- /dev/null
+++ b/contrib/compiler-rt/lib/interception/interception_linux.cc
@@ -0,0 +1,36 @@
+//===-- interception_linux.cc -----------------------------------*- 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__)
+#include "interception.h"
+
+#include <dlfcn.h> // for dlsym() and dlvsym()
+
+namespace __interception {
+bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
+ uptr real, uptr wrapper) {
+ *func_addr = (uptr)dlsym(RTLD_NEXT, func_name);
+ return real == wrapper;
+}
+
+#if !defined(__ANDROID__) // android does not have dlvsym
+void *GetFuncAddrVer(const char *func_name, const char *ver) {
+ return dlvsym(RTLD_NEXT, func_name, ver);
+}
+#endif // !defined(__ANDROID__)
+
+} // namespace __interception
+
+
+#endif // __linux__ || __FreeBSD__
OpenPOWER on IntegriCloud