diff options
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 | " |
| 83 | SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327" | 84 | SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327" |
| 84 | SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e" | 85 | SRC_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 @@ | |||
| 1 | Search target sysroot gcc version specific dirs with multilib. | ||
| 2 | |||
| 3 | We install the gcc libraries (such as crtbegin.p) into | ||
| 4 | <sysroot><libdir>/<target-sys>/5.2.0/ | ||
| 5 | which is a default search path for GCC (aka multi_suffix in the | ||
| 6 | code below). <target-sys> is 'machine' in gcc's terminology. We use | ||
| 7 | these directories so that multiple gcc versions could in theory | ||
| 8 | co-exist on target. | ||
| 9 | |||
| 10 | We only want to build one gcc-cross-canadian per arch and have this work | ||
| 11 | for 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 | ||
| 13 | is symlinked to by mips64-poky-linux. | ||
| 14 | |||
| 15 | The 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 | |||
| 24 | which means that the lib32 crtbegin.o will be found and the lib64 ones | ||
| 25 | will not which leads to compiler failures. | ||
| 26 | |||
| 27 | This patch injects a multilib version of that path first so the lib64 | ||
| 28 | binaries 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 | |||
| 39 | Upstream-Status: Pending | ||
| 40 | RP 2015/7/31 | ||
| 41 | |||
| 42 | Index: 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 | ||
| 77 | BACKPORTS = "" | 78 | BACKPORTS = "" |
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 @@ | |||
| 1 | Search target sysroot gcc version specific dirs with multilib. | ||
| 2 | |||
| 3 | We install the gcc libraries (such as crtbegin.p) into | ||
| 4 | <sysroot><libdir>/<target-sys>/5.2.0/ | ||
| 5 | which is a default search path for GCC (aka multi_suffix in the | ||
| 6 | code below). <target-sys> is 'machine' in gcc's terminology. We use | ||
| 7 | these directories so that multiple gcc versions could in theory | ||
| 8 | co-exist on target. | ||
| 9 | |||
| 10 | We only want to build one gcc-cross-canadian per arch and have this work | ||
| 11 | for 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 | ||
| 13 | is symlinked to by mips64-poky-linux. | ||
| 14 | |||
| 15 | The 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 | |||
| 24 | which means that the lib32 crtbegin.o will be found and the lib64 ones | ||
| 25 | will not which leads to compiler failures. | ||
| 26 | |||
| 27 | This patch injects a multilib version of that path first so the lib64 | ||
| 28 | binaries 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 | |||
| 39 | Upstream-Status: Pending | ||
| 40 | RP 2015/7/31 | ||
| 41 | |||
| 42 | Index: 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) | ||
