diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2016-03-28 04:18:46 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-30 12:01:29 +0100 |
commit | 326fc2916eacfbd5ae2508cdcf7cb486d16cb861 (patch) | |
tree | f0e4520ef041cc61cfed32dd03e50a5e99befb8c /meta | |
parent | 9e20f94c770df22cd7b2ea6cd663d4941e60064f (diff) | |
download | poky-326fc2916eacfbd5ae2508cdcf7cb486d16cb861.tar.gz |
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>
Diffstat (limited to 'meta')
4 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.9.inc b/meta/recipes-devtools/gcc/gcc-4.9.inc index 87aa7dade7..7e03f3121a 100644 --- a/meta/recipes-devtools/gcc/gcc-4.9.inc +++ b/meta/recipes-devtools/gcc/gcc-4.9.inc | |||
@@ -89,6 +89,7 @@ SRC_URI = "\ | |||
89 | file://0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch \ | 89 | file://0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch \ |
90 | file://0072-support-ffile-prefix-map.patch \ | 90 | file://0072-support-ffile-prefix-map.patch \ |
91 | file://0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \ | 91 | file://0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \ |
92 | file://0074-fdebug-prefix-map-support-to-remap-relative-path.patch \ | ||
92 | " | 93 | " |
93 | SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327" | 94 | SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327" |
94 | SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e" | 95 | SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e" |
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0074-fdebug-prefix-map-support-to-remap-relative-path.patch b/meta/recipes-devtools/gcc/gcc-4.9/0074-fdebug-prefix-map-support-to-remap-relative-path.patch new file mode 100644 index 0000000000..0b91fdbbcf --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.9/0074-fdebug-prefix-map-support-to-remap-relative-path.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From 289ad2969a5966c603bf6928ce442db74c4cbb25 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 24 Mar 2016 11:23:14 -0400 | ||
4 | Subject: [PATCH] gcc/final.c: -fdebug-prefix-map support to remap sources with | ||
5 | relative path | ||
6 | |||
7 | PR other/70428 | ||
8 | * final.c (remap_debug_filename): Use lrealpath to translate | ||
9 | relative path before remapping | ||
10 | |||
11 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428 | ||
12 | Upstream-Status: Submitted [gcc-patches@gcc.gnu.org] | ||
13 | |||
14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
15 | --- | ||
16 | diff --git a/gcc/final.c b/gcc/final.c | ||
17 | index 55cf509..c3594c2 100644 | ||
18 | --- a/gcc/final.c | ||
19 | +++ b/gcc/final.c | ||
20 | @@ -1554,16 +1554,25 @@ remap_debug_filename (const char *filename) | ||
21 | const char *name; | ||
22 | size_t name_len; | ||
23 | |||
24 | + /* Support to remap filename with relative path */ | ||
25 | + char *realpath = lrealpath (filename); | ||
26 | + if (realpath == NULL) | ||
27 | + return filename; | ||
28 | + | ||
29 | for (map = debug_prefix_maps; map; map = map->next) | ||
30 | - if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) | ||
31 | + if (filename_ncmp (realpath, map->old_prefix, map->old_len) == 0) | ||
32 | break; | ||
33 | if (!map) | ||
34 | - return filename; | ||
35 | - name = filename + map->old_len; | ||
36 | + { | ||
37 | + free (realpath); | ||
38 | + return filename; | ||
39 | + } | ||
40 | + name = realpath + map->old_len; | ||
41 | name_len = strlen (name) + 1; | ||
42 | s = (char *) alloca (name_len + map->new_len); | ||
43 | memcpy (s, map->new_prefix, map->new_len); | ||
44 | memcpy (s + map->new_len, name, name_len); | ||
45 | + free (realpath); | ||
46 | return ggc_strdup (s); | ||
47 | } | ||
48 | |||
49 | -- | ||
50 | 2.7.4 | ||
51 | |||
diff --git a/meta/recipes-devtools/gcc/gcc-5.3.inc b/meta/recipes-devtools/gcc/gcc-5.3.inc index 4adafd50fe..9808be1135 100644 --- a/meta/recipes-devtools/gcc/gcc-5.3.inc +++ b/meta/recipes-devtools/gcc/gcc-5.3.inc | |||
@@ -87,6 +87,7 @@ SRC_URI = "\ | |||
87 | file://0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \ | 87 | file://0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \ |
88 | file://0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch \ | 88 | file://0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch \ |
89 | file://0057-unwind-fix-for-musl.patch \ | 89 | file://0057-unwind-fix-for-musl.patch \ |
90 | file://0058-fdebug-prefix-map-support-to-remap-relative-path.patch \ | ||
90 | " | 91 | " |
91 | 92 | ||
92 | BACKPORTS = "" | 93 | BACKPORTS = "" |
diff --git a/meta/recipes-devtools/gcc/gcc-5.3/0058-fdebug-prefix-map-support-to-remap-relative-path.patch b/meta/recipes-devtools/gcc/gcc-5.3/0058-fdebug-prefix-map-support-to-remap-relative-path.patch new file mode 100644 index 0000000000..0b91fdbbcf --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-5.3/0058-fdebug-prefix-map-support-to-remap-relative-path.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From 289ad2969a5966c603bf6928ce442db74c4cbb25 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 24 Mar 2016 11:23:14 -0400 | ||
4 | Subject: [PATCH] gcc/final.c: -fdebug-prefix-map support to remap sources with | ||
5 | relative path | ||
6 | |||
7 | PR other/70428 | ||
8 | * final.c (remap_debug_filename): Use lrealpath to translate | ||
9 | relative path before remapping | ||
10 | |||
11 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428 | ||
12 | Upstream-Status: Submitted [gcc-patches@gcc.gnu.org] | ||
13 | |||
14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
15 | --- | ||
16 | diff --git a/gcc/final.c b/gcc/final.c | ||
17 | index 55cf509..c3594c2 100644 | ||
18 | --- a/gcc/final.c | ||
19 | +++ b/gcc/final.c | ||
20 | @@ -1554,16 +1554,25 @@ remap_debug_filename (const char *filename) | ||
21 | const char *name; | ||
22 | size_t name_len; | ||
23 | |||
24 | + /* Support to remap filename with relative path */ | ||
25 | + char *realpath = lrealpath (filename); | ||
26 | + if (realpath == NULL) | ||
27 | + return filename; | ||
28 | + | ||
29 | for (map = debug_prefix_maps; map; map = map->next) | ||
30 | - if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) | ||
31 | + if (filename_ncmp (realpath, map->old_prefix, map->old_len) == 0) | ||
32 | break; | ||
33 | if (!map) | ||
34 | - return filename; | ||
35 | - name = filename + map->old_len; | ||
36 | + { | ||
37 | + free (realpath); | ||
38 | + return filename; | ||
39 | + } | ||
40 | + name = realpath + map->old_len; | ||
41 | name_len = strlen (name) + 1; | ||
42 | s = (char *) alloca (name_len + map->new_len); | ||
43 | memcpy (s, map->new_prefix, map->new_len); | ||
44 | memcpy (s + map->new_len, name, name_len); | ||
45 | + free (realpath); | ||
46 | return ggc_strdup (s); | ||
47 | } | ||
48 | |||
49 | -- | ||
50 | 2.7.4 | ||
51 | |||