This patch should go into google/main so that relative paths can be used with FDO.
Bootstraped without regression and verified that my benchmarks correctly used the generated profiles. Original patch to trunk included a regression test, but I noticed last week that it failed in certain test scenarios. Will investigate and push the change upstream once I resolve that. Thanks, Martin 2011-03-28 Martin Thuresson <mart...@google.com> * gcc/doc/invoke.texi: Document support for relative profile paths. * gcc/libgcov.c (gcov_exit): Support relative profile paths. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 171049) +++ gcc/doc/invoke.texi (working copy) @@ -7774,7 +7774,7 @@ Set the directory to search for the prof This option affects only the profile data generated by @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} and used by @option{-fprofile-use} and @option{-fbranch-probabilities} -and its related options. +and its related options. Both absolute and relative can be used. By default, GCC will use the current directory as @var{path}, thus the profile data file will appear in the same directory as the object file. Index: gcc/libgcov.c =================================================================== --- gcc/libgcov.c (revision 171049) +++ gcc/libgcov.c (working copy) @@ -283,8 +283,9 @@ gcov_exit (void) } } /* Update complete filename with stripped original. */ - if (!IS_DIR_SEPARATOR (*fname) && !HAS_DRIVE_SPEC(fname)) + if (prefix_length != 0 && !IS_DIR_SEPARATOR (*fname)) { + /* If prefix is given, add directory separator. */ strcpy (gi_filename_up, "/"); strcpy (gi_filename_up + 1, fname); } -- This patch is available for review at http://codereview.appspot.com/4280074