https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83200
Bug ID: 83200 Summary: Unable to manipulate (prefix, strip) coverage/profile data file (.gcda) paths at compile time Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: kevin.worth at hpe dot com CC: marxin at gcc dot gnu.org Target Milestone: --- Created attachment 42739 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42739&action=edit Patch to add options -fprofile-dir-prefix, -fprofile-dir-strip Using the run-time environment variables GCOV_PREFIX and GCOV_PREFIX_STRIP is not always practical, e.g. profiling a large number of components in a system, especially things like system daemons that are launched with their own environment. Utilizing similar logic to the parsing of those variables at compile-time allows for path manipulation independent of the run-time modifications. This is particularly useful in order to get the current working directory at the time of compilation, which in complex build systems may be hard to reproduce statically with an -fprofile-dir parameter. The attached patch has been tested (and is being used) against gcc-5.3.0 and cleanly ports to current trunk/master (though is presently unused/untested) and seems to help address this issue for my uses.