r272067 - [docs] Coverage: Explain how to avoid static initializers

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 15:25:30 PDT 2016


Author: vedantk
Date: Tue Jun  7 17:25:29 2016
New Revision: 272067

URL: http://llvm.org/viewvc/llvm-project?rev=272067&view=rev
Log:
[docs] Coverage: Explain how to avoid static initializers

Modified:
    cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=272067&r1=272066&r2=272067&view=diff
==============================================================================
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Tue Jun  7 17:25:29 2016
@@ -185,6 +185,22 @@ Format compatibility guarantees
   into instrumented binaries. Tools must retain **backwards** compatibility
   with these formats. These formats are not forwards-compatible.
 
+Using the profiling runtime without static initializers
+=======================================================
+
+By default the compiler runtime uses a static initializer to determine the
+profile output path and to register a writer function. To collect profiles
+without using static initializers, do this manually:
+
+* Export a ``int __llvm_profile_runtime`` symbol. The linker won't pull in the
+  object file containing the profiling runtime's static initializer if this
+  symbol is defined.
+
+* Call ``__llvm_profile_initialize_file`` once. This parses
+  ``LLVM_PROFILE_FILE`` and sets the output path.
+
+* Call ``__llvm_profile_write_file`` to write out a profile.
+
 Drawbacks and limitations
 =========================
 




More information about the cfe-commits mailing list