forked from OSchip/llvm-project
[NFC] Extract InitializePlatformCommonFlags
And move some Android specifi declarations from headers Differential Revision: https://reviews.llvm.org/D90811
This commit is contained in:
parent
796650d990
commit
6c164d6080
|
@ -215,6 +215,12 @@ static void ProcessThreads(SuspendedThreadsList const &, Frontier *) {}
|
|||
|
||||
#else
|
||||
|
||||
#if SANITIZER_ANDROID
|
||||
// FIXME: Move this out into *libcdep.cpp
|
||||
extern "C" SANITIZER_WEAK_ATTRIBUTE void __libc_iterate_dynamic_tls(
|
||||
pid_t, void (*cb)(void *, void *, uptr, void *), void *);
|
||||
#endif
|
||||
|
||||
// Scans thread data (stacks and TLS) for heap pointers.
|
||||
static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
||||
Frontier *frontier) {
|
||||
|
|
|
@ -126,10 +126,7 @@ void InitializeCommonFlags(CommonFlags *cf) {
|
|||
cf->coverage |= cf->html_cov_report;
|
||||
SetVerbosity(cf->verbosity);
|
||||
|
||||
#if SANITIZER_ANDROID
|
||||
if (!HAS_ANDROID_THREAD_PROPERTIES_API)
|
||||
cf->detect_leaks = false;
|
||||
#endif
|
||||
InitializePlatformCommonFlags(cf);
|
||||
}
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
|
|
@ -62,6 +62,10 @@ void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf);
|
|||
// and perform initializations common to all sanitizers (e.g. setting
|
||||
// verbosity).
|
||||
void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use);
|
||||
|
||||
// Platform specific flags initialization.
|
||||
void InitializePlatformCommonFlags(CommonFlags *cf);
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
#endif // SANITIZER_FLAGS_H
|
||||
|
|
|
@ -153,16 +153,6 @@ ALWAYS_INLINE uptr *get_android_tls_ptr() {
|
|||
return reinterpret_cast<uptr *>(&__get_tls()[TLS_SLOT_SANITIZER]);
|
||||
}
|
||||
|
||||
// Bionic provides this API since S.
|
||||
extern "C" SANITIZER_WEAK_ATTRIBUTE void __libc_get_static_tls_bounds(void **,
|
||||
void **);
|
||||
extern "C" SANITIZER_WEAK_ATTRIBUTE void __libc_iterate_dynamic_tls(
|
||||
pid_t, void (*cb)(void *, void *, uptr, void *), void *);
|
||||
|
||||
#define HAS_ANDROID_THREAD_PROPERTIES_API (&__libc_iterate_dynamic_tls != 0)
|
||||
|
||||
#else
|
||||
#define HAS_ANDROID_THREAD_PROPERTIES_API (0)
|
||||
#endif // SANITIZER_ANDROID
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
|
|
@ -445,10 +445,16 @@ int GetSizeFromHdr(struct dl_phdr_info *info, size_t size, void *data) {
|
|||
}
|
||||
#endif // SANITIZER_NETBSD
|
||||
|
||||
#if SANITIZER_ANDROID
|
||||
// Bionic provides this API since S.
|
||||
extern "C" SANITIZER_WEAK_ATTRIBUTE void __libc_get_static_tls_bounds(void **,
|
||||
void **);
|
||||
#endif
|
||||
|
||||
#if !SANITIZER_GO
|
||||
static void GetTls(uptr *addr, uptr *size) {
|
||||
#if SANITIZER_ANDROID
|
||||
if (HAS_ANDROID_THREAD_PROPERTIES_API) {
|
||||
if (&__libc_get_static_tls_bounds) {
|
||||
void *start_addr;
|
||||
void *end_addr;
|
||||
__libc_get_static_tls_bounds(&start_addr, &end_addr);
|
||||
|
@ -900,6 +906,13 @@ uptr MapDynamicShadow(uptr shadow_size_bytes, uptr shadow_scale,
|
|||
return shadow_start;
|
||||
}
|
||||
|
||||
void InitializePlatformCommonFlags(CommonFlags *cf) {
|
||||
#if SANITIZER_ANDROID
|
||||
if (&__libc_get_static_tls_bounds == nullptr)
|
||||
cf->detect_leaks = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1333,6 +1333,8 @@ u32 GetNumberOfCPUs() {
|
|||
return (u32)sysconf(_SC_NPROCESSORS_ONLN);
|
||||
}
|
||||
|
||||
void InitializePlatformCommonFlags(CommonFlags *cf) {}
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
#endif // SANITIZER_MAC
|
||||
|
|
|
@ -1138,6 +1138,8 @@ void LogFullErrorReport(const char *buffer) {
|
|||
}
|
||||
#endif // SANITIZER_WIN_TRACE
|
||||
|
||||
void InitializePlatformCommonFlags(CommonFlags *cf) {}
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
#endif // _WIN32
|
||||
|
|
Loading…
Reference in New Issue