diff options
| author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-09-04 01:15:25 +0000 |
|---|---|---|
| committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-09-04 01:15:25 +0000 |
| commit | 6d500c55603bf7ce3ad17c092a2c0e3a6948d910 (patch) | |
| tree | a0df07c2a2a1f23da32096bd50c1cf6655310462 | |
| parent | 332653ccf68ca68f216635173bb531c4fe137340 (diff) | |
| download | bcm5719-llvm-6d500c55603bf7ce3ad17c092a2c0e3a6948d910.tar.gz bcm5719-llvm-6d500c55603bf7ce3ad17c092a2c0e3a6948d910.zip | |
[asan] Delay syslog use on Android until the end of __asan_init.
Due to a slightly different initialization order, syslog on
android/x86 calls vsnprintf, which can not be handled until interceptors
are initialized at least.
llvm-svn: 246831
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc index 8670fc34fa0..13e790a8972 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -538,7 +538,8 @@ uptr GetRSS() { // Starting with the L release, syslog() works and is preferable to // __android_log_write. #if SANITIZER_LINUX -#if SANITIZER_ANDROID && __ANDROID_API__ < 21 + +#if SANITIZER_ANDROID static atomic_uint8_t android_log_initialized; void AndroidLogInit() { @@ -548,17 +549,19 @@ void AndroidLogInit() { static bool IsSyslogAvailable() { return atomic_load(&android_log_initialized, memory_order_acquire); } - -static void WriteOneLineToSyslog(const char *s) { - __android_log_write(ANDROID_LOG_INFO, NULL, s); -} #else void AndroidLogInit() {} static bool IsSyslogAvailable() { return true; } +#endif // SANITIZER_ANDROID -static void WriteOneLineToSyslog(const char *s) { syslog(LOG_INFO, "%s", s); } +static void WriteOneLineToSyslog(const char *s) { +#if SANITIZER_ANDROID &&__ANDROID_API__ < 21 + __android_log_write(ANDROID_LOG_INFO, NULL, s); +#else + syslog(LOG_INFO, "%s", s); #endif +} void WriteToSyslog(const char *buffer) { if (!IsSyslogAvailable()) |

