mirror of
https://git.yoctoproject.org/poky
synced 2026-04-04 05:02:21 +02:00
gcc-5.3/gcc-4.9: -fdebug-prefix-map support to remap relative path
For relative path in DWARF, -fdebug-prefix-map could not remap it, so translate to real path before mapping. [YOCTO #9305] (From OE-Core rev: e50d23c30cd8259941b25e336b11cd96e4f6cd31) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9e20f94c77
commit
326fc2916e
@@ -89,6 +89,7 @@ SRC_URI = "\
|
||||
file://0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch \
|
||||
file://0072-support-ffile-prefix-map.patch \
|
||||
file://0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \
|
||||
file://0074-fdebug-prefix-map-support-to-remap-relative-path.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327"
|
||||
SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 289ad2969a5966c603bf6928ce442db74c4cbb25 Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Thu, 24 Mar 2016 11:23:14 -0400
|
||||
Subject: [PATCH] gcc/final.c: -fdebug-prefix-map support to remap sources with
|
||||
relative path
|
||||
|
||||
PR other/70428
|
||||
* final.c (remap_debug_filename): Use lrealpath to translate
|
||||
relative path before remapping
|
||||
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428
|
||||
Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
diff --git a/gcc/final.c b/gcc/final.c
|
||||
index 55cf509..c3594c2 100644
|
||||
--- a/gcc/final.c
|
||||
+++ b/gcc/final.c
|
||||
@@ -1554,16 +1554,25 @@ remap_debug_filename (const char *filename)
|
||||
const char *name;
|
||||
size_t name_len;
|
||||
|
||||
+ /* Support to remap filename with relative path */
|
||||
+ char *realpath = lrealpath (filename);
|
||||
+ if (realpath == NULL)
|
||||
+ return filename;
|
||||
+
|
||||
for (map = debug_prefix_maps; map; map = map->next)
|
||||
- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
|
||||
+ if (filename_ncmp (realpath, map->old_prefix, map->old_len) == 0)
|
||||
break;
|
||||
if (!map)
|
||||
- return filename;
|
||||
- name = filename + map->old_len;
|
||||
+ {
|
||||
+ free (realpath);
|
||||
+ return filename;
|
||||
+ }
|
||||
+ name = realpath + map->old_len;
|
||||
name_len = strlen (name) + 1;
|
||||
s = (char *) alloca (name_len + map->new_len);
|
||||
memcpy (s, map->new_prefix, map->new_len);
|
||||
memcpy (s + map->new_len, name, name_len);
|
||||
+ free (realpath);
|
||||
return ggc_strdup (s);
|
||||
}
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -87,6 +87,7 @@ SRC_URI = "\
|
||||
file://0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \
|
||||
file://0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch \
|
||||
file://0057-unwind-fix-for-musl.patch \
|
||||
file://0058-fdebug-prefix-map-support-to-remap-relative-path.patch \
|
||||
"
|
||||
|
||||
BACKPORTS = ""
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 289ad2969a5966c603bf6928ce442db74c4cbb25 Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Thu, 24 Mar 2016 11:23:14 -0400
|
||||
Subject: [PATCH] gcc/final.c: -fdebug-prefix-map support to remap sources with
|
||||
relative path
|
||||
|
||||
PR other/70428
|
||||
* final.c (remap_debug_filename): Use lrealpath to translate
|
||||
relative path before remapping
|
||||
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428
|
||||
Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
diff --git a/gcc/final.c b/gcc/final.c
|
||||
index 55cf509..c3594c2 100644
|
||||
--- a/gcc/final.c
|
||||
+++ b/gcc/final.c
|
||||
@@ -1554,16 +1554,25 @@ remap_debug_filename (const char *filename)
|
||||
const char *name;
|
||||
size_t name_len;
|
||||
|
||||
+ /* Support to remap filename with relative path */
|
||||
+ char *realpath = lrealpath (filename);
|
||||
+ if (realpath == NULL)
|
||||
+ return filename;
|
||||
+
|
||||
for (map = debug_prefix_maps; map; map = map->next)
|
||||
- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
|
||||
+ if (filename_ncmp (realpath, map->old_prefix, map->old_len) == 0)
|
||||
break;
|
||||
if (!map)
|
||||
- return filename;
|
||||
- name = filename + map->old_len;
|
||||
+ {
|
||||
+ free (realpath);
|
||||
+ return filename;
|
||||
+ }
|
||||
+ name = realpath + map->old_len;
|
||||
name_len = strlen (name) + 1;
|
||||
s = (char *) alloca (name_len + map->new_len);
|
||||
memcpy (s, map->new_prefix, map->new_len);
|
||||
memcpy (s + map->new_len, name, name_len);
|
||||
+ free (realpath);
|
||||
return ggc_strdup (s);
|
||||
}
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
||||
Reference in New Issue
Block a user