You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/03/09 23:24:20 UTC

[2/4] incubator-kudu git commit: Fix gcov weak symbol declaration on OS X

Fix gcov weak symbol declaration on OS X

OS X's weak symbol semantics are different than Linux, so we have to jump
through some preprocessor hoops to get the gcov symbols to work correctly.

Change-Id: I03be748427c9a811ae8fbcb208b077be8a8d9db6
Reviewed-on: http://gerrit.cloudera.org:8080/2494
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/c3125591
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/c3125591
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/c3125591

Branch: refs/heads/master
Commit: c3125591086996226971ceebaaa8dbfd77ac8681
Parents: 5f2f40d
Author: Dan Burkert <da...@cloudera.com>
Authored: Tue Mar 8 16:28:56 2016 -0800
Committer: Dan Burkert <da...@cloudera.com>
Committed: Wed Mar 9 02:09:39 2016 +0000

----------------------------------------------------------------------
 src/kudu/util/debug-util.cc | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/c3125591/src/kudu/util/debug-util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug-util.cc b/src/kudu/util/debug-util.cc
index 3adfdd0..61866cc 100644
--- a/src/kudu/util/debug-util.cc
+++ b/src/kudu/util/debug-util.cc
@@ -39,10 +39,19 @@ typedef sig_t sighandler_t;
 
 // In coverage builds, this symbol will be defined and allows us to flush coverage info
 // to disk before exiting.
+#if defined(__APPLE__)
+  // OS X does not support weak linking at compile time properly.
+  #if defined(COVERAGE_BUILD)
+extern "C" void __gcov_flush() __attribute__((weak_import));
+  #else
+extern "C" void (*__gcov_flush)() = nullptr;
+  #endif
+#else
 extern "C" {
 __attribute__((weak))
 void __gcov_flush();
 }
+#endif
 
 // Evil hack to grab a few useful functions from glog
 namespace google {