diff options
Diffstat (limited to 'devdocs/gcc~13/cross-profiling.html')
| -rw-r--r-- | devdocs/gcc~13/cross-profiling.html | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/devdocs/gcc~13/cross-profiling.html b/devdocs/gcc~13/cross-profiling.html new file mode 100644 index 00000000..65b432f6 --- /dev/null +++ b/devdocs/gcc~13/cross-profiling.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Cross-profiling"> <div class="nav-panel"> <p> Next: <a href="freestanding-environments" accesskey="n" rel="next">Profiling and Test Coverage in Freestanding Environments</a>, Previous: <a href="gcov-data-files" accesskey="p" rel="prev">Brief Description of <code class="command">gcov</code> Data Files</a>, Up: <a href="gcov" accesskey="u" rel="up"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Data-File-Relocation-to-Support-Cross-Profiling"><span>10.5 Data File Relocation to Support Cross-Profiling<a class="copiable-link" href="#Data-File-Relocation-to-Support-Cross-Profiling"> ¶</a></span></h1> <p>Running the program will cause profile output to be generated. For each source file compiled with <samp class="option">-fprofile-arcs</samp>, an accompanying <samp class="file">.gcda</samp> file will be placed in the object file directory. That implicitly requires running the program on the same system as it was built or having the same absolute directory structure on the target system. The program will try to create the needed directory structure, if it is not already present. </p> <p>To support cross-profiling, a program compiled with <samp class="option">-fprofile-arcs</samp> can relocate the data files based on two environment variables: </p> <ul class="itemize mark-bullet"> <li>GCOV_PREFIX contains the prefix to add to the absolute paths in the object file. Prefix can be absolute, or relative. The default is no prefix. </li> +<li>GCOV_PREFIX_STRIP indicates the how many initial directory names to strip off the hardwired absolute paths. Default value is 0. <p><em class="emph">Note:</em> If GCOV_PREFIX_STRIP is set without GCOV_PREFIX is undefined, then a relative path is made out of the hardwired absolute paths. </p> +</li> +</ul> <p>For example, if the object file <samp class="file">/user/build/foo.o</samp> was built with <samp class="option">-fprofile-arcs</samp>, the final executable will try to create the data file <samp class="file">/user/build/foo.gcda</samp> when running on the target system. This will fail if the corresponding directory does not exist and it is unable to create it. This can be overcome by, for example, setting the environment as ‘<samp class="samp">GCOV_PREFIX=/target/run</samp>’ and ‘<samp class="samp">GCOV_PREFIX_STRIP=1</samp>’. Such a setting will name the data file <samp class="file">/target/run/build/foo.gcda</samp>. </p> <p>You must move the data files to the expected directory tree in order to use them for profile directed optimizations (<samp class="option">-fprofile-use</samp>), or to use the <code class="command">gcov</code> tool. </p> </div> <div class="nav-panel"> <p> Next: <a href="freestanding-environments">Profiling and Test Coverage in Freestanding Environments</a>, Previous: <a href="gcov-data-files">Brief Description of <code class="command">gcov</code> Data Files</a>, Up: <a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Cross-profiling.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Cross-profiling.html</a> + </p> +</div> |
