diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch new file mode 100644 index 0000000000..abf1f8491f --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch | |||
@@ -0,0 +1,99 @@ | |||
1 | From 9c0c73ee48dbee2aad57f4dcdad1b7b74e77b944 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 7 Dec 2015 23:41:45 +0000 | ||
4 | Subject: [PATCH] Search target sysroot gcc version specific dirs with | ||
5 | multilib. | ||
6 | |||
7 | We install the gcc libraries (such as crtbegin.p) into | ||
8 | <sysroot><libdir>/<target-sys>/5.2.0/ | ||
9 | which is a default search path for GCC (aka multi_suffix in the | ||
10 | code below). <target-sys> is 'machine' in gcc's terminology. We use | ||
11 | these directories so that multiple gcc versions could in theory | ||
12 | co-exist on target. | ||
13 | |||
14 | We only want to build one gcc-cross-canadian per arch and have this work | ||
15 | for all multilibs. <target-sys> can be handled by mapping the multilib | ||
16 | <target-sys> to the one used by gcc-cross-canadian, e.g. | ||
17 | mips64-polkmllib32-linux | ||
18 | is symlinked to by mips64-poky-linux. | ||
19 | |||
20 | The default gcc search path in the target sysroot for a "lib64" mutlilib | ||
21 | is: | ||
22 | |||
23 | <sysroot>/lib32/mips64-poky-linux/5.2.0/ | ||
24 | <sysroot>/lib32/../lib64/ | ||
25 | <sysroot>/usr/lib32/mips64-poky-linux/5.2.0/ | ||
26 | <sysroot>/usr/lib32/../lib64/ | ||
27 | <sysroot>/lib32/ | ||
28 | <sysroot>/usr/lib32/ | ||
29 | |||
30 | which means that the lib32 crtbegin.o will be found and the lib64 ones | ||
31 | will not which leads to compiler failures. | ||
32 | |||
33 | This patch injects a multilib version of that path first so the lib64 | ||
34 | binaries can be found first. With this change the search path becomes: | ||
35 | |||
36 | <sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/ | ||
37 | <sysroot>/lib32/mips64-poky-linux/5.2.0/ | ||
38 | <sysroot>/lib32/../lib64/ | ||
39 | <sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/ | ||
40 | <sysroot>/usr/lib32/mips64-poky-linux/5.2.0/ | ||
41 | <sysroot>/usr/lib32/../lib64/ | ||
42 | <sysroot>/lib32/ | ||
43 | <sysroot>/usr/lib32/ | ||
44 | |||
45 | Upstream-Status: Pending | ||
46 | RP 2015/7/31 | ||
47 | |||
48 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
49 | --- | ||
50 | gcc/gcc.c | 29 ++++++++++++++++++++++++++++- | ||
51 | 1 file changed, 28 insertions(+), 1 deletion(-) | ||
52 | |||
53 | diff --git a/gcc/gcc.c b/gcc/gcc.c | ||
54 | index 535d5c3bb65..04647ae812d 100644 | ||
55 | --- a/gcc/gcc.c | ||
56 | +++ b/gcc/gcc.c | ||
57 | @@ -2616,7 +2616,7 @@ for_each_path (const struct path_prefix *paths, | ||
58 | if (path == NULL) | ||
59 | { | ||
60 | len = paths->max_len + extra_space + 1; | ||
61 | - len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len); | ||
62 | + len += MAX ((suffix_len + multi_os_dir_len), multiarch_len); | ||
63 | path = XNEWVEC (char, len); | ||
64 | } | ||
65 | |||
66 | @@ -2628,6 +2628,33 @@ for_each_path (const struct path_prefix *paths, | ||
67 | /* Look first in MACHINE/VERSION subdirectory. */ | ||
68 | if (!skip_multi_dir) | ||
69 | { | ||
70 | + if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir)) | ||
71 | + { | ||
72 | + const char *this_multi; | ||
73 | + size_t this_multi_len; | ||
74 | + | ||
75 | + if (pl->os_multilib) | ||
76 | + { | ||
77 | + this_multi = multi_os_dir; | ||
78 | + this_multi_len = multi_os_dir_len; | ||
79 | + } | ||
80 | + else | ||
81 | + { | ||
82 | + this_multi = multi_dir; | ||
83 | + this_multi_len = multi_dir_len; | ||
84 | + } | ||
85 | + | ||
86 | + /* Look in multilib MACHINE/VERSION subdirectory first */ | ||
87 | + if (this_multi_len) | ||
88 | + { | ||
89 | + memcpy (path + len, this_multi, this_multi_len + 1); | ||
90 | + memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1); | ||
91 | + ret = callback (path, callback_info); | ||
92 | + if (ret) | ||
93 | + break; | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | memcpy (path + len, multi_suffix, suffix_len + 1); | ||
98 | ret = callback (path, callback_info); | ||
99 | if (ret) | ||