diff --git a/compiler-rt/lib/asan/asan_rtl.cpp b/compiler-rt/lib/asan/asan_rtl.cpp index cbbdcf7914b0a149e847e753abbee8fd35cf4afb..33b6b2dc9dee6be82a8a026c95dd7fb37969cec0 100644 --- a/compiler-rt/lib/asan/asan_rtl.cpp +++ b/compiler-rt/lib/asan/asan_rtl.cpp @@ -419,9 +419,11 @@ static void AsanInitInternal() { __asan_option_detect_stack_use_after_return = flags()->detect_stack_use_after_return; - +// OHOS_LOCAL Begin +#if !SANITIZER_OHOS __sanitizer::InitializePlatformEarly(); - +#endif +// OHOS_LOCAL End // Setup internal allocator callback. SetLowLevelAllocateMinAlignment(ASAN_SHADOW_GRANULARITY); SetLowLevelAllocateCallback(OnLowLevelAllocate); diff --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp index 41c0c8b51fdfbbccd7664ec55cf4f006fc1beff5..b8838ccbbe23e72f09730aecf3d4ef828851b8e8 100644 --- a/compiler-rt/lib/hwasan/hwasan.cpp +++ b/compiler-rt/lib/hwasan/hwasan.cpp @@ -334,9 +334,11 @@ __attribute__((constructor(0))) void __hwasan_init() { // Install tool-specific callbacks in sanitizer_common. SetCheckUnwindCallback(CheckUnwind); - +// OHOS_LOCAL Begin +#if !SANITIZER_OHOS __sanitizer_set_report_path(common_flags()->log_path); - +#endif +// OHOS_LOCAL End AndroidTestTlsSlot(); DisableCoreDumperIfNecessary(); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp index 610876331aabc1d1d345e31fda02480b366890ca..80476dae7f9cdbfa622ea09314d754aca994ee67 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp @@ -1063,7 +1063,7 @@ static bool ShouldLogAfterPrintf() { } extern "C" SANITIZER_WEAK_ATTRIBUTE int musl_log(const char *fmt, ...); -extern "C" SANITIZER_WEAK_ATTRIBUTE int ohos_dfx_log(const char *s); +extern "C" SANITIZER_WEAK_ATTRIBUTE int ohos_dfx_log(const char *s, const char *p); void WriteOneLineToSyslog(const char *s) { if (&musl_log) { musl_log(s); @@ -1097,7 +1097,7 @@ void LogMessageOnPrintf(const char *str) { // disk. The ohos_dfx_log may perform dynamic memory allocation, potentiallt // leading to the sanitizer triggering a recursive call. safe_to_call_printf = false; - ohos_dfx_log(str); + ohos_dfx_log(str, common_flags()->log_path); safe_to_call_printf = true; } #endif