10.5. Data File Relocation to Support Cross-Profiling

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:

  • 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.
  • GCOV_PREFIX_STRIP indicates the how many initial directory names to strip off the hardwired absolute paths. Default val