mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 03:44:59 +00:00
[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
This commit is contained in:
parent
332653ccf6
commit
6d500c5560
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user