diff options
author | Wei Mi <wmi@google.com> | 2012-11-12 15:53:47 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2012-11-12 16:53:47 +0100 |
commit | f35db108b96cac4fd3f2b62024ed93ac006ff932 (patch) | |
tree | 78af479c74cf29780202765e911b12f4bf192001 /libsanitizer/interception/interception_mac.cc | |
parent | 25ae50273ad2801ecc262ba75fa8bac0c4e0001b (diff) | |
download | gcc-f35db108b96cac4fd3f2b62024ed93ac006ff932.zip gcc-f35db108b96cac4fd3f2b62024ed93ac006ff932.tar.gz gcc-f35db108b96cac4fd3f2b62024ed93ac006ff932.tar.bz2 |
Import the asan runtime library into GCC tree
This patch imports the runtime library in the GCC tree, ensures that
-lasan is passed to the linker when -faddress-sanitizer is used and
sets up the build system accordingly.
ChangeLog:
* configure.ac: Add libsanitizer to target_libraries.
* Makefile.def: Ditto.
* configure: Regenerate.
* Makefile.in: Regenerate.
* libsanitizer: New directory for asan runtime. Contains an empty
tsan directory.
gcc/ChangeLog:
* gcc.c (LINK_COMMAND_SPEC): Add -laddress-sanitizer to link
command if -faddress-sanitizer is on.
libsanitizer:
Initial checkin: migrate asan runtime from llvm.
From-SVN: r193441
Diffstat (limited to 'libsanitizer/interception/interception_mac.cc')
-rw-r--r-- | libsanitizer/interception/interception_mac.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libsanitizer/interception/interception_mac.cc b/libsanitizer/interception/interception_mac.cc new file mode 100644 index 0000000..c9b7dd3 --- /dev/null +++ b/libsanitizer/interception/interception_mac.cc @@ -0,0 +1,29 @@ +//===-- interception_mac.cc -------------------------------------*- C++ -*-===// +// +// 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. +// +// Mac-specific interception methods. +//===----------------------------------------------------------------------===// + +#ifdef __APPLE__ + +#include "interception.h" +#include "mach_override/mach_override.h" + +namespace __interception { +bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) { + *orig_old_func = 0; + int res = __asan_mach_override_ptr_custom((void*)old_func, (void*)new_func, + (void**)orig_old_func, + __interception_allocate_island, + __interception_deallocate_island); + return (res == 0) && (*orig_old_func != 0); +} +} // namespace __interception + +#endif // __APPLE__ |