[PATCH] D40100: [sanitizer] Use runtime checks instead of API level for Android logging

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 14:19:37 PST 2017


cryptoad created this revision.
Herald added subscribers: kubamracek, srhines.

Recent Bionic have a slew of `async_safe_*` logging functions that are
basically the liblog ones but included within the libc. They have the advantage
of not allocating memory. `async_safe_write_log` does no formatting and is
likely the best candidate for logging.

Use a weak definition to try and use it. Also, avoid API level checks (as
the toolchain is compiled at a rather low API level) for `__android_log_write`
in favor of a weak definition as well.

Keep the fallback to `syslog` if nothing else was found.

I tried to overhaul the code block to only have a single #if SANITIZER_ANDROID
but I am not particularly attached to the form. LMKWYT.


https://reviews.llvm.org/D40100

Files:
  lib/sanitizer_common/sanitizer_linux_libcdep.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40100.123082.patch
Type: text/x-patch
Size: 3024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171115/cfe1aa97/attachment.bin>


More information about the llvm-commits mailing list