manpagez: man pages & more
info gcc
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.5 Data file relocation to support cross-profiling

Running the program will cause profile output to be generated. For each source file compiled with ‘-fprofile-arcs’, an accompanying ‘.gcda’ 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.

To support cross-profiling, a program compiled with ‘-fprofile-arcs’ can relocate the data files based on two environment variables:

For example, if the object file ‘/user/build/foo.o’ was built with ‘-fprofile-arcs’, the final executable will try to create the data file ‘/user/build/foo.gcda’ 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 ‘GCOV_PREFIX=/target/run’ and ‘GCOV_PREFIX_STRIP=1’. Such a setting will name the data file ‘/target/run/build/foo.gcda’.

You must move the data files to the expected directory tree in order to use them for profile directed optimizations (‘--use-profile’), or to use the gcov tool.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on October 19, 2013 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.