From: Martin Thuresson <martint@google.com>
To: "kai.tietz@onevision.com" <kai.tietz@onevision.com>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: PR 47793 - Support relative paths using -fprofile-generate
Date: Wed, 23 Feb 2011 18:33:00 -0000 [thread overview]
Message-ID: <AANLkTi=B8wq3uxBP3Kzk3jGw6Rn=jAjf6oAhFG_jqxj8@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimkRXMEH5QzVpcaxNZMaK=CE-w7tAXF=1yxQxNZ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 596 bytes --]
Change 165596 and 168475 updated the code for handling gcda-paths. As
part of this change, relative paths stopped working.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
This patch adds a guard so that "/" is not added when no prefix is
given.
The added testcase uses the path "../gcc/". This puts the gcda in the
same directory, so that the cleanup-coverage-files will find them.
I have tested the patch using "make bootstrap; make -k check" with
target x86_64-unknown-linux-gnu and saw no additional test failures.
Let me know if there is any other testing I should do.
Thanks,
Martin
[-- Attachment #2: foo.patch --]
[-- Type: text/x-patch, Size: 1800 bytes --]
diff -uprN /gcc/trunk/gcc/doc/invoke.texi gcc/doc/invoke.texi
--- /gcc/trunk/gcc/doc/invoke.texi 2011-02-09 02:01:59.000000000 -0800
+++ gcc/doc/invoke.texi 2011-02-22 09:32:41.000000000 -0800
@@ -7733,7 +7733,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 are supported.
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.
diff -uprN /gcc/trunk/gcc/libgcov.c gcc/libgcov.c
--- /gcc/trunk/gcc/libgcov.c 2011-01-05 01:30:09.000000000 -0800
+++ gcc/libgcov.c 2011-02-23 08:51:35.000000000 -0800
@@ -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);
}
diff -uprN /gcc/trunk/gcc/testsuite/gcc.dg/pr47793.c gcc/testsuite/gcc.dg/pr47793.c
--- /gcc/trunk/gcc/testsuite/gcc.dg/pr47793.c 1969-12-31 16:00:00.000000000 -0800
+++ gcc/testsuite/gcc.dg/pr47793.c 2011-02-23 08:51:54.000000000 -0800
@@ -0,0 +1,12 @@
+/* Bug pr47793: Allow relative paths in profile-generate. */
+/* { dg-do run } */
+/* { dg-options "-O -fprofile-generate=../gcc/" } */
+/* { dg-final { scan-file pr47793.gcda "."} } */
+
+int
+main(void)
+{
+ return 0;
+}
+
+/* { dg-final { cleanup-coverage-files } } */
next parent reply other threads:[~2011-02-23 18:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTimkRXMEH5QzVpcaxNZMaK=CE-w7tAXF=1yxQxNZ@mail.gmail.com>
2011-02-23 18:33 ` Martin Thuresson [this message]
2011-02-24 0:56 ` Martin Thuresson
2011-03-01 22:08 ` Martin Thuresson
2011-03-07 19:54 ` Diego Novillo
2011-03-08 5:25 ` Martin Thuresson
2011-05-04 23:53 ` Xinliang David Li
2011-05-06 18:06 ` Xinliang David Li
2011-05-13 9:08 ` Jan Hubicka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTi=B8wq3uxBP3Kzk3jGw6Rn=jAjf6oAhFG_jqxj8@mail.gmail.com' \
--to=martint@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kai.tietz@onevision.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).