[sanitizer] Fix compilation errors in r355030.

Disable hwasan interceptor on non-linux, non-x86-or-arm platforms.
Add @plt to the asm call that clang intergrated-as infers but gcc does
not.

llvm-svn: 355041
This commit is contained in:
Evgeniy Stepanov 2019-02-27 22:23:51 +00:00
parent fcfa7c5f92
commit f6b0a14bff
5 changed files with 12 additions and 5 deletions

View File

@ -32,7 +32,7 @@ set(ASAN_SOURCES
asan_thread.cc
asan_win.cc)
if (NOT WIN32)
if (NOT WIN32 AND NOT APPLE)
list(APPEND ASAN_SOURCES asan_interceptors_vfork.S)
endif()

View File

@ -579,7 +579,7 @@ INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
}
#endif // ASAN_INTERCEPT___CXA_ATEXIT
#if defined(__linux__)
#if ASAN_INTERCEPT_VFORK
DEFINE_REAL(int, vfork);
DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(int, vfork);
#endif
@ -661,7 +661,7 @@ void InitializeAsanInterceptors() {
ASAN_INTERCEPT_FUNC(__cxa_atexit);
#endif
#if defined(__linux__)
#if ASAN_INTERCEPT_VFORK
ASAN_INTERCEPT_FUNC(vfork);
#endif

View File

@ -105,6 +105,13 @@ void InitializePlatformInterceptors();
# define ASAN_INTERCEPT___STRDUP 0
#endif
#if SANITIZER_LINUX && (defined(__arm__) || defined(__aarch64__) || \
defined(__i386__) || defined(__x86_64__))
# define ASAN_INTERCEPT_VFORK 1
#else
# define ASAN_INTERCEPT_VFORK 0
#endif
DECLARE_REAL(int, memcmp, const void *a1, const void *a2, uptr size)
DECLARE_REAL(char*, strchr, const char *str, int c)
DECLARE_REAL(SIZE_T, strlen, const char *s)

View File

@ -31,7 +31,7 @@ ASM_WRAPPER_NAME(vfork):
lea 16(%esp), %ecx
mov %ecx, (%esp)
call COMMON_INTERCEPTOR_HANDLE_VFORK
call COMMON_INTERCEPTOR_HANDLE_VFORK@PLT
.L_exit:
mov 4(%esp), %eax

View File

@ -28,7 +28,7 @@ ASM_WRAPPER_NAME(vfork):
je .L_exit
lea 16(%rsp), %rdi
call COMMON_INTERCEPTOR_HANDLE_VFORK
call COMMON_INTERCEPTOR_HANDLE_VFORK@PLT
.L_exit:
pop %rax