From 54a14bcbca86c3ee6086e142652f261dbca84b00 Mon Sep 17 00:00:00 2001 From: qinzhao Date: Wed, 23 Oct 2019 18:12:39 +0000 Subject: [PATCH] 2019-10-23 qing zhao PR gcov-profile/91971 * coverage.c (coverage_init): Mangle the full path of filename when filename is a absolute path. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277344 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/coverage.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7dc6885399cc..e1a4213ddddf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-10-23 qing zhao + + PR gcov-profile/91971 + * coverage.c (coverage_init): Mangle the full path of filename when + filename is a absolute path. + 2019-10-23 Jozef Lawrynowicz * config/msp430/msp430-protos.h (msp430_has_hwmult): New. diff --git a/gcc/coverage.c b/gcc/coverage.c index 0d5138feb2b4..bcba61c9a9af 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -1229,6 +1229,14 @@ coverage_init (const char *filename) else profile_data_prefix = getpwd (); } + else + { + /* when filename is a absolute path, we also need to mangle the full + path of filename to prevent the profiling data being stored into a + different path than that specified by profile_data_prefix. */ + filename = mangle_path (filename); + len = strlen (filename); + } if (profile_data_prefix) prefix_len = strlen (profile_data_prefix); -- 2.47.2