]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Respect -fprofile-prefix-map for getcwd in .gcno files
authorFangrui Song <maskray@gcc.gnu.org>
Wed, 1 Jan 2025 00:32:07 +0000 (16:32 -0800)
committerFangrui Song <maskray@gcc.gnu.org>
Mon, 6 Jan 2025 17:16:03 +0000 (09:16 -0800)
so that
`gcc -c a.cc --coverage -fprofile-prefix-map=$PWD=.`
does not emit $PWD in the generated a.gcno file.

gcc/ChangeLog:

PR gcov-profile/96092
* coverage.cc (coverage_init): Remap getpwd().

gcc/coverage.cc

index 20f26359e10ddc5604e0802be2d41f5f2c920281..7181e7573594e973c92409de2e49847f27333168 100644 (file)
@@ -1341,7 +1341,7 @@ coverage_init (const char *filename)
          gcov_write_unsigned (bbg_file_stamp);
          /* Use an arbitrary checksum */
          gcov_write_unsigned (0);
-         gcov_write_string (getpwd ());
+         gcov_write_string (remap_profile_filename (getpwd ()));
 
          /* Do not support has_unexecuted_blocks for Ada.  */
          gcov_write_unsigned (strcmp (lang_hooks.name, "GNU Ada") != 0);