]> granicus.if.org Git - clang/commitdiff
[docs] Coverage: Explain how to avoid static initializers
authorVedant Kumar <vsk@apple.com>
Tue, 7 Jun 2016 22:25:29 +0000 (22:25 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 7 Jun 2016 22:25:29 +0000 (22:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272067 91177308-0d34-0410-b5e6-96231b3b80d8

docs/SourceBasedCodeCoverage.rst

index 75ab258e8fc7fc5b4f3b9fa576a6c4c120f88520..22420d97cd93e9b3445d7b9c4f0cd5d595eac10f 100644 (file)
@@ -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
 =========================