diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2022-01-27 10:32:09 -0800 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2022-03-07 09:29:50 -0800 |
commit | 1d088275227fc16efee48b267ccfef65b6a55ec7 (patch) | |
tree | 73c18364cbb7a7fc6bab10af24fe89b87a686b0d /toolchain-extras | |
parent | 6dba1c5eb7a70d71837fac4bc95ac6d76be1b8a8 (diff) | |
download | extras-1d088275227fc16efee48b267ccfef65b6a55ec7.tar.gz |
Create libraries for continuous mode
Bug: http://b/194128476
In continuous mode, the libraries don't need to call
__llvm_profile_write_file. We still register the signal handler to keep
this change low-touch.
Test: build the new libraries and verify absence of call to
__llvm_profile_write_file.
Change-Id: I00dc15a56a41494b464a6715242c79845605ebc3
Diffstat (limited to 'toolchain-extras')
-rw-r--r-- | toolchain-extras/Android.bp | 51 | ||||
-rw-r--r-- | toolchain-extras/profile-clang-extras.cpp | 6 |
2 files changed, 57 insertions, 0 deletions
diff --git a/toolchain-extras/Android.bp b/toolchain-extras/Android.bp index 8922946c..d48f081f 100644 --- a/toolchain-extras/Android.bp +++ b/toolchain-extras/Android.bp @@ -74,6 +74,11 @@ cc_defaults { header_libs: ["libc_headers"], } +// ----------------------------------------------------------------------------- +// libprofile-clang libraries for regular coverage. They also install a signal +// handler that writes coverage data to disk. +// ----------------------------------------------------------------------------- + cc_library_static { name: "libprofile-clang-extras", defaults: ["libprofile-clang-platform-defaults"], @@ -98,6 +103,52 @@ cc_library_static { }, } +// ----------------------------------------------------------------------------- +// libprofile-clang libraries for continuous coverage. They install a no-op +// signal handler. +// ----------------------------------------------------------------------------- + +cc_defaults { + name: "profile-extras-continuous-mode", + cflags: ["-D__CONTINUOUS_COVERAGE_MODE__"], +} + +cc_library_static { + name: "libprofile-clang-extras_continuous", + defaults: [ + "libprofile-clang-platform-defaults", + "profile-extras-continuous-mode", + ], +} + +cc_library_static { + name: "libprofile-clang-extras_ndk_continuous", + defaults: [ + "libprofile-clang-platform-defaults", + "profile-extras-continuous-mode", + ], + + sdk_version: "minimum", +} + +cc_library_static { + name: "libprofile-clang-extras_cfi_support_continuous", + defaults: [ + "libprofile-clang-platform-defaults", + "profile-extras-continuous-mode", + ], + + sanitize: { + cfi: true, + config: { + cfi_assembly_support: true, + }, + }, +} + +// ----------------------------------------------------------------------------- +// tests +// ----------------------------------------------------------------------------- cc_test { name: "libprofile-extras-test", srcs: [ diff --git a/toolchain-extras/profile-clang-extras.cpp b/toolchain-extras/profile-clang-extras.cpp index c45f9b39..6a7766ef 100644 --- a/toolchain-extras/profile-clang-extras.cpp +++ b/toolchain-extras/profile-clang-extras.cpp @@ -24,10 +24,16 @@ extern "C" { static sighandler_t chained_signal_handler = SIG_ERR; +#ifndef __CONTINUOUS_COVERAGE_MODE__ int __llvm_profile_write_file(void); +#endif // __CONTINUOUS_COVERAGE_MODE__ static void llvm_signal_handler(__unused int signum) { + // TODO(pirama) Only disable __llvm_profile_write_file call to begin with. + // After continuous mode is stable, stop registering the signal handler. +#ifndef __CONTINUOUS_COVERAGE_MODE__ __llvm_profile_write_file(); +#endif // __CONTINUOUS_COVERAGE_MODE__ if (chained_signal_handler != SIG_ERR && chained_signal_handler != SIG_IGN && chained_signal_handler != SIG_DFL) { |