This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 47793 - Support relative paths using -fprofile-generate (issue4434055)


On Mon, Apr 18, 2011 at 10:48 AM, Martin Thuresson <martint@google.com> wrote:
> This is slightly updated from my previous patch proposal. The test now
> correctly work if multiple tests are executed in parallell.

Forgot to mention that this patch has been bootstrapped without
regression on x86_64 and should be considered for GCC trunk.

Thanks!
Martin

>
> 2011-04-17 ?Martin Thuresson ?<martint@google.com>
>
> ? ? ? ?* gcc/doc/invoke.tex: Document support for relative profile paths.
> ? ? ? ?* gcc/testsuite/gcc.dg/pr47793.c: New test.
> ? ? ? ?* gcc/libgcov.c (gcov_exit): Support relative profile paths.
>
> Index: gcc/doc/invoke.texi
> ===================================================================
> --- gcc/doc/invoke.texi (revision 172439)
> +++ gcc/doc/invoke.texi (working copy)
> @@ -7751,7 +7751,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 paths 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/testsuite/gcc.dg/pr47793.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/pr47793.c ? ? ?(revision 0)
> +++ gcc/testsuite/gcc.dg/pr47793.c ? ? ?(revision 0)
> @@ -0,0 +1,12 @@
> +/* Bug pr47793: Allow relative paths in profile-generate. ?*/
> +/* { dg-do run } */
> +/* { dg-options "-O -fprofile-generate=./" } */
> +/* { dg-final { scan-file pr47793.gcda "."} } */
> +
> +int
> +main(void)
> +{
> + ?return 0;
> +}
> +
> +/* { dg-final { cleanup-coverage-files } } */
> Index: gcc/libgcov.c
> ===================================================================
> --- gcc/libgcov.c ? ? ? (revision 172439)
> +++ 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/4434055
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]