summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2018-06-29 21:45:55 +0000
committerChih-Hung Hsieh <chh@google.com>2018-06-29 21:45:55 +0000
commit46ce63aeead620efb48427fe645513a32cc48757 (patch)
tree7b030f03b0cc5e804c86c47ef448af064b6713ea /lib
parentfc0b277ee27cea17ebe8625d2a6428b3d5f894b2 (diff)
[profile] Add llvm_gcov_flush to be called outside a shared library
__gcov_flush is hidden. For applications to dump profiling data of selected .so files, they can use dlsym to find and call llvm_gcov_flush in each .so file. Differential Revision: https://reviews.llvm.org/D45454 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/profile/GCDAProfiling.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index bb70ff0cf..68a0cab66 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -527,6 +527,10 @@ void llvm_register_flush_function(flush_fn fn) {
}
}
+// __gcov_flush is hidden. When called in a .so file,
+// it dumps profile data of the calling .so file.
+// If a main program needs to dump profile data of each linked
+// .so files, it should use dlsym to find and call llvm_gcov_flush.
COMPILER_RT_VISIBILITY
void __gcov_flush() {
struct flush_fn_node *curr = flush_fn_head;
@@ -537,6 +541,12 @@ void __gcov_flush() {
}
}
+// llvm_gcov_flush is not hidden for a program to use dlsym to
+// find and call for any linked .so file.
+void llvm_gcov_flush() {
+ __gcov_flush();
+}
+
COMPILER_RT_VISIBILITY
void llvm_delete_flush_function_list(void) {
while (flush_fn_head) {