summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-31 11:26:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-01 07:34:04 +0100
commitc4e40a48fbb5888567c974c0326d8a2cbc2188f0 (patch)
treeeb36dc24bf5e45134738b3d9c77f35fe20adf144 /meta/recipes-devtools/gcc
parenta95a14afedd8954cf52fb2505712ced7f031e87a (diff)
downloadpoky-c4e40a48fbb5888567c974c0326d8a2cbc2188f0.tar.gz
gcc: Add patch to handle on target multilibs better
On target multilibs did not work properly since gcc-cross-canadian was only searching a limited number of sysroot directories to find multilib target binaries. This adds an extra search path to ensure those binaries are found and our gcc-cross-canadian works everywhere we need it to, e.g. with mips trilib configurations. (From OE-Core rev: b928d92bb9f76c118846d6c495dc57c149368f0f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch88
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.2.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.2/0041-handle-target-sysroot-multilib.patch88
4 files changed, 178 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.9.inc b/meta/recipes-devtools/gcc/gcc-4.9.inc
index 7a3e4ebd6a..691ba5fbc2 100644
--- a/meta/recipes-devtools/gcc/gcc-4.9.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.9.inc
@@ -79,6 +79,7 @@ SRC_URI = "\
79 file://0061-target-gcc-includedir.patch \ 79 file://0061-target-gcc-includedir.patch \
80 file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \ 80 file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
81 file://0063-nativesdk-gcc-support.patch \ 81 file://0063-nativesdk-gcc-support.patch \
82 file://0064-handle-target-sysroot-multilib.patch \
82" 83"
83SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327" 84SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327"
84SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e" 85SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch b/meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch
new file mode 100644
index 0000000000..53569847f2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch
@@ -0,0 +1,88 @@
1Search target sysroot gcc version specific dirs with multilib.
2
3We install the gcc libraries (such as crtbegin.p) into
4<sysroot><libdir>/<target-sys>/5.2.0/
5which is a default search path for GCC (aka multi_suffix in the
6code below). <target-sys> is 'machine' in gcc's terminology. We use
7these directories so that multiple gcc versions could in theory
8co-exist on target.
9
10We only want to build one gcc-cross-canadian per arch and have this work
11for all multilibs. <target-sys> can be handled by mapping the multilib
12<target-sys> to the one used by gcc-cross-canadian, e.g. mips64-polkmllib32-linux
13is symlinked to by mips64-poky-linux.
14
15The default gcc search path in the target sysroot for a "lib64" mutlilib is:
16
17<sysroot>/lib32/mips64-poky-linux/5.2.0/
18<sysroot>/lib32/../lib64/
19<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
20<sysroot>/usr/lib32/../lib64/
21<sysroot>/lib32/
22<sysroot>/usr/lib32/
23
24which means that the lib32 crtbegin.o will be found and the lib64 ones
25will not which leads to compiler failures.
26
27This patch injects a multilib version of that path first so the lib64
28binaries can be found first. With this change the search path becomes:
29
30<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
31<sysroot>/lib32/mips64-poky-linux/5.2.0/
32<sysroot>/lib32/../lib64/
33<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
34<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
35<sysroot>/usr/lib32/../lib64/
36<sysroot>/lib32/
37<sysroot>/usr/lib32/
38
39Upstream-Status: Pending
40RP 2015/7/31
41
42Index: gcc-5.2.0/gcc/gcc.c
43===================================================================
44--- gcc-5.2.0.orig/gcc/gcc.c
45+++ gcc-5.2.0/gcc/gcc.c
46@@ -2305,7 +2305,7 @@ for_each_path (const struct path_prefix
47 if (path == NULL)
48 {
49 len = paths->max_len + extra_space + 1;
50- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
51+ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
52 path = XNEWVEC (char, len);
53 }
54
55@@ -2317,6 +2317,33 @@ for_each_path (const struct path_prefix
56 /* Look first in MACHINE/VERSION subdirectory. */
57 if (!skip_multi_dir)
58 {
59+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
60+ {
61+ const char *this_multi;
62+ size_t this_multi_len;
63+
64+ if (pl->os_multilib)
65+ {
66+ this_multi = multi_os_dir;
67+ this_multi_len = multi_os_dir_len;
68+ }
69+ else
70+ {
71+ this_multi = multi_dir;
72+ this_multi_len = multi_dir_len;
73+ }
74+
75+ /* Look in multilib MACHINE/VERSION subdirectory first */
76+ if (this_multi_len)
77+ {
78+ memcpy (path + len, this_multi, this_multi_len + 1);
79+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
80+ ret = callback (path, callback_info);
81+ if (ret)
82+ break;
83+ }
84+ }
85+
86 memcpy (path + len, multi_suffix, suffix_len + 1);
87 ret = callback (path, callback_info);
88 if (ret)
diff --git a/meta/recipes-devtools/gcc/gcc-5.2.inc b/meta/recipes-devtools/gcc/gcc-5.2.inc
index 1a1ed4ccdc..f691f582d7 100644
--- a/meta/recipes-devtools/gcc/gcc-5.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-5.2.inc
@@ -72,6 +72,7 @@ SRC_URI = "\
72 file://0038-fix-g++-sysroot.patch \ 72 file://0038-fix-g++-sysroot.patch \
73 file://0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch \ 73 file://0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
74 file://0040-nativesdk-gcc-support.patch \ 74 file://0040-nativesdk-gcc-support.patch \
75 file://0041-handle-target-sysroot-multilib.patch \
75 " 76 "
76 77
77BACKPORTS = "" 78BACKPORTS = ""
diff --git a/meta/recipes-devtools/gcc/gcc-5.2/0041-handle-target-sysroot-multilib.patch b/meta/recipes-devtools/gcc/gcc-5.2/0041-handle-target-sysroot-multilib.patch
new file mode 100644
index 0000000000..53569847f2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.2/0041-handle-target-sysroot-multilib.patch
@@ -0,0 +1,88 @@
1Search target sysroot gcc version specific dirs with multilib.
2
3We install the gcc libraries (such as crtbegin.p) into
4<sysroot><libdir>/<target-sys>/5.2.0/
5which is a default search path for GCC (aka multi_suffix in the
6code below). <target-sys> is 'machine' in gcc's terminology. We use
7these directories so that multiple gcc versions could in theory
8co-exist on target.
9
10We only want to build one gcc-cross-canadian per arch and have this work
11for all multilibs. <target-sys> can be handled by mapping the multilib
12<target-sys> to the one used by gcc-cross-canadian, e.g. mips64-polkmllib32-linux
13is symlinked to by mips64-poky-linux.
14
15The default gcc search path in the target sysroot for a "lib64" mutlilib is:
16
17<sysroot>/lib32/mips64-poky-linux/5.2.0/
18<sysroot>/lib32/../lib64/
19<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
20<sysroot>/usr/lib32/../lib64/
21<sysroot>/lib32/
22<sysroot>/usr/lib32/
23
24which means that the lib32 crtbegin.o will be found and the lib64 ones
25will not which leads to compiler failures.
26
27This patch injects a multilib version of that path first so the lib64
28binaries can be found first. With this change the search path becomes:
29
30<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
31<sysroot>/lib32/mips64-poky-linux/5.2.0/
32<sysroot>/lib32/../lib64/
33<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
34<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
35<sysroot>/usr/lib32/../lib64/
36<sysroot>/lib32/
37<sysroot>/usr/lib32/
38
39Upstream-Status: Pending
40RP 2015/7/31
41
42Index: gcc-5.2.0/gcc/gcc.c
43===================================================================
44--- gcc-5.2.0.orig/gcc/gcc.c
45+++ gcc-5.2.0/gcc/gcc.c
46@@ -2305,7 +2305,7 @@ for_each_path (const struct path_prefix
47 if (path == NULL)
48 {
49 len = paths->max_len + extra_space + 1;
50- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
51+ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
52 path = XNEWVEC (char, len);
53 }
54
55@@ -2317,6 +2317,33 @@ for_each_path (const struct path_prefix
56 /* Look first in MACHINE/VERSION subdirectory. */
57 if (!skip_multi_dir)
58 {
59+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
60+ {
61+ const char *this_multi;
62+ size_t this_multi_len;
63+
64+ if (pl->os_multilib)
65+ {
66+ this_multi = multi_os_dir;
67+ this_multi_len = multi_os_dir_len;
68+ }
69+ else
70+ {
71+ this_multi = multi_dir;
72+ this_multi_len = multi_dir_len;
73+ }
74+
75+ /* Look in multilib MACHINE/VERSION subdirectory first */
76+ if (this_multi_len)
77+ {
78+ memcpy (path + len, this_multi, this_multi_len + 1);
79+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
80+ ret = callback (path, callback_info);
81+ if (ret)
82+ break;
83+ }
84+ }
85+
86 memcpy (path + len, multi_suffix, suffix_len + 1);
87 ret = callback (path, callback_info);
88 if (ret)