diff options
Diffstat (limited to 'lib/interception')
-rw-r--r-- | lib/interception/CMakeLists.txt | 20 | ||||
-rw-r--r-- | lib/interception/interception.h | 1 | ||||
-rw-r--r-- | lib/interception/interception_win.cc | 13 |
3 files changed, 14 insertions, 20 deletions
diff --git a/lib/interception/CMakeLists.txt b/lib/interception/CMakeLists.txt index b77f2d1562b7..16b41c976d6b 100644 --- a/lib/interception/CMakeLists.txt +++ b/lib/interception/CMakeLists.txt @@ -12,18 +12,8 @@ include_directories(..) set(INTERCEPTION_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_no_rtti_flag(INTERCEPTION_CFLAGS) -if(APPLE) - # Build universal binary on APPLE. - foreach(os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS}) - add_compiler_rt_darwin_object_library(RTInterception ${os} - ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH} - SOURCES ${INTERCEPTION_SOURCES} - CFLAGS ${INTERCEPTION_CFLAGS}) - endforeach() -else() - # Otherwise, build separate libraries for each target. - foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH}) - add_compiler_rt_object_library(RTInterception ${arch} - SOURCES ${INTERCEPTION_SOURCES} CFLAGS ${INTERCEPTION_CFLAGS}) - endforeach() -endif() +add_compiler_rt_object_libraries(RTInterception + OS ${SANITIZER_COMMON_SUPPORTED_OS} + ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH} + SOURCES ${INTERCEPTION_SOURCES} + CFLAGS ${INTERCEPTION_CFLAGS}) diff --git a/lib/interception/interception.h b/lib/interception/interception.h index 52573258bf98..9e9aca215c4d 100644 --- a/lib/interception/interception.h +++ b/lib/interception/interception.h @@ -219,7 +219,6 @@ const interpose_substitution substitution_##func_name[] \ namespace __interception { \ FUNC_TYPE(func) PTR_TO_REAL(func); \ } \ - DECLARE_WRAPPER_WINAPI(ret_type, func, __VA_ARGS__) \ extern "C" \ INTERCEPTOR_ATTRIBUTE \ ret_type __stdcall WRAP(func)(__VA_ARGS__) diff --git a/lib/interception/interception_win.cc b/lib/interception/interception_win.cc index cd241c3d23c3..19cf184948b9 100644 --- a/lib/interception/interception_win.cc +++ b/lib/interception/interception_win.cc @@ -84,6 +84,7 @@ static size_t RoundUpToInstrBoundary(size_t size, char *code) { cursor += 2; continue; case '\xE9': // E9 XX YY ZZ WW = jmp WWZZYYXX + case '\xB8': // B8 XX YY ZZ WW = mov eax, WWZZYYXX cursor += 5; continue; } @@ -182,10 +183,14 @@ bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) { } static const void **InterestingDLLsAvailable() { - const char *InterestingDLLs[] = {"kernel32.dll", - "msvcr110.dll", // VS2012 - "msvcr120.dll", // VS2013 - NULL}; + const char *InterestingDLLs[] = { + "kernel32.dll", + "msvcr110.dll", // VS2012 + "msvcr120.dll", // VS2013 + // NTDLL should go last as it exports some functions that we should override + // in the CRT [presumably only used internally]. + "ntdll.dll", NULL + }; static void *result[ARRAY_SIZE(InterestingDLLs)] = { 0 }; if (!result[0]) { for (size_t i = 0, j = 0; InterestingDLLs[i]; ++i) { |