summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4.inc139
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0008-missing-execinfo_h.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0009-c99-snprintf.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0010-gcc-poison-system-directories.patch192
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0011-gcc-poison-dir-extend.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0013-64-bit-multilib-hack.patch85
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0014-optional-libstdc.patch101
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch59
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0016-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch96
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0018-fortran-cross-compile-hack.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0019-libgcc-sjlj-check.patch74
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0020-cpp-honor-sysroot.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0021-MIPS64-Default-to-N64-ABI.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0022-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch216
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0023-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0024-Disable-sdt.patch113
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0025-libtool.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0026-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0027-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0028-Avoid-using-libdir-from-.la-which-usually-points-to-.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0029-export-CPP.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0030-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch52
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0031-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0032-Ensure-target-gcc-headers-can-be-included.patch98
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0033-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0034-Don-t-search-host-directory-during-relink-if-inst_pr.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0035-Dont-link-the-plugins-with-libgomp-explicitly.patch83
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0036-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch27
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0037-aarch64-Add-support-for-musl-ldso.patch26
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0038-fix-g-sysroot.patch56
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0040-handle-sysroot-support-for-nativesdk-gcc.patch213
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0041-Search-target-sysroot-gcc-version-specific-dirs-with.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0042-Fix-various-_FOR_BUILD-and-related-variables.patch137
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0043-libstdc-Support-musl.patch44
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0044-Adding-mmusl-as-a-musl-libc-specifier-and-the-necess.patch270
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0045-Support-for-arm-linux-musl.patch216
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0048-ssp_nonshared.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch78
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0050-powerpc-pass-secure-plt-to-the-linker.patch66
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0051-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0052-nios2-use-ret-with-r31.patch103
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0053-expr.c-PR-target-65358-Avoid-clobbering-partial-argu.patch307
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0054-support-ffile-prefix-map.patch284
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch85
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0057-unwind-fix-for-musl.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0058-fdebug-prefix-map-support-to-remap-relative-path.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/0059-libgcc-use-ldflags.patch16
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.4/CVE-2016-6131.patch251
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_5.4.bb5
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_5.4.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_5.4.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_5.4.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_5.4.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_5.4.bb7
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers_5.4.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-source_5.4.bb4
-rw-r--r--meta/recipes-devtools/gcc/gcc_5.4.bb9
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial_5.4.bb2
-rw-r--r--meta/recipes-devtools/gcc/libgcc_5.4.bb2
-rw-r--r--meta/recipes-devtools/gcc/libgfortran_5.4.bb3
67 files changed, 0 insertions, 4789 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-5.4.inc b/meta/recipes-devtools/gcc/gcc-5.4.inc
deleted file mode 100644
index 3f3edfbe33..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4.inc
+++ /dev/null
@@ -1,139 +0,0 @@
1require gcc-common.inc
2
3# Third digit in PV should be incremented after a minor release
4
5PV = "5.4.0"
6
7#SNAP = "5-20150405"
8
9# BINV should be incremented to a revision after a minor gcc release
10
11BINV = "5.4.0"
12
13FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-5.4:${FILE_DIRNAME}/gcc-5.4/backport:"
14
15DEPENDS =+ "mpfr gmp libmpc zlib"
16NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
17
18LICENSE = "GPL-3.0-with-GCC-exception & GPLv3"
19
20LIC_FILES_CHKSUM = "\
21 file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
22 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
23 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
24 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
25 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
26"
27#BASEURI = "http://www.netgull.com/gcc/snapshots/${SNAP}/gcc-${SNAP}.tar.bz2"
28BASEURI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2"
29
30SRC_URI = "\
31 ${BASEURI} \
32 ${BACKPORTS} \
33 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
34 file://0008-missing-execinfo_h.patch \
35 file://0009-c99-snprintf.patch \
36 file://0010-gcc-poison-system-directories.patch \
37 file://0011-gcc-poison-dir-extend.patch \
38 file://0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
39 file://0013-64-bit-multilib-hack.patch \
40 file://0014-optional-libstdc.patch \
41 file://0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
42 file://0016-COLLECT_GCC_OPTIONS.patch \
43 file://0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
44 file://0018-fortran-cross-compile-hack.patch \
45 file://0019-libgcc-sjlj-check.patch \
46 file://0020-cpp-honor-sysroot.patch \
47 file://0021-MIPS64-Default-to-N64-ABI.patch \
48 file://0022-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
49 file://0023-gcc-Fix-argument-list-too-long-error.patch \
50 file://0024-Disable-sdt.patch \
51 file://0025-libtool.patch \
52 file://0026-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
53 file://0027-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
54 file://0028-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
55 file://0029-export-CPP.patch \
56 file://0030-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \
57 file://0031-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch \
58 file://0032-Ensure-target-gcc-headers-can-be-included.patch \
59 file://0033-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch \
60 file://0034-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
61 file://0035-Dont-link-the-plugins-with-libgomp-explicitly.patch \
62 file://0036-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
63 file://0037-aarch64-Add-support-for-musl-ldso.patch \
64 file://0038-fix-g-sysroot.patch \
65 file://0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
66 file://0040-handle-sysroot-support-for-nativesdk-gcc.patch \
67 file://0041-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
68 file://0042-Fix-various-_FOR_BUILD-and-related-variables.patch \
69 file://0043-libstdc-Support-musl.patch \
70 file://0044-Adding-mmusl-as-a-musl-libc-specifier-and-the-necess.patch \
71 file://0045-Support-for-arm-linux-musl.patch \
72 file://0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch \
73 file://0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
74 file://0048-ssp_nonshared.patch \
75 file://0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch \
76 file://0050-powerpc-pass-secure-plt-to-the-linker.patch \
77 file://0051-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch \
78 file://0052-nios2-use-ret-with-r31.patch \
79 file://0053-expr.c-PR-target-65358-Avoid-clobbering-partial-argu.patch \
80 file://0054-support-ffile-prefix-map.patch \
81 file://0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \
82 file://0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch \
83 file://0057-unwind-fix-for-musl.patch \
84 file://0058-fdebug-prefix-map-support-to-remap-relative-path.patch \
85 file://0059-libgcc-use-ldflags.patch \
86 file://CVE-2016-6131.patch \
87"
88
89BACKPORTS = ""
90
91SRC_URI[md5sum] = "4c626ac2a83ef30dfb9260e6f59c2b30"
92SRC_URI[sha256sum] = "608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a"
93
94UPSTREAM_CHECK_REGEX = "gcc-(?P<pver>5\.\d+\.\d+).tar"
95
96#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${SNAP}"
97S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
98B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
99
100# Language Overrides
101FORTRAN = ""
102JAVA = ""
103
104LTO = "--enable-lto"
105
106EXTRA_OECONF_BASE = "\
107 ${LTO} \
108 --enable-libssp \
109 --enable-libitm \
110 --disable-bootstrap \
111 --disable-libmudflap \
112 --with-system-zlib \
113 --with-linker-hash-style=${LINKER_HASH_STYLE} \
114 --enable-linker-build-id \
115 --with-ppl=no \
116 --with-cloog=no \
117 --enable-checking=release \
118 --enable-cheaders=c_global \
119 --without-isl \
120"
121
122EXTRA_OECONF_INITIAL = "\
123 --disable-libmudflap \
124 --disable-libgomp \
125 --disable-libitm \
126 --disable-libquadmath \
127 --with-system-zlib \
128 --disable-lto \
129 --disable-plugin \
130 --enable-decimal-float=no \
131 --without-isl \
132 gcc_cv_libc_provides_ssp=yes \
133"
134
135EXTRA_OECONF_PATHS = "\
136 --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
137 --with-sysroot=/not/exist \
138 --with-build-sysroot=${STAGING_DIR_TARGET} \
139"
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-5.4/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
deleted file mode 100644
index 1aead9691a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 6029bb338305a5d1403ee23427ed8d58eae1ff53 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH 01/46] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 configure | 2 +-
11 configure.ac | 2 +-
12 2 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/configure b/configure
15index a3f66ba..1cba3a9 100755
16--- a/configure
17+++ b/configure
18@@ -7464,7 +7464,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21
22-FLAGS_FOR_TARGET=
23+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
24 case " $target_configdirs " in
25 *" newlib "*)
26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac
28index 987dfab..d3adb95 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -3104,7 +3104,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34
35-FLAGS_FOR_TARGET=
36+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
37 case " $target_configdirs " in
38 *" newlib "*)
39 case " $target_configargs " in
40--
412.6.3
42
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0008-missing-execinfo_h.patch b/meta/recipes-devtools/gcc/gcc-5.4/0008-missing-execinfo_h.patch
deleted file mode 100644
index 9f8793125e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0008-missing-execinfo_h.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 9b7442069eb68a42d2437181c1b2e710dd077e8b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:48:10 +0400
4Subject: [PATCH 08/46] missing-execinfo_h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 boehm-gc/include/gc.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
14index 6b38f2d..fca98ff 100644
15--- a/boehm-gc/include/gc.h
16+++ b/boehm-gc/include/gc.h
17@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
18 #if defined(__linux__) || defined(__GLIBC__)
19 # include <features.h>
20 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
21- && !defined(__ia64__)
22+ && !defined(__ia64__) && !defined(__UCLIBC__)
23 # ifndef GC_HAVE_BUILTIN_BACKTRACE
24 # define GC_HAVE_BUILTIN_BACKTRACE
25 # endif
26--
272.6.3
28
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0009-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-5.4/0009-c99-snprintf.patch
deleted file mode 100644
index 6b236c62c0..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0009-c99-snprintf.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From fde97f80d2d931ed3fa4a86294799366b2359331 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:03 +0400
4Subject: [PATCH 09/46] c99-snprintf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/c_std/cstdio | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
14index 37f01ca..f00c06d 100644
15--- a/libstdc++-v3/include/c_std/cstdio
16+++ b/libstdc++-v3/include/c_std/cstdio
17@@ -144,7 +144,7 @@ namespace std
18 using ::vsprintf;
19 } // namespace std
20
21-#if _GLIBCXX_USE_C99
22+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
23
24 #undef snprintf
25 #undef vfscanf
26--
272.6.3
28
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0010-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-5.4/0010-gcc-poison-system-directories.patch
deleted file mode 100644
index 2da8877672..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0010-gcc-poison-system-directories.patch
+++ /dev/null
@@ -1,192 +0,0 @@
1From 7a90e62d557c78ae52006dff30c99006e10d9357 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:59:00 +0400
4Subject: [PATCH 10/46] gcc: poison-system-directories
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [distribution: codesourcery]
9---
10 gcc/common.opt | 4 ++++
11 gcc/config.in | 6 ++++++
12 gcc/configure | 16 ++++++++++++++++
13 gcc/configure.ac | 10 ++++++++++
14 gcc/doc/invoke.texi | 9 +++++++++
15 gcc/gcc.c | 2 ++
16 gcc/incpath.c | 19 +++++++++++++++++++
17 7 files changed, 66 insertions(+)
18
19diff --git a/gcc/common.opt b/gcc/common.opt
20index 1218a71..bfba114 100644
21--- a/gcc/common.opt
22+++ b/gcc/common.opt
23@@ -623,6 +623,10 @@ Wreturn-local-addr
24 Common Var(warn_return_local_addr) Init(1) Warning
25 Warn about returning a pointer/reference to a local or temporary variable.
26
27+Wpoison-system-directories
28+Common Var(flag_poison_system_directories) Init(1) Warning
29+Warn for -I and -L options using system directories if cross compiling
30+
31 Wshadow
32 Common Var(warn_shadow) Warning
33 Warn when one local variable shadows another
34diff --git a/gcc/config.in b/gcc/config.in
35index 5335258..f079826 100644
36--- a/gcc/config.in
37+++ b/gcc/config.in
38@@ -168,6 +168,12 @@
39 #endif
40
41
42+/* Define to warn for use of native system header directories */
43+#ifndef USED_FOR_TARGET
44+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
45+#endif
46+
47+
48 /* Define if you want all operations on RTL (the basic data structure of the
49 optimizer and back end) to be checked for dynamic type safety at runtime.
50 This is quite expensive. */
51diff --git a/gcc/configure b/gcc/configure
52index 3c92795..34371a3 100755
53--- a/gcc/configure
54+++ b/gcc/configure
55@@ -933,6 +933,7 @@ with_system_zlib
56 enable_maintainer_mode
57 enable_link_mutex
58 enable_version_specific_runtime_libs
59+enable_poison_system_directories
60 enable_plugin
61 enable_host_shared
62 enable_libquadmath_support
63@@ -1670,6 +1671,8 @@ Optional Features:
64 --enable-version-specific-runtime-libs
65 specify that runtime libraries should be installed
66 in a compiler-specific directory
67+ --enable-poison-system-directories
68+ warn for use of native system header directories
69 --enable-plugin enable plugin support
70 --enable-host-shared build host code as shared libraries
71 --disable-libquadmath-support
72@@ -28211,6 +28214,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
73 fi
74
75
76+# Check whether --enable-poison-system-directories was given.
77+if test "${enable_poison_system_directories+set}" = set; then :
78+ enableval=$enable_poison_system_directories;
79+else
80+ enable_poison_system_directories=no
81+fi
82+
83+if test "x${enable_poison_system_directories}" = "xyes"; then
84+
85+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
86+
87+fi
88+
89 # Substitute configuration variables
90
91
92diff --git a/gcc/configure.ac b/gcc/configure.ac
93index d414081..240d322 100644
94--- a/gcc/configure.ac
95+++ b/gcc/configure.ac
96@@ -5654,6 +5654,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
97 [specify that runtime libraries should be
98 installed in a compiler-specific directory])])
99
100+AC_ARG_ENABLE([poison-system-directories],
101+ AS_HELP_STRING([--enable-poison-system-directories],
102+ [warn for use of native system header directories]),,
103+ [enable_poison_system_directories=no])
104+if test "x${enable_poison_system_directories}" = "xyes"; then
105+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
106+ [1],
107+ [Define to warn for use of native system header directories])
108+fi
109+
110 # Substitute configuration variables
111 AC_SUBST(subdirs)
112 AC_SUBST(srcdir)
113diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
114index d3be589..c81b55b 100644
115--- a/gcc/doc/invoke.texi
116+++ b/gcc/doc/invoke.texi
117@@ -269,6 +269,7 @@ Objective-C and Objective-C++ Dialects}.
118 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
119 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
120 -Wpointer-arith -Wno-pointer-to-int-cast @gol
121+-Wno-poison-system-directories @gol
122 -Wredundant-decls -Wno-return-local-addr @gol
123 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
124 -Wshift-count-negative -Wshift-count-overflow @gol
125@@ -4433,6 +4434,14 @@ made up of data only and thus requires no special treatment. But, for
126 most targets, it is made up of code and thus requires the stack to be
127 made executable in order for the program to work properly.
128
129+@item -Wno-poison-system-directories
130+@opindex Wno-poison-system-directories
131+Do not warn for @option{-I} or @option{-L} options using system
132+directories such as @file{/usr/include} when cross compiling. This
133+option is intended for use in chroot environments when such
134+directories contain the correct headers and libraries for the target
135+system rather than the host.
136+
137 @item -Wfloat-equal
138 @opindex Wfloat-equal
139 @opindex Wno-float-equal
140diff --git a/gcc/gcc.c b/gcc/gcc.c
141index d956c36..675bcc1 100644
142--- a/gcc/gcc.c
143+++ b/gcc/gcc.c
144@@ -835,6 +835,8 @@ proper position among the other output files. */
145 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
146 "%X %{o*} %{e*} %{N} %{n} %{r}\
147 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
148+ %{Wno-poison-system-directories:--no-poison-system-directories}\
149+ %{Werror=poison-system-directories:--error-poison-system-directories}\
150 %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
151 " CHKP_SPEC " \
152 %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
153diff --git a/gcc/incpath.c b/gcc/incpath.c
154index 6c54ca6..cc0c921 100644
155--- a/gcc/incpath.c
156+++ b/gcc/incpath.c
157@@ -28,6 +28,7 @@
158 #include "intl.h"
159 #include "incpath.h"
160 #include "cppdefault.h"
161+#include "diagnostic-core.h"
162
163 /* Microsoft Windows does not natively support inodes.
164 VMS has non-numeric inodes. */
165@@ -383,6 +384,24 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
166 }
167 fprintf (stderr, _("End of search list.\n"));
168 }
169+
170+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
171+ if (flag_poison_system_directories)
172+ {
173+ struct cpp_dir *p;
174+
175+ for (p = heads[QUOTE]; p; p = p->next)
176+ {
177+ if ((!strncmp (p->name, "/usr/include", 12))
178+ || (!strncmp (p->name, "/usr/local/include", 18))
179+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
180+ warning (OPT_Wpoison_system_directories,
181+ "include location \"%s\" is unsafe for "
182+ "cross-compilation",
183+ p->name);
184+ }
185+ }
186+#endif
187 }
188
189 /* Use given -I paths for #include "..." but not #include <...>, and
190--
1912.6.3
192
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0011-gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-5.4/0011-gcc-poison-dir-extend.patch
deleted file mode 100644
index 511e69481b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0011-gcc-poison-dir-extend.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From db406054de6b0967cd76cbb998f05b0c5af0bd94 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:00:34 +0400
4Subject: [PATCH 11/46] gcc-poison-dir-extend
5
6Add /sw/include and /opt/include based on the original
7zecke-no-host-includes.patch patch. The original patch checked for
8/usr/include, /sw/include and /opt/include and then triggered a failure and
9aborted.
10
11Instead, we add the two missing items to the current scan. If the user
12wants this to be a failure, they can add "-Werror=poison-system-directories".
13
14Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Pending
18---
19 gcc/incpath.c | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/incpath.c b/gcc/incpath.c
23index cc0c921..0bc1f67 100644
24--- a/gcc/incpath.c
25+++ b/gcc/incpath.c
26@@ -394,7 +394,9 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
27 {
28 if ((!strncmp (p->name, "/usr/include", 12))
29 || (!strncmp (p->name, "/usr/local/include", 18))
30- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
31+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
32+ || (!strncmp (p->name, "/sw/include", 11))
33+ || (!strncmp (p->name, "/opt/include", 12)))
34 warning (OPT_Wpoison_system_directories,
35 "include location \"%s\" is unsafe for "
36 "cross-compilation",
37--
382.6.3
39
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-5.4/0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
deleted file mode 100644
index 750bbc8238..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,73 +0,0 @@
1From 278d293c4cee9482a23aa3443741861ff2f67212 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:08:31 +0400
4Subject: [PATCH 12/46] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
5
6Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
7
8This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
9
10Other changes I had to do include:
11
12- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
13
14- passing the right CFLAGS to configure scripts as exported environment variables
15
16I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
17
18Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
19
20Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22
23Upstream-Status: Pending
24---
25 configure | 32 ++++++++++++++++++++++++++++++++
26 1 file changed, 32 insertions(+)
27
28diff --git a/configure b/configure
29index 1cba3a9..9cae8da 100755
30--- a/configure
31+++ b/configure
32@@ -6733,6 +6733,38 @@ fi
33
34
35
36+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
37+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
38+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
39+# We want to ensure that TARGET libraries (which we know are built with
40+# gcc) are built with "-O2 -g", so include those options when setting
41+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
42+if test "x$CFLAGS_FOR_TARGET" = x; then
43+ CFLAGS_FOR_TARGET=$CFLAGS
44+ case " $CFLAGS " in
45+ *" -O2 "*) ;;
46+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
47+ esac
48+ case " $CFLAGS " in
49+ *" -g "* | *" -g3 "*) ;;
50+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
51+ esac
52+fi
53+
54+
55+if test "x$CXXFLAGS_FOR_TARGET" = x; then
56+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
57+ case " $CXXFLAGS " in
58+ *" -O2 "*) ;;
59+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
60+ esac
61+ case " $CXXFLAGS " in
62+ *" -g "* | *" -g3 "*) ;;
63+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
64+ esac
65+fi
66+
67+
68 # Handle --with-headers=XXX. If the value is not "yes", the contents of
69 # the named directory are copied to $(tooldir)/sys-include.
70 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
71--
722.6.3
73
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0013-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc-5.4/0013-64-bit-multilib-hack.patch
deleted file mode 100644
index 45aaf4cc22..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0013-64-bit-multilib-hack.patch
+++ /dev/null
@@ -1,85 +0,0 @@
1From bdde4f5efa3c89ac7ee0bc05f322f27e3dabeab9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH 13/46] 64-bit multilib hack.
5
6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22RP 15/8/11
23
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
26
27Upstream-Status: Pending
28---
29 gcc/config/i386/t-linux64 | 6 ++----
30 gcc/config/mips/t-linux64 | 10 +++-------
31 gcc/config/rs6000/t-linux64 | 5 ++---
32 3 files changed, 7 insertions(+), 14 deletions(-)
33
34diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
35index f6dbb78..d770da5 100644
36--- a/gcc/config/i386/t-linux64
37+++ b/gcc/config/i386/t-linux64
38@@ -32,7 +32,5 @@
39 #
40 comma=,
41 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
42-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
43-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
44-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
45-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
46+MULTILIB_DIRNAMES = . .
47+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
48diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
49index 7e96406..b72dcb0 100644
50--- a/gcc/config/mips/t-linux64
51+++ b/gcc/config/mips/t-linux64
52@@ -17,10 +17,6 @@
53 # <http://www.gnu.org/licenses/>.
54
55 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
56-MULTILIB_DIRNAMES = n32 32 64
57-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
58-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
59-MULTILIB_OSDIRNAMES = \
60- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
61- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
62- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
63+MULTILIB_DIRNAMES = . . .
64+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
65+
66diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
67index b6b351d..1d5b37a 100644
68--- a/gcc/config/rs6000/t-linux64
69+++ b/gcc/config/rs6000/t-linux64
70@@ -26,10 +26,9 @@
71 # MULTILIB_OSDIRNAMES according to what is found on the target.
72
73 MULTILIB_OPTIONS := m64/m32
74-MULTILIB_DIRNAMES := 64 32
75+MULTILIB_DIRNAMES := . .
76 MULTILIB_EXTRA_OPTS :=
77-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
78-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
79+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
80
81 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
82 $(COMPILE) $<
83--
842.6.3
85
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0014-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc-5.4/0014-optional-libstdc.patch
deleted file mode 100644
index 73741f83cc..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0014-optional-libstdc.patch
+++ /dev/null
@@ -1,101 +0,0 @@
1From a13763f8a1d413a432e7b40835a062f86208f29a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:12:56 +0400
4Subject: [PATCH 14/46] optional libstdc
5
6gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
7will not run correctly since by default the linker will try to link against libstdc++
8which shouldn't exist yet. We need an option to disable -lstdc++
9option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
10driver. This patch adds such an option which only disables the -lstdc++.
11
12A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
13do this officially, the likely answer is don't build libstdc++ separately.
14
15RP 29/6/10
16
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18
19Upstream-Status: Inappropriate [embedded specific]
20---
21 gcc/c-family/c.opt | 4 ++++
22 gcc/cp/g++spec.c | 1 +
23 gcc/doc/invoke.texi | 8 +++++++-
24 gcc/gcc.c | 1 +
25 4 files changed, 13 insertions(+), 1 deletion(-)
26
27diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
28index 4162566..453ec8e 100644
29--- a/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt
31@@ -1543,6 +1543,10 @@ nostdinc++
32 C++ ObjC++
33 Do not search standard system include directories for C++
34
35+nostdlib++
36+Driver
37+Do not link standard C++ runtime library
38+
39 o
40 C ObjC C++ ObjC++ Joined Separate
41 ; Documented in common.opt
42diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
43index 6536d7e..f57a5d4 100644
44--- a/gcc/cp/g++spec.c
45+++ b/gcc/cp/g++spec.c
46@@ -138,6 +138,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
47 switch (decoded_options[i].opt_index)
48 {
49 case OPT_nostdlib:
50+ case OPT_nostdlib__:
51 case OPT_nodefaultlibs:
52 library = -1;
53 break;
54diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
55index c81b55b..6d3f68c 100644
56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi
58@@ -195,6 +195,7 @@ in the following sections.
59 -fvisibility-inlines-hidden @gol
60 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
61 -fvtv-counts -fvtv-debug @gol
62+-nostdlib++ @gol
63 -fvisibility-ms-compat @gol
64 -fext-numeric-literals @gol
65 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
66@@ -488,7 +489,7 @@ Objective-C and Objective-C++ Dialects}.
67 -s -static -static-libgcc -static-libstdc++ @gol
68 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
69 -static-libmpx -static-libmpxwrappers @gol
70--shared -shared-libgcc -symbolic @gol
71+-shared -shared-libgcc -symbolic -nostdlib++ @gol
72 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
73 -u @var{symbol} -z @var{keyword}}
74
75@@ -11187,6 +11188,11 @@ These entries are usually resolved by entries in
76 libc. These entry points should be supplied through some other
77 mechanism when this option is specified.
78
79+@item -nostdlib++
80+@opindex nostdlib++
81+Do not use the standard system C++ runtime libraries when linking.
82+Only the libraries you specify will be passed to the linker.
83+
84 @cindex @option{-lgcc}, use with @option{-nostdlib}
85 @cindex @option{-nostdlib} and unresolved references
86 @cindex unresolved references and @option{-nostdlib}
87diff --git a/gcc/gcc.c b/gcc/gcc.c
88index 675bcc1..a37ec8b 100644
89--- a/gcc/gcc.c
90+++ b/gcc/gcc.c
91@@ -845,6 +845,7 @@ proper position among the other output files. */
92 %(mflib) " STACK_SPLIT_SPEC "\
93 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
94 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
95+ %{!nostdlib++:}\
96 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
97 #endif
98
99--
1002.6.3
101
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/meta/recipes-devtools/gcc/gcc-5.4/0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
deleted file mode 100644
index 1b62ef8065..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From 4bd21a1d63cfb14e261d90adc0c5d4f9462dc555 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:14:20 +0400
4Subject: [PATCH 15/46] gcc: disable MASK_RELAX_PIC_CALLS bit
5
6The new feature added after 4.3.3
7"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
8will cause cc1plus eat up all the system memory when build webkit-gtk.
9The function mips_get_pic_call_symbol keeps on recursively calling itself.
10Disable this feature to walk aside the bug.
11
12Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Inappropriate [configuration]
16---
17 gcc/configure | 7 -------
18 gcc/configure.ac | 7 -------
19 2 files changed, 14 deletions(-)
20
21diff --git a/gcc/configure b/gcc/configure
22index 34371a3..8caecdc 100755
23--- a/gcc/configure
24+++ b/gcc/configure
25@@ -26479,13 +26479,6 @@ $as_echo_n "checking assembler and linker for explicit JALR relocation... " >&6;
26 rm -f conftest.*
27 fi
28 fi
29- if test $gcc_cv_as_ld_jalr_reloc = yes; then
30- if test x$target_cpu_default = x; then
31- target_cpu_default=MASK_RELAX_PIC_CALLS
32- else
33- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
34- fi
35- fi
36 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
37 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
38
39diff --git a/gcc/configure.ac b/gcc/configure.ac
40index 240d322..57819ff 100644
41--- a/gcc/configure.ac
42+++ b/gcc/configure.ac
43@@ -4384,13 +4384,6 @@ x:
44 rm -f conftest.*
45 fi
46 fi
47- if test $gcc_cv_as_ld_jalr_reloc = yes; then
48- if test x$target_cpu_default = x; then
49- target_cpu_default=MASK_RELAX_PIC_CALLS
50- else
51- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
52- fi
53- fi
54 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
55
56 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
57--
582.6.3
59
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0016-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-5.4/0016-COLLECT_GCC_OPTIONS.patch
deleted file mode 100644
index e6ae262e4b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0016-COLLECT_GCC_OPTIONS.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From 92427ebb94dc66f8e64ebf3ffbcd6dd5ce0935c1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:16:28 +0400
4Subject: [PATCH 16/46] COLLECT_GCC_OPTIONS
5
6This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
7invoke collect2.
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Pending
12---
13 gcc/gcc.c | 9 +++++++++
14 1 file changed, 9 insertions(+)
15
16diff --git a/gcc/gcc.c b/gcc/gcc.c
17index a37ec8b..87b47c5 100644
18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c
20@@ -4352,6 +4352,15 @@ set_collect_gcc_options (void)
21 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
22
23 first_time = TRUE;
24+#ifdef HAVE_LD_SYSROOT
25+ if (target_system_root_changed && target_system_root)
26+ {
27+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
28+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
29+ obstack_grow (&collect_obstack, "'", 1);
30+ first_time = FALSE;
31+ }
32+#endif
33 for (i = 0; (int) i < n_switches; i++)
34 {
35 const char *const *args;
36--
372.6.3
38
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-5.4/0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
deleted file mode 100644
index b89a27919e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
+++ /dev/null
@@ -1,96 +0,0 @@
1From b1f3118e439459c26a3e19c617b7b0c93745e77a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:17:25 +0400
4Subject: [PATCH 17/46] Use the defaults.h in ${B} instead of ${S}, and t-oe in
5 ${B}
6
7Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
8the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14
15While compiling gcc-crosssdk-initial-x86_64 on some host, there is
16occasionally failure that test the existance of default.h doesn't
17work, the reason is tm_include_list='** defaults.h' rather than
18tm_include_list='** ./defaults.h'
19
20So we add the test condition for this situation.
21Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
22---
23 gcc/Makefile.in | 2 +-
24 gcc/configure | 4 ++--
25 gcc/configure.ac | 4 ++--
26 gcc/mkconfig.sh | 4 ++--
27 4 files changed, 7 insertions(+), 7 deletions(-)
28
29diff --git a/gcc/Makefile.in b/gcc/Makefile.in
30index 07c6f0a..e1e63e8 100644
31--- a/gcc/Makefile.in
32+++ b/gcc/Makefile.in
33@@ -502,7 +502,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
34 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
35
36 xmake_file=@xmake_file@
37-tmake_file=@tmake_file@
38+tmake_file=@tmake_file@ ./t-oe
39 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
40 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
41 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
42diff --git a/gcc/configure b/gcc/configure
43index 8caecdc..8ec3d40 100755
44--- a/gcc/configure
45+++ b/gcc/configure
46@@ -11850,8 +11850,8 @@ for f in $tm_file; do
47 tm_include_list="${tm_include_list} $f"
48 ;;
49 defaults.h )
50- tm_file_list="${tm_file_list} \$(srcdir)/$f"
51- tm_include_list="${tm_include_list} $f"
52+ tm_file_list="${tm_file_list} ./$f"
53+ tm_include_list="${tm_include_list} ./$f"
54 ;;
55 * )
56 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
57diff --git a/gcc/configure.ac b/gcc/configure.ac
58index 57819ff..643a47e 100644
59--- a/gcc/configure.ac
60+++ b/gcc/configure.ac
61@@ -1832,8 +1832,8 @@ for f in $tm_file; do
62 tm_include_list="${tm_include_list} $f"
63 ;;
64 defaults.h )
65- tm_file_list="${tm_file_list} \$(srcdir)/$f"
66- tm_include_list="${tm_include_list} $f"
67+ tm_file_list="${tm_file_list} ./$f"
68+ tm_include_list="${tm_include_list} ./$f"
69 ;;
70 * )
71 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
72diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
73index c32f087..6803ab9 100644
74--- a/gcc/mkconfig.sh
75+++ b/gcc/mkconfig.sh
76@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
77 if [ $# -ge 1 ]; then
78 echo '#ifdef IN_GCC' >> ${output}T
79 for file in "$@"; do
80- if test x"$file" = x"defaults.h"; then
81+ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
82 postpone_defaults_h="yes"
83 else
84 echo "# include \"$file\"" >> ${output}T
85@@ -109,7 +109,7 @@ esac
86
87 # If we postponed including defaults.h, add the #include now.
88 if test x"$postpone_defaults_h" = x"yes"; then
89- echo "# include \"defaults.h\"" >> ${output}T
90+ echo "# include \"./defaults.h\"" >> ${output}T
91 fi
92
93 # Add multiple inclusion protection guard, part two.
94--
952.6.3
96
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0018-fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-5.4/0018-fortran-cross-compile-hack.patch
deleted file mode 100644
index e8ba325585..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0018-fortran-cross-compile-hack.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From d11c73c1295565ff3766ae04e2a410a89fc84dd5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:01 +0400
4Subject: [PATCH 18/46] fortran cross-compile hack.
5
6* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
7used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
8directory.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Upstream-Status: Inappropriate [embedded specific]
13---
14 libgfortran/configure | 2 +-
15 libgfortran/configure.ac | 2 +-
16 2 files changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/libgfortran/configure b/libgfortran/configure
19index bb3107b..5d47e65 100755
20--- a/libgfortran/configure
21+++ b/libgfortran/configure
22@@ -12747,7 +12747,7 @@ esac
23
24 # We need gfortran to compile parts of the library
25 #AC_PROG_FC(gfortran)
26-FC="$GFORTRAN"
27+#FC="$GFORTRAN"
28 ac_ext=${ac_fc_srcext-f}
29 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
30 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
31diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
32index adafb3f..b4ade28 100644
33--- a/libgfortran/configure.ac
34+++ b/libgfortran/configure.ac
35@@ -240,7 +240,7 @@ AC_SUBST(enable_static)
36
37 # We need gfortran to compile parts of the library
38 #AC_PROG_FC(gfortran)
39-FC="$GFORTRAN"
40+#FC="$GFORTRAN"
41 AC_PROG_FC(gfortran)
42
43 # extra LD Flags which are required for targets
44--
452.6.3
46
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0019-libgcc-sjlj-check.patch b/meta/recipes-devtools/gcc/gcc-5.4/0019-libgcc-sjlj-check.patch
deleted file mode 100644
index 01a4d1fdab..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0019-libgcc-sjlj-check.patch
+++ /dev/null
@@ -1,74 +0,0 @@
1From 7b40212ed6c0c9fe4efe51f31bccd3d9f892f238 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:50 +0400
4Subject: [PATCH 19/46] libgcc-sjlj-check
5
6ac_fn_c_try_compile doesnt seem to keep the intermediate files
7which are needed for sjlj test to pass since it greps into the
8generated file. So we run the compiler command using AC_TRY_COMMAND
9which then generates the needed .s file
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14---
15 libgcc/configure | 10 ++++++----
16 libgcc/configure.ac | 10 ++++------
17 2 files changed, 10 insertions(+), 10 deletions(-)
18
19diff --git a/libgcc/configure b/libgcc/configure
20index 203d384..6aef3e7 100644
21--- a/libgcc/configure
22+++ b/libgcc/configure
23@@ -4570,17 +4570,19 @@ void foo ()
24 }
25
26 _ACEOF
27-CFLAGS_hold=$CFLAGS
28-CFLAGS="--save-temps -fexceptions"
29 libgcc_cv_lib_sjlj_exceptions=unknown
30-if ac_fn_c_try_compile; then :
31+if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
32+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
33+ (eval $ac_try) 2>&5
34+ ac_status=$?
35+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
36+ test $ac_status = 0; }; }; then
37 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
38 libgcc_cv_lib_sjlj_exceptions=yes
39 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
40 libgcc_cv_lib_sjlj_exceptions=no
41 fi
42 fi
43-CFLAGS=$CFLAGS_hold
44 rm -f conftest*
45
46 fi
47diff --git a/libgcc/configure.ac b/libgcc/configure.ac
48index a10a952..cc324f3 100644
49--- a/libgcc/configure.ac
50+++ b/libgcc/configure.ac
51@@ -255,16 +255,14 @@ void foo ()
52 bar();
53 }
54 ])])
55-CFLAGS_hold=$CFLAGS
56-CFLAGS="--save-temps -fexceptions"
57 libgcc_cv_lib_sjlj_exceptions=unknown
58-AS_IF([ac_fn_c_try_compile],
59- [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
60+if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
61+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
62 libgcc_cv_lib_sjlj_exceptions=yes
63 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
64 libgcc_cv_lib_sjlj_exceptions=no
65- fi])
66-CFLAGS=$CFLAGS_hold
67+ fi
68+fi
69 rm -f conftest*
70 ])
71
72--
732.6.3
74
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0020-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-5.4/0020-cpp-honor-sysroot.patch
deleted file mode 100644
index 13f66d4136..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0020-cpp-honor-sysroot.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From 5f9759a85fff3d78e3f71ae01c970b10d326c406 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH 20/46] cpp: honor sysroot.
5
6Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
7preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
8rather than the --sysroot option specified on the commandline. If access to that directory is
9permission denied (unreadable), gcc will error.
10
11This happens when ccache is in use due to the fact it uses preprocessed source files.
12
13The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
14-isystem, -isysroot happen and the correct sysroot is used.
15
16[YOCTO #2074]
17
18RP 2012/04/13
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21
22Upstream-Status: Pending
23---
24 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.c | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
29index b0728f0..e69ee7d 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -63,5 +63,5 @@ along with GCC; see the file COPYING3. If not see
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!M:%{!MM:%{!E:\
36- cc1plus -fpreprocessed %i %(cc1_options) %2\
37+ cc1plus -fpreprocessed %i %I %(cc1_options) %2\
38 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
39diff --git a/gcc/gcc.c b/gcc/gcc.c
40index 87b47c5..e6efae7 100644
41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c
43@@ -1142,7 +1142,7 @@ static const struct compiler default_compilers[] =
44 %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
45 {".i", "@cpp-output", 0, 0, 0},
46 {"@cpp-output",
47- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
48+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
49 {".s", "@assembler", 0, 0, 0},
50 {"@assembler",
51 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
52--
532.6.3
54
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0021-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc-5.4/0021-MIPS64-Default-to-N64-ABI.patch
deleted file mode 100644
index c7cffe417d..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0021-MIPS64-Default-to-N64-ABI.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 34d22ab6cfd2dfe6dd171c8d0b31cafcdeb86298 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:23:08 +0400
4Subject: [PATCH 21/46] MIPS64: Default to N64 ABI
5
6MIPS64 defaults to n32 ABI, this patch makes it
7so that it defaults to N64 ABI
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Inappropriate [OE config specific]
12---
13 gcc/config.gcc | 10 +++++-----
14 1 file changed, 5 insertions(+), 5 deletions(-)
15
16diff --git a/gcc/config.gcc b/gcc/config.gcc
17index c835734..dd0739d 100644
18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc
20@@ -2017,29 +2017,29 @@ mips*-*-linux*) # Linux MIPS, either endian.
21 default_mips_arch=mips32
22 ;;
23 mips64el-st-linux-gnu)
24- default_mips_abi=n32
25+ default_mips_abi=64
26 tm_file="${tm_file} mips/st.h"
27 tmake_file="${tmake_file} mips/t-st"
28 enable_mips_multilibs="yes"
29 ;;
30 mips64octeon*-*-linux*)
31- default_mips_abi=n32
32+ default_mips_abi=64
33 tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
34 target_cpu_default=MASK_SOFT_FLOAT_ABI
35 enable_mips_multilibs="yes"
36 ;;
37 mipsisa64r6*-*-linux*)
38- default_mips_abi=n32
39+ default_mips_abi=64
40 default_mips_arch=mips64r6
41 enable_mips_multilibs="yes"
42 ;;
43 mipsisa64r2*-*-linux*)
44- default_mips_abi=n32
45+ default_mips_abi=64
46 default_mips_arch=mips64r2
47 enable_mips_multilibs="yes"
48 ;;
49 mips64*-*-linux* | mipsisa64*-*-linux*)
50- default_mips_abi=n32
51+ default_mips_abi=64
52 enable_mips_multilibs="yes"
53 ;;
54 esac
55--
562.6.3
57
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0022-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc-5.4/0022-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
deleted file mode 100644
index 6208351324..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0022-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
+++ /dev/null
@@ -1,216 +0,0 @@
1From f6b41b62ea62a0f1447d9fc235f7fd2bbf3fe7c2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH 22/46] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
5 relative to SYSTEMLIBS_DIR
6
7This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
8relative to SYSTEMLIBS_DIR which can be set in generated headers
9This breaks the assumption of hardcoded multilib in gcc
10Change is only for the supported architectures in OE including
11SH, sparc, alpha for possible future support (if any)
12
13Removes the do_headerfix task in metadata
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration]
18---
19 gcc/config/alpha/linux-elf.h | 4 ++--
20 gcc/config/arm/linux-eabi.h | 4 ++--
21 gcc/config/arm/linux-elf.h | 2 +-
22 gcc/config/i386/linux.h | 2 +-
23 gcc/config/i386/linux64.h | 6 +++---
24 gcc/config/linux.h | 8 ++++----
25 gcc/config/mips/linux.h | 12 ++++++------
26 gcc/config/rs6000/linux64.h | 10 +++++-----
27 gcc/config/sh/linux.h | 2 +-
28 gcc/config/sparc/linux.h | 2 +-
29 gcc/config/sparc/linux64.h | 4 ++--
30 11 files changed, 28 insertions(+), 28 deletions(-)
31
32diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
33index 2c70a2f..dd048db 100644
34--- a/gcc/config/alpha/linux-elf.h
35+++ b/gcc/config/alpha/linux-elf.h
36@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
37 #define EXTRA_SPECS \
38 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
39
40-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
41-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
42+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
43+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
44 #if DEFAULT_LIBC == LIBC_UCLIBC
45 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
46 #elif DEFAULT_LIBC == LIBC_GLIBC
47diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
48index e9d65dc..cfdf3f0 100644
49--- a/gcc/config/arm/linux-eabi.h
50+++ b/gcc/config/arm/linux-eabi.h
51@@ -68,8 +68,8 @@
52 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
53
54 #undef GLIBC_DYNAMIC_LINKER
55-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
56-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
57+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
58+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
59 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
60
61 #define GLIBC_DYNAMIC_LINKER \
62diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
63index 49ad954..a5ab559 100644
64--- a/gcc/config/arm/linux-elf.h
65+++ b/gcc/config/arm/linux-elf.h
66@@ -62,7 +62,7 @@
67
68 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
69
70-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
71+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
72
73 #define LINUX_TARGET_LINK_SPEC "%{h*} \
74 %{static:-Bstatic} \
75diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
76index a100963..21ba2b2 100644
77--- a/gcc/config/i386/linux.h
78+++ b/gcc/config/i386/linux.h
79@@ -20,4 +20,4 @@ along with GCC; see the file COPYING3. If not see
80 <http://www.gnu.org/licenses/>. */
81
82 #define GNU_USER_LINK_EMULATION "elf_i386"
83-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
84+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
85diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
86index a27d3be..6185cce 100644
87--- a/gcc/config/i386/linux64.h
88+++ b/gcc/config/i386/linux64.h
89@@ -27,6 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
90 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
91 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
92
93-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
94-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
95-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
96+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
97+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
98+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
99diff --git a/gcc/config/linux.h b/gcc/config/linux.h
100index 857389a..22b9be5 100644
101--- a/gcc/config/linux.h
102+++ b/gcc/config/linux.h
103@@ -73,10 +73,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
104 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
105 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
106 supporting both 32-bit and 64-bit compilation. */
107-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
108-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
109-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
110-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
111+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
112+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
113+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
114+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
115 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
116 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
117 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
118diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
119index 91df261..c306afb 100644
120--- a/gcc/config/mips/linux.h
121+++ b/gcc/config/mips/linux.h
122@@ -22,20 +22,20 @@ along with GCC; see the file COPYING3. If not see
123 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
124
125 #define GLIBC_DYNAMIC_LINKER32 \
126- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
127+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
128 #define GLIBC_DYNAMIC_LINKER64 \
129- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
130+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
131 #define GLIBC_DYNAMIC_LINKERN32 \
132- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
133+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
134
135 #undef UCLIBC_DYNAMIC_LINKER32
136 #define UCLIBC_DYNAMIC_LINKER32 \
137- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
138+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
139 #undef UCLIBC_DYNAMIC_LINKER64
140 #define UCLIBC_DYNAMIC_LINKER64 \
141- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
142+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
143 #define UCLIBC_DYNAMIC_LINKERN32 \
144- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
145+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
146
147 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
148 #define GNU_USER_DYNAMIC_LINKERN32 \
149diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
150index 0879e7e..31c4338 100644
151--- a/gcc/config/rs6000/linux64.h
152+++ b/gcc/config/rs6000/linux64.h
153@@ -357,14 +357,14 @@ extern int dot_symbols;
154 #undef LINK_OS_DEFAULT_SPEC
155 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
156
157-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
158+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
159 #ifdef LINUX64_DEFAULT_ABI_ELFv2
160-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
161+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
162 #else
163-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
164+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
165 #endif
166-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
167-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
168+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
169+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
170 #if DEFAULT_LIBC == LIBC_UCLIBC
171 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
172 #elif DEFAULT_LIBC == LIBC_GLIBC
173diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
174index 0f5d614..168416c 100644
175--- a/gcc/config/sh/linux.h
176+++ b/gcc/config/sh/linux.h
177@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see
178
179 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
180
181-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
182+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
183
184 #undef SUBTARGET_LINK_EMUL_SUFFIX
185 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
186diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
187index 56def4b..00b564c 100644
188--- a/gcc/config/sparc/linux.h
189+++ b/gcc/config/sparc/linux.h
190@@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
191 When the -shared link option is used a final link is not being
192 done. */
193
194-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
195+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
196
197 #undef LINK_SPEC
198 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
199diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
200index fa805fd..0eb4acd 100644
201--- a/gcc/config/sparc/linux64.h
202+++ b/gcc/config/sparc/linux64.h
203@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. If not see
204 When the -shared link option is used a final link is not being
205 done. */
206
207-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
208-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
209+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
210+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
211
212 #ifdef SPARC_BI_ARCH
213
214--
2152.6.3
216
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0023-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc-5.4/0023-gcc-Fix-argument-list-too-long-error.patch
deleted file mode 100644
index be91c9e638..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0023-gcc-Fix-argument-list-too-long-error.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 9701f596bbe5bf51bbf48661bc515b45d4b6f4d2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:26:37 +0400
4Subject: [PATCH 23/46] gcc: Fix argument list too long error.
5
6There would be an "Argument list too long" error when the
7build directory is longer than 200, this is caused by:
8
9headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
10
11The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
12it, use the $(sort list) of GNU make which can handle the too long list
13would fix the problem, the header would be short enough after sorted.
14The "tr ' ' '\012'" was used for translating the space to "\n", the
15$(sort list) doesn't need this.
16
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 gcc/Makefile.in | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/gcc/Makefile.in b/gcc/Makefile.in
26index e1e63e8..7b49f88 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -3262,7 +3262,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
30 # We keep the directory structure for files in config or c-family and .def
31 # files. All other files are flattened to a single directory.
32 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
33- headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
34+ headers="$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def))"; \
35 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
36 for file in $$headers; do \
37 if [ -f $$file ] ; then \
38--
392.6.3
40
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0024-Disable-sdt.patch b/meta/recipes-devtools/gcc/gcc-5.4/0024-Disable-sdt.patch
deleted file mode 100644
index b23ce97563..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0024-Disable-sdt.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1From 946e047614103e1f2982613c7aa5f76587500c0e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:28:10 +0400
4Subject: [PATCH 24/46] Disable sdt.
5
6We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
7It may or may not exist from preivous builds though. To be determinstic, disable
8sdt.h usage always. This avoids build failures if the header is removed after configure
9but before libgcc is compiled for example.
10
11RP 2012/8/7
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Disable sdt for libstdc++-v3.
16
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
18
19Upstream-Status: Inappropriate [hack]
20---
21 gcc/configure | 12 ++++++------
22 gcc/configure.ac | 18 +++++++++---------
23 libstdc++-v3/configure | 6 +++---
24 libstdc++-v3/configure.ac | 2 +-
25 4 files changed, 19 insertions(+), 19 deletions(-)
26
27diff --git a/gcc/configure b/gcc/configure
28index 8ec3d40..eaa3b07 100755
29--- a/gcc/configure
30+++ b/gcc/configure
31@@ -27857,12 +27857,12 @@ fi
32 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
33 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
34 have_sys_sdt_h=no
35-if test -f $target_header_dir/sys/sdt.h; then
36- have_sys_sdt_h=yes
37-
38-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
39-
40-fi
41+#if test -f $target_header_dir/sys/sdt.h; then
42+# have_sys_sdt_h=yes
43+#
44+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
45+#
46+#fi
47 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
48 $as_echo "$have_sys_sdt_h" >&6; }
49
50diff --git a/gcc/configure.ac b/gcc/configure.ac
51index 643a47e..9f6cacb 100644
52--- a/gcc/configure.ac
53+++ b/gcc/configure.ac
54@@ -5315,15 +5315,15 @@ if test x$gcc_cv_libc_provides_ssp = xyes; then
55 fi
56
57 # Test for <sys/sdt.h> on the target.
58-GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
59-AC_MSG_CHECKING(sys/sdt.h in the target C library)
60-have_sys_sdt_h=no
61-if test -f $target_header_dir/sys/sdt.h; then
62- have_sys_sdt_h=yes
63- AC_DEFINE(HAVE_SYS_SDT_H, 1,
64- [Define if your target C library provides sys/sdt.h])
65-fi
66-AC_MSG_RESULT($have_sys_sdt_h)
67+#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
68+#AC_MSG_CHECKING(sys/sdt.h in the target C library)
69+#have_sys_sdt_h=no
70+#if test -f $target_header_dir/sys/sdt.h; then
71+# have_sys_sdt_h=yes
72+# AC_DEFINE(HAVE_SYS_SDT_H, 1,
73+# [Define if your target C library provides sys/sdt.h])
74+#fi
75+#AC_MSG_RESULT($have_sys_sdt_h)
76
77 # Check if TFmode long double should be used by default or not.
78 # Some glibc targets used DFmode long double, but with glibc 2.4
79diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
80index 217012e..81240b9 100755
81--- a/libstdc++-v3/configure
82+++ b/libstdc++-v3/configure
83@@ -20964,11 +20964,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
84 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
85 ac_compiler_gnu=$ac_cv_c_compiler_gnu
86
87- if test $glibcxx_cv_sys_sdt_h = yes; then
88+# if test $glibcxx_cv_sys_sdt_h = yes; then
89
90-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
91+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
92
93- fi
94+# fi
95 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5
96 $as_echo "$glibcxx_cv_sys_sdt_h" >&6; }
97
98diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
99index 580fb8b..5a41083 100644
100--- a/libstdc++-v3/configure.ac
101+++ b/libstdc++-v3/configure.ac
102@@ -230,7 +230,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
103 GLIBCXX_CHECK_SC_NPROC_ONLN
104 GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
105 GLIBCXX_CHECK_SYSCTL_HW_NCPU
106-GLIBCXX_CHECK_SDT_H
107+#GLIBCXX_CHECK_SDT_H
108
109 # Check for available headers.
110 AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
111--
1122.6.3
113
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0025-libtool.patch b/meta/recipes-devtools/gcc/gcc-5.4/0025-libtool.patch
deleted file mode 100644
index 8d5eb973bc..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0025-libtool.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From f68c5b78751660505b22b46dad99240db0df3456 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH 25/46] libtool
5
6libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
7when running on am x86_64 build host.
8
9This patch stops this speading to libdir in the libstdc++.la file within libtool.
10Arguably, it shouldn't be passing this into libtool in the first place but
11for now this resolves the nastiest problems this causes.
12
13func_normal_abspath would resolve an empty path to `pwd` so we need
14to filter the zero case.
15
16RP 2012/8/24
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/ltmain.sh b/ltmain.sh
26index 9503ec8..0121fba 100644
27--- a/ltmain.sh
28+++ b/ltmain.sh
29@@ -6359,6 +6359,10 @@ func_mode_link ()
30 func_warning "ignoring multiple \`-rpath's for a libtool library"
31
32 install_libdir="$1"
33+ if test -n "$install_libdir"; then
34+ func_normal_abspath "$install_libdir"
35+ install_libdir=$func_normal_abspath_result
36+ fi
37
38 oldlibs=
39 if test -z "$rpath"; then
40--
412.6.3
42
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0026-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta/recipes-devtools/gcc/gcc-5.4/0026-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
deleted file mode 100644
index a22d95f721..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0026-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From 4c75e349aa7abd1e285720328b23690636bea242 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH 26/46] gcc: armv4: pass fix-v4bx to linker to support EABI.
5
6The LINK_SPEC for linux gets overwritten by linux-eabi.h which
7means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
8the option is not passed to linker when chosing march=armv4
9This patch redefines this in linux-eabi.h and reinserts it
10for eabi defaulting toolchains.
11
12We might want to send it upstream.
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16Upstream-Status: Pending
17---
18 gcc/config/arm/linux-eabi.h | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
22index cfdf3f0..048a062 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -77,10 +77,14 @@
26 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
27 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
28
29+/* For armv4 we pass --fix-v4bx to linker to support EABI */
30+#undef TARGET_FIX_V4BX_SPEC
31+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
32+
33 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
34 use the GNU/Linux version, not the generic BPABI version. */
35 #undef LINK_SPEC
36-#define LINK_SPEC EABI_LINK_SPEC \
37+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
41--
422.6.3
43
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0027-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta/recipes-devtools/gcc/gcc-5.4/0027-Use-the-multilib-config-files-from-B-instead-of-usin.patch
deleted file mode 100644
index 46815d1569..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0027-Use-the-multilib-config-files-from-B-instead-of-usin.patch
+++ /dev/null
@@ -1,102 +0,0 @@
1From 8217dd7fb318f9abc6564f67b424c433d8398d61 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH 27/46] Use the multilib config files from ${B} instead of
5 using the ones from ${S}
6
7Use the multilib config files from ${B} instead of using the ones from ${S}
8so that the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
13
14Upstream-Status: Inappropriate [configuration]
15---
16 gcc/configure | 22 ++++++++++++++++++----
17 gcc/configure.ac | 22 ++++++++++++++++++----
18 2 files changed, 36 insertions(+), 8 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index eaa3b07..9b60aad 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -11830,10 +11830,20 @@ done
25 tmake_file_=
26 for f in ${tmake_file}
27 do
28- if test -f ${srcdir}/config/$f
29- then
30- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31- fi
32+ case $f in
33+ */t-linux64 )
34+ if test -f ./config/$f
35+ then
36+ tmake_file_="${tmake_file_} ./config/$f"
37+ fi
38+ ;;
39+ * )
40+ if test -f ${srcdir}/config/$f
41+ then
42+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
43+ fi
44+ ;;
45+ esac
46 done
47 tmake_file="${tmake_file_}"
48
49@@ -11844,6 +11854,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do
52 case $f in
53+ */linux64.h )
54+ tm_file_list="${tm_file_list} ./config/$f"
55+ tm_include_list="${tm_include_list} ./config/$f"
56+ ;;
57 ./* )
58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 9f6cacb..e1e54f2 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -1812,10 +1812,20 @@ done
65 tmake_file_=
66 for f in ${tmake_file}
67 do
68- if test -f ${srcdir}/config/$f
69- then
70- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71- fi
72+ case $f in
73+ */t-linux64 )
74+ if test -f ./config/$f
75+ then
76+ tmake_file_="${tmake_file_} ./config/$f"
77+ fi
78+ ;;
79+ * )
80+ if test -f ${srcdir}/config/$f
81+ then
82+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
83+ fi
84+ ;;
85+ esac
86 done
87 tmake_file="${tmake_file_}"
88
89@@ -1826,6 +1836,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do
92 case $f in
93+ */linux64.h )
94+ tm_file_list="${tm_file_list} ./config/$f"
95+ tm_include_list="${tm_include_list} ./config/$f"
96+ ;;
97 ./* )
98 f=`echo $f | sed 's/^..//'`
99 tm_file_list="${tm_file_list} $f"
100--
1012.6.3
102
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0028-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta/recipes-devtools/gcc/gcc-5.4/0028-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
deleted file mode 100644
index 60ddd9cee7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0028-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 08a0e45b308fc97d06f5c3ef77a257e7a6bd1a48 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:39:38 +0000
4Subject: [PATCH 28/46] Avoid using libdir from .la which usually points to a
5 host path
6
7Upstream-Status: Inappropriate [embedded specific]
8
9Signed-off-by: Jonathan Liu <net147@gmail.com>
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 ltmain.sh | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/ltmain.sh b/ltmain.sh
16index 0121fba..52bdbdb 100644
17--- a/ltmain.sh
18+++ b/ltmain.sh
19@@ -5628,6 +5628,9 @@ func_mode_link ()
20 absdir="$abs_ladir"
21 libdir="$abs_ladir"
22 else
23+ # Instead of using libdir from .la which usually points to a host path,
24+ # use the path the .la is contained in.
25+ libdir="$abs_ladir"
26 dir="$libdir"
27 absdir="$libdir"
28 fi
29--
302.6.3
31
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0029-export-CPP.patch b/meta/recipes-devtools/gcc/gcc-5.4/0029-export-CPP.patch
deleted file mode 100644
index 62195aa872..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0029-export-CPP.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From 95f494d1544857ad38949a7da37e2d7264475233 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:40:59 +0000
4Subject: [PATCH 29/46] export CPP
5
6The OE environment sets and exports CPP as being the target gcc. When
7building gcc-cross-canadian for a mingw targetted sdk, the following can be found
8in build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
9
10configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
11configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5
12configure:3666: $? = 0
13configure:3698: result: no
14configure:3786: checking how to run the C preprocessor
15configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
16configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
17configure:3876: $? = 0
18
19Note this is a *build* target (in build-x86_64-linux) so it should be
20using the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32
21headers are very different, using the wrong cpp is a real problem. It is leaking
22into configure through the CPP variable. Ultimately this leads to build
23failures related to not being able to include a process.h file for pem-unix.c.
24
25The fix is to ensure we export a sane CPP value into the build
26environment when using build targets. We could define a CPP_FOR_BUILD value which may be
27the version which needs to be upstreamed but for now, this fix is good enough to
28avoid the problem.
29
30RP 22/08/2013
31
32Upstream-Status: Pending
33
34Signed-off-by: Khem Raj <raj.khem@gmail.com>
35---
36 Makefile.in | 1 +
37 1 file changed, 1 insertion(+)
38
39diff --git a/Makefile.in b/Makefile.in
40index 36b4008..a783e1e 100644
41--- a/Makefile.in
42+++ b/Makefile.in
43@@ -149,6 +149,7 @@ BUILD_EXPORTS = \
44 AR="$(AR_FOR_BUILD)"; export AR; \
45 AS="$(AS_FOR_BUILD)"; export AS; \
46 CC="$(CC_FOR_BUILD)"; export CC; \
47+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
48 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
49 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
50 CXX="$(CXX_FOR_BUILD)"; export CXX; \
51--
522.6.3
53
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0030-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/meta/recipes-devtools/gcc/gcc-5.4/0030-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
deleted file mode 100644
index 57051871b3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0030-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1From 4ed8c1fd9dc05f7a9db9298a55396c8f0ff549a7 Mon Sep 17 00:00:00 2001
2From: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
3Date: Wed, 5 Feb 2014 16:52:31 +0200
4Subject: [PATCH 30/46] Enable SPE & AltiVec generation on powepc*linux target
5
6When is configured with --target=powerpc-linux, the resulting GCC will
7not be able to generate code for SPE targets (e500v1/v2).
8GCC configured with --target=powerpc-linuxspe will not be able to
9generate AltiVec instructions (for e6500).
10This patch modifies the configured file such that SPE or AltiVec code
11can be generated when gcc is configured with --target=powerpc-linux.
12The ABI and speciffic instructions can be selected through the
13"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
14
15Upstream-Status: Inappropriate [configuration]
16
17Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
18---
19 gcc/config.gcc | 9 ++++++++-
20 1 file changed, 8 insertions(+), 1 deletion(-)
21
22Index: gcc-5.3.0/gcc/config.gcc
23===================================================================
24--- gcc-5.3.0.orig/gcc/config.gcc
25+++ gcc-5.3.0/gcc/config.gcc
26@@ -2346,7 +2346,14 @@ powerpc-*-rtems*)
27 tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
28 ;;
29 powerpc*-*-linux*)
30- tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
31+ case ${target} in
32+ powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
33+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
34+ ;;
35+ *)
36+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h"
37+ ;;
38+ esac
39 extra_options="${extra_options} rs6000/sysv4.opt"
40 tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm"
41 extra_objs="$extra_objs rs6000-linux.o"
42Index: gcc-5.3.0/gcc/config/rs6000/linuxspe.h
43===================================================================
44--- gcc-5.3.0.orig/gcc/config/rs6000/linuxspe.h
45+++ gcc-5.3.0/gcc/config/rs6000/linuxspe.h
46@@ -27,6 +27,3 @@
47 #undef TARGET_DEFAULT
48 #define TARGET_DEFAULT MASK_STRICT_ALIGN
49 #endif
50-
51-#undef ASM_DEFAULT_SPEC
52-#define ASM_DEFAULT_SPEC "-mppc -mspe -me500"
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0031-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch b/meta/recipes-devtools/gcc/gcc-5.4/0031-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
deleted file mode 100644
index f2bc66432c..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0031-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From bb6fea821483aa3259b34e101a39c993edd01411 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:21:55 +0000
4Subject: [PATCH 31/46] Disable the MULTILIB_OSDIRNAMES and other multilib
5 options.
6
7Hard coding the MULTILIB_OSDIRNAMES with ../lib64 is causing problems on
8systems where the libdir is NOT set to /lib64. This is allowed by the
9ABI, as
10long as the dynamic loader is present in /lib.
11
12We simply want to use the default rules in gcc to find and configure the
13normal libdir.
14
15Upstream-Status: Inappropriate[OE-Specific]
16
17Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/config/aarch64/t-aarch64-linux | 8 ++++----
21 1 file changed, 4 insertions(+), 4 deletions(-)
22
23diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
24index c296376..3bb59bf 100644
25--- a/gcc/config/aarch64/t-aarch64-linux
26+++ b/gcc/config/aarch64/t-aarch64-linux
27@@ -21,8 +21,8 @@
28 LIB1ASMSRC = aarch64/lib1funcs.asm
29 LIB1ASMFUNCS = _aarch64_sync_cache_range
30
31-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
32-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
33-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
34+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
35+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
36+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
37
38-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
39+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
40--
412.6.3
42
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0032-Ensure-target-gcc-headers-can-be-included.patch b/meta/recipes-devtools/gcc/gcc-5.4/0032-Ensure-target-gcc-headers-can-be-included.patch
deleted file mode 100644
index 89503ff60e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0032-Ensure-target-gcc-headers-can-be-included.patch
+++ /dev/null
@@ -1,98 +0,0 @@
1From bb26f90f5e0accc3539f62b6fec663682959dd36 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:25:11 +0000
4Subject: [PATCH 32/46] Ensure target gcc headers can be included
5
6There are a few headers installed as part of the OpenEmbedded
7gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
8built for the target architecture, these are within the target
9sysroot and not cross/nativesdk; thus they weren't able to be
10found by gcc with the existing search paths. Add support for
11picking up these headers under the sysroot supplied on the gcc
12command line in order to resolve this.
13
14Upstream-Status: Pending
15
16Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 gcc/Makefile.in | 2 ++
20 gcc/cppdefault.c | 4 ++++
21 gcc/defaults.h | 9 +++++++++
22 gcc/gcc.c | 7 -------
23 4 files changed, 15 insertions(+), 7 deletions(-)
24
25diff --git a/gcc/Makefile.in b/gcc/Makefile.in
26index 7b49f88..cd5bc4a 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -582,6 +582,7 @@ libexecdir = @libexecdir@
30
31 # Directory in which the compiler finds libraries etc.
32 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
33+libsubdir_target = gcc/$(target_noncanonical)/$(version)
34 # Directory in which the compiler finds executables
35 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
36 # Directory in which all plugin resources are installed
37@@ -2610,6 +2611,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
38
39 PREPROCESSOR_DEFINES = \
40 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
41+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
42 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
43 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
44 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
45diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
46index 580c1ba..03a0287 100644
47--- a/gcc/cppdefault.c
48+++ b/gcc/cppdefault.c
49@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[]
50 /* This is the dir for gcc's private headers. */
51 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
52 #endif
53+#ifdef GCC_INCLUDE_SUBDIR_TARGET
54+ /* This is the dir for gcc's private headers under the specified sysroot. */
55+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
56+#endif
57 #ifdef LOCAL_INCLUDE_DIR
58 /* /usr/local/include comes before the fixincluded header files. */
59 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
60diff --git a/gcc/defaults.h b/gcc/defaults.h
61index 1d54798..983d45e 100644
62--- a/gcc/defaults.h
63+++ b/gcc/defaults.h
64@@ -1361,4 +1361,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
65
66 #endif /* GCC_INSN_FLAGS_H */
67
68+/* Default prefixes to attach to command names. */
69+
70+#ifndef STANDARD_STARTFILE_PREFIX_1
71+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
72+#endif
73+#ifndef STANDARD_STARTFILE_PREFIX_2
74+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
75+#endif
76+
77 #endif /* ! GCC_DEFAULTS_H */
78diff --git a/gcc/gcc.c b/gcc/gcc.c
79index e6efae7..3ca27b9 100644
80--- a/gcc/gcc.c
81+++ b/gcc/gcc.c
82@@ -1263,13 +1263,6 @@ static const char *gcc_libexec_prefix;
83
84 /* Default prefixes to attach to command names. */
85
86-#ifndef STANDARD_STARTFILE_PREFIX_1
87-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
88-#endif
89-#ifndef STANDARD_STARTFILE_PREFIX_2
90-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
91-#endif
92-
93 #ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
94 #undef MD_EXEC_PREFIX
95 #undef MD_STARTFILE_PREFIX
96--
972.6.3
98
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0033-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch b/meta/recipes-devtools/gcc/gcc-5.4/0033-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
deleted file mode 100644
index 19d480f3d7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0033-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From 629fcc7d0075c9b4261da6435e122429fb028ec0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 11:17:19 +0000
4Subject: [PATCH 33/46] gcc 4.8+ won't build with --disable-dependency-tracking
5
6since the *.Ppo files don't get created unless --enable-dependency-tracking is true.
7
8This patch ensures we only use those compiler options when its enabled.
9
10Upstream-Status: Submitted
11
12(Problem was already reported upstream, attached this patch there
13http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
14
15RP
162012/09/22
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 libatomic/Makefile.am | 3 ++-
21 libatomic/Makefile.in | 3 ++-
22 2 files changed, 4 insertions(+), 2 deletions(-)
23
24diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
25index 3d8ab62..23dff7e 100644
26--- a/libatomic/Makefile.am
27+++ b/libatomic/Makefile.am
28@@ -101,7 +101,8 @@ PAT_S = $(word 3,$(PAT_SPLIT))
29 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
30 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
31
32-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
33+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
34+@AMDEP_FALSE@M_DEPS =
35 M_SIZE = -DN=$(PAT_N)
36 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
37 M_FILE = $(PAT_BASE)_n.c
38diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
39index 9288652..3720256 100644
40--- a/libatomic/Makefile.in
41+++ b/libatomic/Makefile.in
42@@ -330,7 +330,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
43 PAT_S = $(word 3,$(PAT_SPLIT))
44 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
45 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
46-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
47+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
48+@AMDEP_FALSE@M_DEPS =
49 M_SIZE = -DN=$(PAT_N)
50 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
51 M_FILE = $(PAT_BASE)_n.c
52--
532.6.3
54
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0034-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta/recipes-devtools/gcc/gcc-5.4/0034-Don-t-search-host-directory-during-relink-if-inst_pr.patch
deleted file mode 100644
index a453fa6b34..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0034-Don-t-search-host-directory-during-relink-if-inst_pr.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From a4efc9ca85734c283d4da09b628121e1c1f49c4e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Mar 2015 08:21:19 +0000
4Subject: [PATCH 34/46] Don't search host directory during "relink" if
5 $inst_prefix is provided
6
7http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html
8
9Upstream-Status: Submitted
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 ltmain.sh | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/ltmain.sh b/ltmain.sh
17index 52bdbdb..82bcec3 100644
18--- a/ltmain.sh
19+++ b/ltmain.sh
20@@ -6004,12 +6004,13 @@ func_mode_link ()
21 fi
22 else
23 # We cannot seem to hardcode it, guess we'll fake it.
24+ # Default if $libdir is not relative to the prefix:
25 add_dir="-L$libdir"
26- # Try looking first in the location we're being installed to.
27+
28 if test -n "$inst_prefix_dir"; then
29 case $libdir in
30 [\\/]*)
31- add_dir="$add_dir -L$inst_prefix_dir$libdir"
32+ add_dir="-L$inst_prefix_dir$libdir"
33 ;;
34 esac
35 fi
36--
372.6.3
38
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0035-Dont-link-the-plugins-with-libgomp-explicitly.patch b/meta/recipes-devtools/gcc/gcc-5.4/0035-Dont-link-the-plugins-with-libgomp-explicitly.patch
deleted file mode 100644
index 6ed589beb8..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0035-Dont-link-the-plugins-with-libgomp-explicitly.patch
+++ /dev/null
@@ -1,83 +0,0 @@
1From 5b0125a792842ae02df507bc55555661cb10f9a3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 8 Mar 2015 03:41:39 +0000
4Subject: [PATCH 35/46] Dont link the plugins with libgomp explicitly
5
6They are dlopened by libgomp anyway. This fixes
7the libtool relink issue which causes issues during
8cross compilation
9
10libtool: install: /usr/bin/install -c .libs/libgomp.lai
11/home/ubuntu/work/bleeding/build-qemux86-64mc/tmp/work/core2-64-rdk-linux/gcc-runtime/5.0-r0/image/usr/lib/../lib/libgomp.la
12libtool: install: error: cannot install `libgomp-plugin-host_nonshm.la'
13to a directory not ending in /usr/lib
14Makefile:517: recipe for target 'install-toolexeclibLTLIBRARIES' failed
15make[2]: *** [install-toolexeclibLTLIBRARIES] Error 1
16
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 libgomp/Makefile.in | 7 +++----
20 libgomp/plugin/Makefrag.am | 3 +--
21 2 files changed, 4 insertions(+), 6 deletions(-)
22
23diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
24index b61b108..71b2627 100644
25--- a/libgomp/Makefile.in
26+++ b/libgomp/Makefile.in
27@@ -123,7 +123,7 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \
28 "$(DESTDIR)$(fincludedir)" "$(DESTDIR)$(libsubincludedir)" \
29 "$(DESTDIR)$(toolexeclibdir)"
30 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
31-libgomp_plugin_host_nonshm_la_DEPENDENCIES = libgomp.la
32+libgomp_plugin_host_nonshm_la_LIBADD =
33 am_libgomp_plugin_host_nonshm_la_OBJECTS = \
34 libgomp_plugin_host_nonshm_la-plugin-host.lo
35 libgomp_plugin_host_nonshm_la_OBJECTS = \
36@@ -133,7 +133,7 @@ libgomp_plugin_host_nonshm_la_LINK = $(LIBTOOL) --tag=CC \
37 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
38 $(libgomp_plugin_host_nonshm_la_LDFLAGS) $(LDFLAGS) -o $@
39 am__DEPENDENCIES_1 =
40-@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_DEPENDENCIES = libgomp.la \
41+@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_DEPENDENCIES = \
42 @PLUGIN_NVPTX_TRUE@ $(am__DEPENDENCIES_1)
43 @PLUGIN_NVPTX_TRUE@am_libgomp_plugin_nvptx_la_OBJECTS = \
44 @PLUGIN_NVPTX_TRUE@ libgomp_plugin_nvptx_la-plugin-nvptx.lo
45@@ -407,7 +407,7 @@ libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
46 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LDFLAGS = \
47 @PLUGIN_NVPTX_TRUE@ $(libgomp_plugin_nvptx_version_info) \
48 @PLUGIN_NVPTX_TRUE@ $(lt_host_flags) $(PLUGIN_NVPTX_LDFLAGS)
49-@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBADD = libgomp.la $(PLUGIN_NVPTX_LIBS)
50+@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBADD = $(PLUGIN_NVPTX_LIBS)
51 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
52 libgomp_plugin_host_nonshm_version_info = -version-info $(libtool_VERSION)
53 libgomp_plugin_host_nonshm_la_SOURCES = plugin/plugin-host.c
54@@ -415,7 +415,6 @@ libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
55 libgomp_plugin_host_nonshm_la_LDFLAGS = \
56 $(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
57
58-libgomp_plugin_host_nonshm_la_LIBADD = libgomp.la
59 libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
60 nodist_noinst_HEADERS = libgomp_f.h
61 nodist_libsubinclude_HEADERS = omp.h openacc.h
62diff --git a/libgomp/plugin/Makefrag.am b/libgomp/plugin/Makefrag.am
63index 167485f..d2c5428 100644
64--- a/libgomp/plugin/Makefrag.am
65+++ b/libgomp/plugin/Makefrag.am
66@@ -35,7 +35,7 @@ libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_NVPTX_CPPFLAGS)
67 libgomp_plugin_nvptx_la_LDFLAGS = $(libgomp_plugin_nvptx_version_info) \
68 $(lt_host_flags)
69 libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS)
70-libgomp_plugin_nvptx_la_LIBADD = libgomp.la $(PLUGIN_NVPTX_LIBS)
71+libgomp_plugin_nvptx_la_LIBADD = $(PLUGIN_NVPTX_LIBS)
72 libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
73 endif
74
75@@ -45,5 +45,4 @@ libgomp_plugin_host_nonshm_la_SOURCES = plugin/plugin-host.c
76 libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
77 libgomp_plugin_host_nonshm_la_LDFLAGS = \
78 $(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
79-libgomp_plugin_host_nonshm_la_LIBADD = libgomp.la
80 libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
81--
822.6.3
83
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0036-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/meta/recipes-devtools/gcc/gcc-5.4/0036-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
deleted file mode 100644
index 41c0294da4..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0036-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From b0b0688176a9482777e9b2e98408bfc4505d31af Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 28 Apr 2015 23:15:27 -0700
4Subject: [PATCH 36/46] Use SYSTEMLIBS_DIR replacement instead of hardcoding
5 base_libdir
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 gcc/config/aarch64/aarch64-linux.h | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
13index 257acf0..abeb948 100644
14--- a/gcc/config/aarch64/aarch64-linux.h
15+++ b/gcc/config/aarch64/aarch64-linux.h
16@@ -21,7 +21,7 @@
17 #ifndef GCC_AARCH64_LINUX_H
18 #define GCC_AARCH64_LINUX_H
19
20-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
21+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
22
23 #undef ASAN_CC1_SPEC
24 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
25--
262.6.3
27
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0037-aarch64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc-5.4/0037-aarch64-Add-support-for-musl-ldso.patch
deleted file mode 100644
index 30dbe74ef2..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0037-aarch64-Add-support-for-musl-ldso.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From 420ca64a86d560a77ee596a9774d672b08ca8278 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 28 Apr 2015 23:18:39 -0700
4Subject: [PATCH 37/46] aarch64: Add support for musl ldso
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 gcc/config/aarch64/aarch64-linux.h | 2 ++
9 1 file changed, 2 insertions(+)
10
11diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
12index abeb948..f9e65fc 100644
13--- a/gcc/config/aarch64/aarch64-linux.h
14+++ b/gcc/config/aarch64/aarch64-linux.h
15@@ -23,6 +23,8 @@
16
17 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
18
19+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64.so.1"
20+
21 #undef ASAN_CC1_SPEC
22 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
23
24--
252.6.3
26
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0038-fix-g-sysroot.patch b/meta/recipes-devtools/gcc/gcc-5.4/0038-fix-g-sysroot.patch
deleted file mode 100644
index 9ba574a5c6..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0038-fix-g-sysroot.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1From 8df3e7007a22c9d6be5d5ae4b9b169c5c8431917 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 27 May 2015 17:06:06 -0700
4Subject: [PATCH 38/46] fix g++ sysroot
5
6Portions of
7
8http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
9
10are not upstreamed yet. So lets keep missing pieces.
11
12Upstream-Status: Pending
13
14Without this, compiling something simple like #include <limits> on target
15with c++ test.cpp fails unable to find the header. strace shows it looking in
16usr/include/xxxx rather than /usr/include/xxxx
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/configure | 4 +++-
21 gcc/configure.ac | 4 +++-
22 2 files changed, 6 insertions(+), 2 deletions(-)
23
24diff --git a/gcc/configure b/gcc/configure
25index 9b60aad..6df594c 100755
26--- a/gcc/configure
27+++ b/gcc/configure
28@@ -3375,7 +3375,9 @@ gcc_gxx_include_dir_add_sysroot=0
29 if test "${with_sysroot+set}" = set; then
30 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
31 if test "${gcc_gxx_without_sysroot}"; then
32- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
33+ if test x${with_sysroot} != x/; then
34+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
35+ fi
36 gcc_gxx_include_dir_add_sysroot=1
37 fi
38 fi
39diff --git a/gcc/configure.ac b/gcc/configure.ac
40index e1e54f2..3bb2173 100644
41--- a/gcc/configure.ac
42+++ b/gcc/configure.ac
43@@ -152,7 +152,9 @@ gcc_gxx_include_dir_add_sysroot=0
44 if test "${with_sysroot+set}" = set; then
45 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
46 if test "${gcc_gxx_without_sysroot}"; then
47- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
48+ if test x${with_sysroot} != x/; then
49+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
50+ fi
51 gcc_gxx_include_dir_add_sysroot=1
52 fi
53 fi
54--
552.6.3
56
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta/recipes-devtools/gcc/gcc-5.4/0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch
deleted file mode 100644
index 2e0df968bd..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From 1eede9e4a10d3532db826a6eeced695df3ad5b89 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sun, 5 Jul 2015 20:25:18 -0700
4Subject: [PATCH 39/46] libcc1: fix libcc1's install path and rpath
5
6* Install libcc1.so and libcc1plugin.so into
7 $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we
8 had done to lto-plugin.
9* Fix bad RPATH iussue:
10 gcc-5.2.0: package gcc-plugins contains bad RPATH /patht/to/tmp/sysroots/qemux86-64/usr/lib64/../lib64 in file
11 /path/to/gcc/5.2.0-r0/packages-split/gcc-plugins/usr/lib64/gcc/x86_64-poky-linux/5.2.0/plugin/libcc1plugin.so.0.0.0
12 [rpaths]
13
14Upstream-Status: Inappropriate [OE configuration]
15
16Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
17---
18 libcc1/Makefile.am | 4 ++--
19 libcc1/Makefile.in | 4 ++--
20 2 files changed, 4 insertions(+), 4 deletions(-)
21
22diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
23index 7a274b3..db69bea 100644
24--- a/libcc1/Makefile.am
25+++ b/libcc1/Makefile.am
26@@ -35,8 +35,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
27 $(Wc)$(libiberty_normal)))
28 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
29
30-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
31-cc1libdir = $(libdir)/$(libsuffix)
32+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
33+plugindir = $(cc1libdir)
34
35 if ENABLE_PLUGIN
36 plugin_LTLIBRARIES = libcc1plugin.la
37diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
38index 1916134..c8995d2 100644
39--- a/libcc1/Makefile.in
40+++ b/libcc1/Makefile.in
41@@ -262,8 +262,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
42 $(Wc)$(libiberty_normal)))
43
44 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
45-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
46-cc1libdir = $(libdir)/$(libsuffix)
47+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
48+plugindir = $(cc1libdir)
49 @ENABLE_PLUGIN_TRUE@plugin_LTLIBRARIES = libcc1plugin.la
50 @ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la
51 BUILT_SOURCES = compiler-name.h
52--
532.6.3
54
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0040-handle-sysroot-support-for-nativesdk-gcc.patch b/meta/recipes-devtools/gcc/gcc-5.4/0040-handle-sysroot-support-for-nativesdk-gcc.patch
deleted file mode 100644
index 11e1310f14..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0040-handle-sysroot-support-for-nativesdk-gcc.patch
+++ /dev/null
@@ -1,213 +0,0 @@
1From b41674d357c4ba320b9860e0f313d2f5a332f27d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:39:54 +0000
4Subject: [PATCH 40/46] handle sysroot support for nativesdk-gcc
5
6Being able to build a nativesdk gcc is useful, particularly in cases
7where the host compiler may be of an incompatible version (or a 32
8bit compiler is needed).
9
10Sadly, building nativesdk-gcc is not straight forward. We install
11nativesdk-gcc into a relocatable location and this means that its
12library locations can change. "Normal" sysroot support doesn't help
13in this case since the values of paths like "libdir" change, not just
14base root directory of the system.
15
16In order to handle this we do two things:
17
18a) Add %r into spec file markup which can be used for injected paths
19 such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
20b) Add other paths which need relocation into a .gccrelocprefix section
21 which the relocation code will notice and adjust automatically.
22
23Upstream-Status: Inappropriate
24RP 2015/7/28
25
26Signed-off-by: Khem Raj <raj.khem@gmail.com>
27---
28 gcc/cppdefault.c | 50 +++++++++++++++++++++++++++++++++++++-------------
29 gcc/cppdefault.h | 3 ++-
30 gcc/gcc.c | 20 ++++++++++++++------
31 3 files changed, 53 insertions(+), 20 deletions(-)
32
33diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
34index 03a0287..f44c1d8 100644
35--- a/gcc/cppdefault.c
36+++ b/gcc/cppdefault.c
37@@ -35,6 +35,30 @@
38 # undef CROSS_INCLUDE_DIR
39 #endif
40
41+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
42+static char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
43+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
44+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
45+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
46+#ifdef LOCAL_INCLUDE_DIR
47+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
48+#endif
49+#ifdef PREFIX_INCLUDE_DIR
50+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
51+#endif
52+#ifdef FIXED_INCLUDE_DIR
53+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
54+#endif
55+#ifdef CROSS_INCLUDE_DIR
56+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
57+#endif
58+#ifdef TOOL_INCLUDE_DIR
59+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
60+#endif
61+#ifdef NATIVE_SYSTEM_HEADER_DIR
62+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
63+#endif
64+
65 const struct default_include cpp_include_defaults[]
66 #ifdef INCLUDE_DEFAULTS
67 = INCLUDE_DEFAULTS;
68@@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[]
69 = {
70 #ifdef GPLUSPLUS_INCLUDE_DIR
71 /* Pick up GNU C++ generic include files. */
72- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
73+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
74 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
75 #endif
76 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
77 /* Pick up GNU C++ target-dependent include files. */
78- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
79+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
80 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
81 #endif
82 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
83 /* Pick up GNU C++ backward and deprecated include files. */
84- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
85+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
86 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
87 #endif
88 #ifdef GCC_INCLUDE_DIR
89 /* This is the dir for gcc's private headers. */
90- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
91+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
92 #endif
93 #ifdef GCC_INCLUDE_SUBDIR_TARGET
94 /* This is the dir for gcc's private headers under the specified sysroot. */
95- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
96+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
97 #endif
98 #ifdef LOCAL_INCLUDE_DIR
99 /* /usr/local/include comes before the fixincluded header files. */
100- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
101- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
102+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
103+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
104 #endif
105 #ifdef PREFIX_INCLUDE_DIR
106- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
107+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
108 #endif
109 #ifdef FIXED_INCLUDE_DIR
110 /* This is the dir for fixincludes. */
111- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
112+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
113 /* A multilib suffix needs adding if different multilibs use
114 different headers. */
115 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
116@@ -85,16 +109,16 @@ const struct default_include cpp_include_defaults[]
117 #endif
118 #ifdef CROSS_INCLUDE_DIR
119 /* One place the target system's headers might be. */
120- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
121+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
122 #endif
123 #ifdef TOOL_INCLUDE_DIR
124 /* Another place the target system's headers might be. */
125- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
126+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
127 #endif
128 #ifdef NATIVE_SYSTEM_HEADER_DIR
129 /* /usr/include comes dead last. */
130- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
131- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
132+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
133+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
134 #endif
135 { 0, 0, 0, 0, 0, 0 }
136 };
137diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
138index c98644f..4198669 100644
139--- a/gcc/cppdefault.h
140+++ b/gcc/cppdefault.h
141@@ -33,7 +33,8 @@
142
143 struct default_include
144 {
145- const char *const fname; /* The name of the directory. */
146+ const char *fname; /* The name of the directory. */
147+
148 const char *const component; /* The component containing the directory
149 (see update_path in prefix.c) */
150 const char cplusplus; /* Only look here if we're compiling C++. */
151diff --git a/gcc/gcc.c b/gcc/gcc.c
152index 3ca27b9..2b7756e 100644
153--- a/gcc/gcc.c
154+++ b/gcc/gcc.c
155@@ -120,6 +120,8 @@ static const char *target_system_root = TARGET_SYSTEM_ROOT;
156 #else
157 static const char *target_system_root = 0;
158 #endif
159+
160+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
161
162 /* Nonzero means pass the updated target_system_root to the compiler. */
163
164@@ -390,6 +392,7 @@ or with constant text in a single argument.
165 %G process LIBGCC_SPEC as a spec.
166 %R Output the concatenation of target_system_root and
167 target_sysroot_suffix.
168+ %r Output the base path target_relocatable_prefix
169 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
170 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
171 %C process CPP_SPEC as a spec.
172@@ -1286,10 +1289,10 @@ static const char *gcc_libexec_prefix;
173 gcc_exec_prefix is set because, in that case, we know where the
174 compiler has been installed, and use paths relative to that
175 location instead. */
176-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
177-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
178-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
179-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
180+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
181+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
182+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
183+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
184
185 /* For native compilers, these are well-known paths containing
186 components that may be provided by the system. For cross
187@@ -1297,9 +1300,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
188 static const char *md_exec_prefix = MD_EXEC_PREFIX;
189 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
190 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
191-static const char *const standard_startfile_prefix_1
192+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
193 = STANDARD_STARTFILE_PREFIX_1;
194-static const char *const standard_startfile_prefix_2
195+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
196 = STANDARD_STARTFILE_PREFIX_2;
197
198 /* A relative path to be used in finding the location of tools
199@@ -5523,6 +5526,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
200 }
201 break;
202
203+ case 'r':
204+ obstack_grow (&obstack, target_relocatable_prefix,
205+ strlen (target_relocatable_prefix));
206+ break;
207+
208 case 'S':
209 value = do_spec_1 (startfile_spec, 0, NULL);
210 if (value != 0)
211--
2122.6.3
213
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0041-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta/recipes-devtools/gcc/gcc-5.4/0041-Search-target-sysroot-gcc-version-specific-dirs-with.patch
deleted file mode 100644
index 5a504a1f22..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0041-Search-target-sysroot-gcc-version-specific-dirs-with.patch
+++ /dev/null
@@ -1,102 +0,0 @@
1From 99cadb4d8415dd5a275d7d6410f20db33d0f8433 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:41:45 +0000
4Subject: [PATCH 41/46] Search target sysroot gcc version specific dirs with
5 multilib.
6
7We install the gcc libraries (such as crtbegin.p) into
8<sysroot><libdir>/<target-sys>/5.2.0/
9which is a default search path for GCC (aka multi_suffix in the
10code below). <target-sys> is 'machine' in gcc's terminology. We use
11these directories so that multiple gcc versions could in theory
12co-exist on target.
13
14We only want to build one gcc-cross-canadian per arch and have this work
15for all multilibs. <target-sys> can be handled by mapping the multilib
16<target-sys> to the one used by gcc-cross-canadian, e.g.
17mips64-polkmllib32-linux
18is symlinked to by mips64-poky-linux.
19
20The default gcc search path in the target sysroot for a "lib64" mutlilib
21is:
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
30which means that the lib32 crtbegin.o will be found and the lib64 ones
31will not which leads to compiler failures.
32
33This patch injects a multilib version of that path first so the lib64
34binaries 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
45Upstream-Status: Pending
46RP 2015/7/31
47
48Signed-off-by: Khem Raj <raj.khem@gmail.com>
49---
50 gcc/gcc.c | 29 ++++++++++++++++++++++++++++-
51 1 file changed, 28 insertions(+), 1 deletion(-)
52
53diff --git a/gcc/gcc.c b/gcc/gcc.c
54index 2b7756e..8f53aea 100644
55--- a/gcc/gcc.c
56+++ b/gcc/gcc.c
57@@ -2305,7 +2305,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@@ -2317,6 +2317,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)
100--
1012.6.3
102
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0042-Fix-various-_FOR_BUILD-and-related-variables.patch b/meta/recipes-devtools/gcc/gcc-5.4/0042-Fix-various-_FOR_BUILD-and-related-variables.patch
deleted file mode 100644
index 5af764b7c7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0042-Fix-various-_FOR_BUILD-and-related-variables.patch
+++ /dev/null
@@ -1,137 +0,0 @@
1From 78e77206902349c9256f06c3dd179197a39af2e1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:42:45 +0000
4Subject: [PATCH 42/46] Fix various _FOR_BUILD and related variables
5
6When doing a FOR_BUILD thing, you have to override CFLAGS with
7CFLAGS_FOR_BUILD. And if you use C++, you also have to override
8CXXFLAGS with CXXFLAGS_FOR_BUILD.
9Without this, when building for mingw, you end up trying to use
10the mingw headers for a host build.
11
12The same goes for other variables as well, such as CPPFLAGS,
13CPP, and GMPINC.
14
15Upstream-Status: Pending
16
17Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
18Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 Makefile.in | 6 ++++++
22 Makefile.tpl | 5 +++++
23 gcc/Makefile.in | 2 +-
24 gcc/configure | 2 +-
25 gcc/configure.ac | 2 +-
26 5 files changed, 14 insertions(+), 3 deletions(-)
27
28diff --git a/Makefile.in b/Makefile.in
29index a783e1e..8b6d3d2 100644
30--- a/Makefile.in
31+++ b/Makefile.in
32@@ -152,6 +152,7 @@ BUILD_EXPORTS = \
33 CPP="$(CC_FOR_BUILD) -E"; export CPP; \
34 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
35 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
36+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
37 CXX="$(CXX_FOR_BUILD)"; export CXX; \
38 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
39 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
40@@ -170,6 +171,9 @@ BUILD_EXPORTS = \
41 # built for the build system to override those in BASE_FLAGS_TO_PASS.
42 EXTRA_BUILD_FLAGS = \
43 CFLAGS="$(CFLAGS_FOR_BUILD)" \
44+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
45+ CPP="$(CC_FOR_BUILD) -E" \
46+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
47 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
48
49 # This is the list of directories to built for the host system.
50@@ -187,6 +191,7 @@ HOST_SUBDIR = @host_subdir@
51 HOST_EXPORTS = \
52 $(BASE_EXPORTS) \
53 CC="$(CC)"; export CC; \
54+ CPP="$(CC) -E"; export CPP; \
55 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
56 CFLAGS="$(CFLAGS)"; export CFLAGS; \
57 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
58@@ -710,6 +715,7 @@ BASE_FLAGS_TO_PASS = \
59 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
60 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
61 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
62+ "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
63 "EXPECT=$(EXPECT)" \
64 "FLEX=$(FLEX)" \
65 "INSTALL=$(INSTALL)" \
66diff --git a/Makefile.tpl b/Makefile.tpl
67index 1ea1954..78a59c3 100644
68--- a/Makefile.tpl
69+++ b/Makefile.tpl
70@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
71 CC="$(CC_FOR_BUILD)"; export CC; \
72 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
73 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
74+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
75 CXX="$(CXX_FOR_BUILD)"; export CXX; \
76 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
77 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
78@@ -172,6 +173,9 @@ BUILD_EXPORTS = \
79 # built for the build system to override those in BASE_FLAGS_TO_PASS.
80 EXTRA_BUILD_FLAGS = \
81 CFLAGS="$(CFLAGS_FOR_BUILD)" \
82+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
83+ CPP="$(CC_FOR_BUILD) -E" \
84+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
85 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
86
87 # This is the list of directories to built for the host system.
88@@ -189,6 +193,7 @@ HOST_SUBDIR = @host_subdir@
89 HOST_EXPORTS = \
90 $(BASE_EXPORTS) \
91 CC="$(CC)"; export CC; \
92+ CPP="$(CC) -E"; export CPP; \
93 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
94 CFLAGS="$(CFLAGS)"; export CFLAGS; \
95 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
96diff --git a/gcc/Makefile.in b/gcc/Makefile.in
97index cd5bc4a..98ae4f4 100644
98--- a/gcc/Makefile.in
99+++ b/gcc/Makefile.in
100@@ -762,7 +762,7 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
101 # Native linker and preprocessor flags. For x-fragment overrides.
102 BUILD_LDFLAGS=@BUILD_LDFLAGS@
103 BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
104- -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
105+ -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS_FOR_BUILD)
106
107 # Actual name to use when installing a native compiler.
108 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
109diff --git a/gcc/configure b/gcc/configure
110index 6df594c..fcb05e7 100755
111--- a/gcc/configure
112+++ b/gcc/configure
113@@ -11521,7 +11521,7 @@ else
114 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
115 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
116 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
117- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
118+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
119 ${realsrcdir}/configure \
120 --enable-languages=${enable_languages-all} \
121 --target=$target_alias --host=$build_alias --build=$build_alias
122diff --git a/gcc/configure.ac b/gcc/configure.ac
123index 3bb2173..923bc9a 100644
124--- a/gcc/configure.ac
125+++ b/gcc/configure.ac
126@@ -1633,7 +1633,7 @@ else
127 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
128 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
129 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
130- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
131+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
132 ${realsrcdir}/configure \
133 --enable-languages=${enable_languages-all} \
134 --target=$target_alias --host=$build_alias --build=$build_alias
135--
1362.6.3
137
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0043-libstdc-Support-musl.patch b/meta/recipes-devtools/gcc/gcc-5.4/0043-libstdc-Support-musl.patch
deleted file mode 100644
index bad8402ef8..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0043-libstdc-Support-musl.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From df430b943a2df6b72054c808d4b93338a82562de Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Dec 2015 08:23:34 +0000
4Subject: [PATCH 43/46] libstdc++: Support musl
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 libstdc++-v3/configure.host | 10 ++++++++++
11 1 file changed, 10 insertions(+)
12
13diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
14index 640199c..1756444 100644
15--- a/libstdc++-v3/configure.host
16+++ b/libstdc++-v3/configure.host
17@@ -274,14 +274,24 @@ case "${host_os}" in
18 os_include_dir="os/bsd/freebsd"
19 ;;
20 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
21+ # check for musl by target
22+ case "${host_os}" in
23+ *-musl*)
24+ os_include_dir="os/generic"
25+ ;;
26+ *)
27 if [ "$uclibc" = "yes" ]; then
28 os_include_dir="os/uclibc"
29 elif [ "$bionic" = "yes" ]; then
30 os_include_dir="os/bionic"
31+ elif [ "$musl" = "yes" ]; then
32+ os_include_dir="os/generic"
33 else
34 os_include_dir="os/gnu-linux"
35 fi
36 ;;
37+ esac
38+ ;;
39 hpux*)
40 os_include_dir="os/hpux"
41 ;;
42--
432.6.3
44
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0044-Adding-mmusl-as-a-musl-libc-specifier-and-the-necess.patch b/meta/recipes-devtools/gcc/gcc-5.4/0044-Adding-mmusl-as-a-musl-libc-specifier-and-the-necess.patch
deleted file mode 100644
index 26aa96cad9..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0044-Adding-mmusl-as-a-musl-libc-specifier-and-the-necess.patch
+++ /dev/null
@@ -1,270 +0,0 @@
1From 0b54799d80fb859c7b142467e4d42c99db59df50 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Dec 2015 08:30:35 +0000
4Subject: [PATCH 44/46] Adding -mmusl as a musl libc specifier, and the
5 necessary hacks for it to know how to find musl's dynamic linker.
6
7Upstream-Status: Backport [partial]
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 gcc/config.gcc | 10 ++++-
11 gcc/config/linux.h | 100 +++++++++++++++++++++++++++++++++++++-----
12 gcc/config/linux.opt | 4 ++
13 gcc/config/rs6000/secureplt.h | 1 +
14 gcc/config/rs6000/sysv4.h | 5 +++
15 gcc/ginclude/stddef.h | 3 ++
16 6 files changed, 110 insertions(+), 13 deletions(-)
17
18Index: gcc-5.4.0/gcc/config.gcc
19===================================================================
20--- gcc-5.4.0.orig/gcc/config.gcc
21+++ gcc-5.4.0/gcc/config.gcc
22@@ -575,7 +575,7 @@ case ${target} in
23 esac
24
25 # Common C libraries.
26-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
27+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
28
29 # 32-bit x86 processors supported by --with-arch=. Each processor
30 # MUST be separated by exactly one space.
31@@ -720,6 +720,9 @@ case ${target} in
32 *-*-*uclibc*)
33 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
34 ;;
35+ *-*-*musl*)
36+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
37+ ;;
38 *)
39 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
40 ;;
41@@ -2420,6 +2423,11 @@ powerpc*-*-linux*)
42 powerpc*-*-linux*paired*)
43 tm_file="${tm_file} rs6000/750cl.h" ;;
44 esac
45+ case ${target} in
46+ *-linux*-musl*)
47+ enable_secureplt=yes ;;
48+ esac
49+
50 if test x${enable_secureplt} = xyes; then
51 tm_file="rs6000/secureplt.h ${tm_file}"
52 fi
53Index: gcc-5.4.0/gcc/config/linux.h
54===================================================================
55--- gcc-5.4.0.orig/gcc/config/linux.h
56+++ gcc-5.4.0/gcc/config/linux.h
57@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
58 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
59 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
60 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
61+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
62 #else
63 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
64 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
65 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
66+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
67 #endif
68
69 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
70@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTI
71 uClibc or Bionic is the default C library and whether
72 -muclibc or -mglibc or -mbionic has been passed to change the default. */
73
74-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
75- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
76+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
77+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
78
79 #if DEFAULT_LIBC == LIBC_GLIBC
80-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
81- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
82+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
83+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
84 #elif DEFAULT_LIBC == LIBC_UCLIBC
85-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
86- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
87+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
88+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
89 #elif DEFAULT_LIBC == LIBC_BIONIC
90-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
91- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
92+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
93+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
94+#elif DEFAULT_LIBC == LIBC_MUSL
95+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
96+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
97 #else
98 #error "Unsupported DEFAULT_LIBC"
99 #endif /* DEFAULT_LIBC */
100@@ -84,16 +89,16 @@ see the files COPYING3 and COPYING.RUNTI
101
102 #define GNU_USER_DYNAMIC_LINKER \
103 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
104- BIONIC_DYNAMIC_LINKER)
105+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
106 #define GNU_USER_DYNAMIC_LINKER32 \
107 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
108- BIONIC_DYNAMIC_LINKER32)
109+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
110 #define GNU_USER_DYNAMIC_LINKER64 \
111 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
112- BIONIC_DYNAMIC_LINKER64)
113+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
114 #define GNU_USER_DYNAMIC_LINKERX32 \
115 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
116- BIONIC_DYNAMIC_LINKERX32)
117+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
118
119 /* Whether we have Bionic libc runtime */
120 #undef TARGET_HAS_BIONIC
121@@ -123,3 +128,74 @@ see the files COPYING3 and COPYING.RUNTI
122 # define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
123
124 #endif
125+
126+/* musl avoids problematic includes by rearranging the include directories.
127+ * Unfortunately, this is mostly duplicated from cppdefault.c */
128+#if DEFAULT_LIBC == LIBC_MUSL
129+#define INCLUDE_DEFAULTS_MUSL_GPP \
130+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
131+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
132+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
133+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
134+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
135+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
136+
137+#ifdef LOCAL_INCLUDE_DIR
138+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
139+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
140+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
141+#else
142+#define INCLUDE_DEFAULTS_MUSL_LOCAL
143+#endif
144+
145+#ifdef PREFIX_INCLUDE_DIR
146+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
147+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
148+#else
149+#define INCLUDE_DEFAULTS_MUSL_PREFIX
150+#endif
151+
152+#ifdef CROSS_INCLUDE_DIR
153+#define INCLUDE_DEFAULTS_MUSL_CROSS \
154+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
155+#else
156+#define INCLUDE_DEFAULTS_MUSL_CROSS
157+#endif
158+
159+#ifdef TOOL_INCLUDE_DIR
160+#define INCLUDE_DEFAULTS_MUSL_TOOL \
161+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
162+#else
163+#define INCLUDE_DEFAULTS_MUSL_TOOL
164+#endif
165+
166+#ifdef NATIVE_SYSTEM_HEADER_DIR
167+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
168+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
169+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
170+#else
171+#define INCLUDE_DEFAULTS_MUSL_NATIVE
172+#endif
173+
174+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
175+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
176+# define INCLUDE_DEFAULTS_MUSL_LOCAL
177+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
178+# define INCLUDE_DEFAULTS_MUSL_NATIVE
179+#else
180+# undef INCLUDE_DEFAULTS_MUSL_CROSS
181+# define INCLUDE_DEFAULTS_MUSL_CROSS
182+#endif
183+
184+#undef INCLUDE_DEFAULTS
185+#define INCLUDE_DEFAULTS \
186+ { \
187+ INCLUDE_DEFAULTS_MUSL_GPP \
188+ INCLUDE_DEFAULTS_MUSL_PREFIX \
189+ INCLUDE_DEFAULTS_MUSL_CROSS \
190+ INCLUDE_DEFAULTS_MUSL_TOOL \
191+ INCLUDE_DEFAULTS_MUSL_NATIVE \
192+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
193+ { 0, 0, 0, 0, 0, 0 } \
194+ }
195+#endif
196Index: gcc-5.4.0/gcc/config/linux.opt
197===================================================================
198--- gcc-5.4.0.orig/gcc/config/linux.opt
199+++ gcc-5.4.0/gcc/config/linux.opt
200@@ -28,5 +28,9 @@ Target Report RejectNegative Var(linux_l
201 Use GNU C library
202
203 muclibc
204-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
205+Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl)
206 Use uClibc C library
207+
208+mmusl
209+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic)
210+Use musl C library
211Index: gcc-5.4.0/gcc/config/rs6000/secureplt.h
212===================================================================
213--- gcc-5.4.0.orig/gcc/config/rs6000/secureplt.h
214+++ gcc-5.4.0/gcc/config/rs6000/secureplt.h
215@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
216 <http://www.gnu.org/licenses/>. */
217
218 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
219+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
220Index: gcc-5.4.0/gcc/config/rs6000/sysv4.h
221===================================================================
222--- gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h
223+++ gcc-5.4.0/gcc/config/rs6000/sysv4.h
224@@ -538,6 +538,10 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
225 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
226 #endif
227
228+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
229+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
230+#endif
231+
232 /* Pass -G xxx to the compiler. */
233 #undef CC1_SPEC
234 #define CC1_SPEC "%{G*} %(cc1_cpu)" \
235@@ -889,6 +893,7 @@ ncrtn.o%s"
236 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
237 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
238 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
239+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
240 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
241 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
242 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
243Index: gcc-5.4.0/gcc/ginclude/stddef.h
244===================================================================
245--- gcc-5.4.0.orig/gcc/ginclude/stddef.h
246+++ gcc-5.4.0/gcc/ginclude/stddef.h
247@@ -184,6 +184,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
248 #ifndef _GCC_SIZE_T
249 #ifndef _SIZET_
250 #ifndef __size_t
251+#ifndef __DEFINED_size_t /* musl */
252 #define __size_t__ /* BeOS */
253 #define __SIZE_T__ /* Cray Unicos/Mk */
254 #define _SIZE_T
255@@ -200,6 +201,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
256 #define ___int_size_t_h
257 #define _GCC_SIZE_T
258 #define _SIZET_
259+#define __DEFINED_size_t /* musl */
260 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
261 || defined(__DragonFly__) \
262 || defined(__FreeBSD_kernel__)
263@@ -218,6 +220,7 @@ typedef __SIZE_TYPE__ size_t;
264 typedef long ssize_t;
265 #endif /* __BEOS__ */
266 #endif /* !(defined (__GNUG__) && defined (size_t)) */
267+#endif /* __DEFINED_size_t */
268 #endif /* __size_t */
269 #endif /* _SIZET_ */
270 #endif /* _GCC_SIZE_T */
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0045-Support-for-arm-linux-musl.patch b/meta/recipes-devtools/gcc/gcc-5.4/0045-Support-for-arm-linux-musl.patch
deleted file mode 100644
index 3c1115aa86..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0045-Support-for-arm-linux-musl.patch
+++ /dev/null
@@ -1,216 +0,0 @@
1From a6c649571d49c972e6d207577780ada7e9b6bad5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Dec 2015 08:31:52 +0000
4Subject: [PATCH 45/57] Support for arm-linux-musl.
5
6Fix musl ldso for all arches
7
8Upstream-Status: backport [partial]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 gcc/config/aarch64/aarch64-linux.h | 1 +
12 gcc/config/arm/linux-eabi.h | 17 +++++++++++++++++
13 gcc/config/i386/linux.h | 1 +
14 gcc/config/i386/linux64.h | 5 +++++
15 gcc/config/mips/linux.h | 8 +++++++-
16 gcc/config/rs6000/linux64.h | 13 +++++++++----
17 gcc/config/rs6000/sysv4.h | 10 +++++++---
18 libitm/config/arm/hwcap.cc | 4 ++++
19 libitm/config/linux/x86/tls.h | 8 ++++++--
20 9 files changed, 57 insertions(+), 10 deletions(-)
21
22diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
23index f9e65fc..1b2d0c0 100644
24--- a/gcc/config/aarch64/aarch64-linux.h
25+++ b/gcc/config/aarch64/aarch64-linux.h
26@@ -22,6 +22,7 @@
27 #define GCC_AARCH64_LINUX_H
28
29 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
30+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64.so.1"
31
32 #define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64.so.1"
33
34diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
35index 048a062..adb9c44 100644
36--- a/gcc/config/arm/linux-eabi.h
37+++ b/gcc/config/arm/linux-eabi.h
38@@ -81,6 +81,23 @@
39 #undef TARGET_FIX_V4BX_SPEC
40 #define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
41
42+/* For ARM musl currently supports four dynamic linkers:
43+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
44+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
45+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
46+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
47+ musl does not support the legacy OABI mode.
48+ All the dynamic linkers live in /lib.
49+ We default to soft-float, EL. */
50+#undef MUSL_DYNAMIC_LINKER
51+#if TARGET_BIG_ENDIAN_DEFAULT
52+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
53+#else
54+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
55+#endif
56+#define MUSL_DYNAMIC_LINKER \
57+ SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
58+
59 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
60 use the GNU/Linux version, not the generic BPABI version. */
61 #undef LINK_SPEC
62diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
63index 21ba2b2..e2b81e5 100644
64--- a/gcc/config/i386/linux.h
65+++ b/gcc/config/i386/linux.h
66@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3. If not see
67
68 #define GNU_USER_LINK_EMULATION "elf_i386"
69 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
70+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
71diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
72index 6185cce..5a3a977 100644
73--- a/gcc/config/i386/linux64.h
74+++ b/gcc/config/i386/linux64.h
75@@ -30,3 +30,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
76 #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
77 #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
78 #define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
79+
80+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
81+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
82+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
83+
84diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
85index c306afb..b899388 100644
86--- a/gcc/config/mips/linux.h
87+++ b/gcc/config/mips/linux.h
88@@ -21,6 +21,12 @@ along with GCC; see the file COPYING3. If not see
89 #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
90 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
91
92+#undef MUSL_DYNAMIC_LINKER32
93+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1"
94+#undef MUSL_DYNAMIC_LINKER64
95+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1"
96+#define MUSL_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1"
97+
98 #define GLIBC_DYNAMIC_LINKER32 \
99 "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
100 #define GLIBC_DYNAMIC_LINKER64 \
101@@ -40,4 +46,4 @@ along with GCC; see the file COPYING3. If not see
102 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
103 #define GNU_USER_DYNAMIC_LINKERN32 \
104 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
105- BIONIC_DYNAMIC_LINKERN32)
106+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
107diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
108index 31c4338..679da4b 100644
109--- a/gcc/config/rs6000/linux64.h
110+++ b/gcc/config/rs6000/linux64.h
111@@ -365,17 +365,22 @@ extern int dot_symbols;
112 #endif
113 #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
114 #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
115+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-powerpc.so.1"
116+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-powerpc64.so.1"
117+
118 #if DEFAULT_LIBC == LIBC_UCLIBC
119-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
120+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
121 #elif DEFAULT_LIBC == LIBC_GLIBC
122-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
123+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
124+#elif DEFAULT_LIBC == LIBC_MUSL
125+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
126 #else
127 #error "Unsupported DEFAULT_LIBC"
128 #endif
129 #define GNU_USER_DYNAMIC_LINKER32 \
130- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
131+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
132 #define GNU_USER_DYNAMIC_LINKER64 \
133- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
134+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
135
136 #undef DEFAULT_ASM_ENDIAN
137 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
138diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
139index 7cd07e0..8794fa5 100644
140--- a/gcc/config/rs6000/sysv4.h
141+++ b/gcc/config/rs6000/sysv4.h
142@@ -763,15 +763,19 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
143
144 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
145 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
146+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
147+
148 #if DEFAULT_LIBC == LIBC_UCLIBC
149-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
150+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
151+#elif DEFAULT_LIBC == LIBC_MUSL
152+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
153 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
154-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
155+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
156 #else
157 #error "Unsupported DEFAULT_LIBC"
158 #endif
159 #define GNU_USER_DYNAMIC_LINKER \
160- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
161+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
162
163 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
164 %{rdynamic:-export-dynamic} \
165diff --git a/libitm/config/arm/hwcap.cc b/libitm/config/arm/hwcap.cc
166index a1c2cfd..dd4fad2 100644
167--- a/libitm/config/arm/hwcap.cc
168+++ b/libitm/config/arm/hwcap.cc
169@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
170
171 #ifdef __linux__
172 #include <unistd.h>
173+#ifdef __GLIBC__
174 #include <sys/fcntl.h>
175+#else
176+#include <fcntl.h>
177+#endif
178 #include <elf.h>
179
180 static void __attribute__((constructor))
181diff --git a/libitm/config/linux/x86/tls.h b/libitm/config/linux/x86/tls.h
182index e731ab7..54ad8b6 100644
183--- a/libitm/config/linux/x86/tls.h
184+++ b/libitm/config/linux/x86/tls.h
185@@ -25,16 +25,19 @@
186 #ifndef LIBITM_X86_TLS_H
187 #define LIBITM_X86_TLS_H 1
188
189-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
190+#if defined(__GLIBC_PREREQ)
191+#if __GLIBC_PREREQ(2, 10)
192 /* Use slots in the TCB head rather than __thread lookups.
193 GLIBC has reserved words 10 through 13 for TM. */
194 #define HAVE_ARCH_GTM_THREAD 1
195 #define HAVE_ARCH_GTM_THREAD_DISP 1
196 #endif
197+#endif
198
199 #include "config/generic/tls.h"
200
201-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
202+#if defined(__GLIBC_PREREQ)
203+#if __GLIBC_PREREQ(2, 10)
204 namespace GTM HIDDEN {
205
206 #ifdef __x86_64__
207@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct abi_dispatch *x)
208
209 } // namespace GTM
210 #endif /* >= GLIBC 2.10 */
211+#endif
212
213 #endif // LIBITM_X86_TLS_H
214--
2152.7.4
216
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch b/meta/recipes-devtools/gcc/gcc-5.4/0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch
deleted file mode 100644
index ddb0fc4f40..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 047116e8c9cbb340264f4f28db3f21a68ba57ff3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Dec 2015 08:32:24 +0000
4Subject: [PATCH 46/46] Get rid of ever-broken fixincludes on musl.
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 fixincludes/mkfixinc.sh | 3 ++-
10 1 file changed, 2 insertions(+), 1 deletion(-)
11
12diff --git a/fixincludes/mkfixinc.sh b/fixincludes/mkfixinc.sh
13index 6653fedb..0d96c8c 100755
14--- a/fixincludes/mkfixinc.sh
15+++ b/fixincludes/mkfixinc.sh
16@@ -19,7 +19,8 @@ case $machine in
17 powerpc-*-eabi* | \
18 powerpc-*-rtems* | \
19 powerpcle-*-eabisim* | \
20- powerpcle-*-eabi* )
21+ powerpcle-*-eabi* | \
22+ *-musl* )
23 # IF there is no include fixing,
24 # THEN create a no-op fixer and exit
25 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
26--
272.6.3
28
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc-5.4/0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch
deleted file mode 100644
index a1cfb9c7a0..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From f5ca07132b9292d2045ca7204e9cbfde2e59d0bf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2016 10:26:10 -0800
4Subject: [PATCH 47/48] nios2: Define MUSL_DYNAMIC_LINKER
5
6Signed-off-by: Marek Vasut <marex@denx.de>
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9Upstream-Status: Pending
10
11 gcc/config/nios2/linux.h | 1 +
12 1 file changed, 1 insertion(+)
13
14diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
15index f43f655..5587ab3 100644
16--- a/gcc/config/nios2/linux.h
17+++ b/gcc/config/nios2/linux.h
18@@ -30,6 +30,7 @@
19 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
20
21 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
22+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1"
23
24 #undef LINK_SPEC
25 #define LINK_SPEC LINK_SPEC_ENDIAN \
26--
272.7.0
28
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0048-ssp_nonshared.patch b/meta/recipes-devtools/gcc/gcc-5.4/0048-ssp_nonshared.patch
deleted file mode 100644
index 5ddd40a4aa..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0048-ssp_nonshared.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 3cb6013cf287ed9b1247ea37541e64b9810a121d Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 7 Nov 2015 14:58:40 +0000
4Subject: [PATCH 48/48] ssp_nonshared
5
6---
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8Upstream-Status: Pending
9
10 gcc/gcc.c | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12
13diff --git a/gcc/gcc.c b/gcc/gcc.c
14index 8f53aea..3ddc658 100644
15--- a/gcc/gcc.c
16+++ b/gcc/gcc.c
17@@ -732,7 +732,8 @@ proper position among the other output files. */
18 #ifndef LINK_SSP_SPEC
19 #ifdef TARGET_LIBC_PROVIDES_SSP
20 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
21- "|fstack-protector-strong|fstack-protector-explicit:}"
22+ "|fstack-protector-strong|fstack-protector-explicit" \
23+ ":-lssp_nonshared}"
24 #else
25 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
26 "|fstack-protector-strong|fstack-protector-explicit" \
27--
282.7.0
29
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch b/meta/recipes-devtools/gcc/gcc-5.4/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch
deleted file mode 100644
index 0ea5143e0d..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch
+++ /dev/null
@@ -1,78 +0,0 @@
1From 553d8e3b9073ff3e0a9d2fac9b1823fb17ad247c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2016 21:00:18 -0800
4Subject: [PATCH 49/51] Disable the weak reference logic in gthr.h for
5 os/generic
6
7It does not work unless work arounds are there in gthr-posix.h
8
9origin of patch
10http://port70.net/~nsz/musl/gcc-5.3.0/0004-gthr.patch
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14Upstream-Status: Pending
15
16 libgfortran/acinclude.m4 | 2 +-
17 libgfortran/configure | 2 +-
18 libstdc++-v3/config/os/generic/os_defines.h | 5 +++++
19 libstdc++-v3/configure.host | 3 +++
20 4 files changed, 10 insertions(+), 2 deletions(-)
21
22diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
23index ba890f9..30b8b1a6 100644
24--- a/libgfortran/acinclude.m4
25+++ b/libgfortran/acinclude.m4
26@@ -100,7 +100,7 @@ void foo (void);
27 [Define to 1 if the target supports #pragma weak])
28 fi
29 case "$host" in
30- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
31+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
32 AC_DEFINE(GTHREAD_USE_WEAK, 0,
33 [Define to 0 if the target shouldn't use #pragma weak])
34 ;;
35diff --git a/libgfortran/configure b/libgfortran/configure
36index 5d47e65..cdf9695 100755
37--- a/libgfortran/configure
38+++ b/libgfortran/configure
39@@ -26456,7 +26456,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>confdefs.h
40
41 fi
42 case "$host" in
43- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
44+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
45
46 $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
47
48diff --git a/libstdc++-v3/config/os/generic/os_defines.h b/libstdc++-v3/config/os/generic/os_defines.h
49index 45bf52a..103ec0e 100644
50--- a/libstdc++-v3/config/os/generic/os_defines.h
51+++ b/libstdc++-v3/config/os/generic/os_defines.h
52@@ -33,4 +33,9 @@
53 // System-specific #define, typedefs, corrections, etc, go here. This
54 // file will come before all others.
55
56+// Disable the weak reference logic in gthr.h for os/generic because it
57+// is broken on every platform unless there is implementation specific
58+// workaround in gthr-posix.h and at link-time for static linking.
59+#define _GLIBCXX_GTHREAD_USE_WEAK 0
60+
61 #endif
62diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
63index 1756444..2a87bb8 100644
64--- a/libstdc++-v3/configure.host
65+++ b/libstdc++-v3/configure.host
66@@ -273,6 +273,9 @@ case "${host_os}" in
67 freebsd*)
68 os_include_dir="os/bsd/freebsd"
69 ;;
70+ linux-musl*)
71+ os_include_dir="os/generic"
72+ ;;
73 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
74 # check for musl by target
75 case "${host_os}" in
76--
772.7.0
78
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0050-powerpc-pass-secure-plt-to-the-linker.patch b/meta/recipes-devtools/gcc/gcc-5.4/0050-powerpc-pass-secure-plt-to-the-linker.patch
deleted file mode 100644
index b2f2bbdf46..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0050-powerpc-pass-secure-plt-to-the-linker.patch
+++ /dev/null
@@ -1,66 +0,0 @@
1From 4fa0cf03678f849917dcc3d149989b7fecdbe276 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2016 21:10:00 -0800
4Subject: [PATCH 50/51] powerpc pass --secure-plt to the linker
5
6Secure-plt when enabled does not pass right options to linker
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11 gcc/config/rs6000/linux64.h | 4 ++++
12 gcc/config/rs6000/sysv4.h | 2 ++
13 2 files changed, 6 insertions(+)
14
15diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
16index 679da4b..3ca7cd7 100644
17--- a/gcc/config/rs6000/linux64.h
18+++ b/gcc/config/rs6000/linux64.h
19@@ -174,20 +174,24 @@ extern int dot_symbols;
20 #undef ASM_DEFAULT_SPEC
21 #undef ASM_SPEC
22 #undef LINK_OS_LINUX_SPEC
23+#undef LINK_SECURE_PLT_SPEC
24
25 #ifndef RS6000_BI_ARCH
26 #define ASM_DEFAULT_SPEC "-mppc64"
27 #define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
28 #define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
29+#define LINK_SECURE_PLT_SPEC ""
30 #else
31 #if DEFAULT_ARCH64_P
32 #define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
33 #define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
34 #define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
35+#define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
36 #else
37 #define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
38 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
39 #define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
40+#define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
41 #endif
42 #endif
43
44diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
45index 8794fa5..0835551 100644
46--- a/gcc/config/rs6000/sysv4.h
47+++ b/gcc/config/rs6000/sysv4.h
48@@ -571,6 +571,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
49 : %(link_start_default) }"
50
51 #define LINK_START_DEFAULT_SPEC ""
52+#define LINK_SECURE_PLT_SPEC LINK_SECURE_PLT_DEFAULT_SPEC
53
54 #undef LINK_SPEC
55 #define LINK_SPEC "\
56@@ -578,6 +579,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
57 %{R*} \
58 %(link_shlib) \
59 %{!T*: %(link_start) } \
60+%{!static: %{!mbss-plt: %(link_secure_plt_default)}} \
61 %(link_os)"
62
63 /* Shared libraries are not default. */
64--
652.7.0
66
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0051-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch b/meta/recipes-devtools/gcc/gcc-5.4/0051-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch
deleted file mode 100644
index e8f79b590a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0051-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 32593b38082ea65f4c82159254adf1e0dc2423be Mon Sep 17 00:00:00 2001
2From: bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Tue, 16 Feb 2016 03:15:15 -0500
4Subject: [PATCH] Ignore -fdebug-prefix-map in producer string (by Daniel Kahn
5 Gillmor)
6
7* dwarf2out.c (gen_producer_string): Ignore -fdebug-prefix-map.
8
9git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231835 138bc75d-0d04-0410-961f-82ee72b054a4
10
11Upstream-Status: Backport
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13---
14 gcc/dwarf2out.c | 1 +
15 1 file changed, 1 insertion(+)
16
17diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
18index 3614c10..526f114 100644
19--- a/gcc/dwarf2out.c
20+++ b/gcc/dwarf2out.c
21@@ -19670,6 +19670,7 @@ gen_producer_string (void)
22 case OPT_fpreprocessed:
23 case OPT_fltrans_output_list_:
24 case OPT_fresolution_:
25+ case OPT_fdebug_prefix_map_:
26 /* Ignore these. */
27 continue;
28 default:
29--
301.9.1
31
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0052-nios2-use-ret-with-r31.patch b/meta/recipes-devtools/gcc/gcc-5.4/0052-nios2-use-ret-with-r31.patch
deleted file mode 100644
index f3cb47fd13..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0052-nios2-use-ret-with-r31.patch
+++ /dev/null
@@ -1,103 +0,0 @@
1From 1d67120d95c2c6e0ed4f7357d1cc62887eaba463 Mon Sep 17 00:00:00 2001
2From: sandra <sandra@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Tue, 12 May 2015 15:57:22 +0000
4Subject: [PATCH] 2015-05-12 Chung-Lin Tang <cltang@codesourcery.com>
5 Sandra Loosemore <sandra@codesourcery.com>
6
7 gcc/
8 * config/nios2/nios2.h (enum reg_class): Add IJMP_REGS enum
9 value.
10 (REG_CLASS_NAMES): Add "IJMP_REGS".
11 (REG_CLASS_CONTENTS): Add new entry for IJMP_REGS.
12 * config/nios2/nios2.md (indirect_jump,*tablejump): Adjust to
13 use new "c" register constraint.
14 * config/nios2/constraint.md (c): New register constraint
15 corresponding to IJMP_REGS.
16
17
18
19git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223082 138bc75d-0d04-0410-961f-82ee72b054a4
20Signed-off-by: Marek Vasut <marex@denx.de>
21Upstream-Status: Backport [ git://gcc.gnu.org/git/gcc.git 1d67120d95c2c6e0ed4f7357d1cc62887eaba463 ]
22---
23 gcc/ChangeLog | 12 ++++++++++++
24 gcc/config/nios2/constraints.md | 3 +++
25 gcc/config/nios2/nios2.h | 11 +++++++----
26 gcc/config/nios2/nios2.md | 4 ++--
27 4 files changed, 24 insertions(+), 6 deletions(-)
28
29diff --git a/gcc/config/nios2/constraints.md b/gcc/config/nios2/constraints.md
30index f4bd9f7..735f892 100644
31--- a/gcc/config/nios2/constraints.md
32+++ b/gcc/config/nios2/constraints.md
33@@ -39,6 +39,9 @@
34
35 ;; Register constraints
36
37+(define_register_constraint "c" "IJMP_REGS"
38+ "A register suitable for an indirect jump.")
39+
40 (define_register_constraint "j" "SIB_REGS"
41 "A register suitable for an indirect sibcall.")
42
43diff --git a/gcc/config/nios2/nios2.h b/gcc/config/nios2/nios2.h
44index 510ab5f..ac33978 100644
45--- a/gcc/config/nios2/nios2.h
46+++ b/gcc/config/nios2/nios2.h
47@@ -173,6 +173,7 @@ enum reg_class
48 {
49 NO_REGS,
50 SIB_REGS,
51+ IJMP_REGS,
52 GP_REGS,
53 ALL_REGS,
54 LIM_REG_CLASSES
55@@ -183,6 +184,7 @@ enum reg_class
56 #define REG_CLASS_NAMES \
57 { "NO_REGS", \
58 "SIB_REGS", \
59+ "IJMP_REGS", \
60 "GP_REGS", \
61 "ALL_REGS" }
62
63@@ -190,10 +192,11 @@ enum reg_class
64
65 #define REG_CLASS_CONTENTS \
66 { \
67- /* NO_REGS */ { 0, 0}, \
68- /* SIB_REGS */ { 0xfe0c, 0}, \
69- /* GP_REGS */ {~0, 0}, \
70- /* ALL_REGS */ {~0,~0} \
71+ /* NO_REGS */ { 0, 0}, \
72+ /* SIB_REGS */ { 0xfe0c, 0}, \
73+ /* IJMP_REGS */ { 0x7fffffff, 0}, \
74+ /* GP_REGS */ {~0, 0}, \
75+ /* ALL_REGS */ {~0,~0} \
76 }
77
78
79diff --git a/gcc/config/nios2/nios2.md b/gcc/config/nios2/nios2.md
80index 7b35d269..36ef101 100644
81--- a/gcc/config/nios2/nios2.md
82+++ b/gcc/config/nios2/nios2.md
83@@ -697,7 +697,7 @@
84 ; check or adjust for overflow.
85
86 (define_insn "indirect_jump"
87- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
88+ [(set (pc) (match_operand:SI 0 "register_operand" "c"))]
89 ""
90 "jmp\\t%0"
91 [(set_attr "type" "control")])
92@@ -811,7 +811,7 @@
93
94 (define_insn "*tablejump"
95 [(set (pc)
96- (match_operand:SI 0 "register_operand" "r"))
97+ (match_operand:SI 0 "register_operand" "c"))
98 (use (label_ref (match_operand 1 "" "")))]
99 ""
100 "jmp\\t%0"
101--
1022.7.0
103
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0053-expr.c-PR-target-65358-Avoid-clobbering-partial-argu.patch b/meta/recipes-devtools/gcc/gcc-5.4/0053-expr.c-PR-target-65358-Avoid-clobbering-partial-argu.patch
deleted file mode 100644
index c18f40e740..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0053-expr.c-PR-target-65358-Avoid-clobbering-partial-argu.patch
+++ /dev/null
@@ -1,307 +0,0 @@
1From 536b8318974495cde2b42c3c2742748e2b271be0 Mon Sep 17 00:00:00 2001
2From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 27 May 2015 13:25:01 +0000
4Subject: [PATCH] PR target/65358 Avoid clobbering partial argument during
5 sibcall
6
7 PR target/65358
8 * expr.c (memory_load_overlap): New function.
9 (emit_push_insn): When pushing partial args to the stack would
10 clobber the register part load the overlapping part into a pseudo
11 and put it into the hard reg after pushing. Change return type
12 to bool. Add bool argument.
13 * expr.h (emit_push_insn): Change return type to bool.
14 Add bool argument.
15 * calls.c (expand_call): Cancel sibcall optimization when encountering
16 partial argument on targets with ARGS_GROW_DOWNWARD and
17 !STACK_GROWS_DOWNWARD.
18 (emit_library_call_value_1): Update callsite of emit_push_insn.
19 (store_one_arg): Likewise.
20
21 PR target/65358
22 * gcc.dg/pr65358.c: New test.
23
24git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223753 138bc75d-0d04-0410-961f-82ee72b054a4
25
26Upstream-Status: Backport from 6.0
27Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
28---
29 gcc/calls.c | 17 ++++++--
30 gcc/expr.c | 90 +++++++++++++++++++++++++++++++++++++-----
31 gcc/expr.h | 4 +-
32 gcc/testsuite/gcc.dg/pr65358.c | 33 ++++++++++++++++
33 4 files changed, 129 insertions(+), 15 deletions(-)
34 create mode 100644 gcc/testsuite/gcc.dg/pr65358.c
35
36diff --git a/gcc/calls.c b/gcc/calls.c
37index ee8ea5f..2334381 100644
38--- a/gcc/calls.c
39+++ b/gcc/calls.c
40@@ -3236,6 +3236,14 @@ expand_call (tree exp, rtx target, int ignore)
41 {
42 rtx_insn *before_arg = get_last_insn ();
43
44+ /* On targets with weird calling conventions (e.g. PA) it's
45+ hard to ensure that all cases of argument overlap between
46+ stack and registers work. Play it safe and bail out. */
47+#if defined(ARGS_GROW_DOWNWARD) && !defined(STACK_GROWS_DOWNWARD)
48+ sibcall_failure = 1;
49+ break;
50+#endif
51+
52 if (store_one_arg (&args[i], argblock, flags,
53 adjusted_args_size.var != 0,
54 reg_parm_stack_space)
55@@ -4279,7 +4287,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
56 partial, reg, 0, argblock,
57 GEN_INT (argvec[argnum].locate.offset.constant),
58 reg_parm_stack_space,
59- ARGS_SIZE_RTX (argvec[argnum].locate.alignment_pad));
60+ ARGS_SIZE_RTX (argvec[argnum].locate.alignment_pad), false);
61
62 /* Now mark the segment we just used. */
63 if (ACCUMULATE_OUTGOING_ARGS)
64@@ -4886,10 +4894,11 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
65
66 /* This isn't already where we want it on the stack, so put it there.
67 This can either be done with push or copy insns. */
68- emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX,
69+ if (!emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX,
70 parm_align, partial, reg, used - size, argblock,
71 ARGS_SIZE_RTX (arg->locate.offset), reg_parm_stack_space,
72- ARGS_SIZE_RTX (arg->locate.alignment_pad));
73+ ARGS_SIZE_RTX (arg->locate.alignment_pad), true))
74+ sibcall_failure = 1;
75
76 /* Unless this is a partially-in-register argument, the argument is now
77 in the stack. */
78@@ -5001,7 +5010,7 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
79 emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
80 parm_align, partial, reg, excess, argblock,
81 ARGS_SIZE_RTX (arg->locate.offset), reg_parm_stack_space,
82- ARGS_SIZE_RTX (arg->locate.alignment_pad));
83+ ARGS_SIZE_RTX (arg->locate.alignment_pad), false);
84
85 /* Unless this is a partially-in-register argument, the argument is now
86 in the stack.
87diff --git a/gcc/expr.c b/gcc/expr.c
88index 5c09550..24a6293 100644
89--- a/gcc/expr.c
90+++ b/gcc/expr.c
91@@ -4121,12 +4121,35 @@ emit_single_push_insn (machine_mode mode, rtx x, tree type)
92 }
93 #endif
94
95+/* If reading SIZE bytes from X will end up reading from
96+ Y return the number of bytes that overlap. Return -1
97+ if there is no overlap or -2 if we can't determine
98+ (for example when X and Y have different base registers). */
99+
100+static int
101+memory_load_overlap (rtx x, rtx y, HOST_WIDE_INT size)
102+{
103+ rtx tmp = plus_constant (Pmode, x, size);
104+ rtx sub = simplify_gen_binary (MINUS, Pmode, tmp, y);
105+
106+ if (!CONST_INT_P (sub))
107+ return -2;
108+
109+ HOST_WIDE_INT val = INTVAL (sub);
110+
111+ return IN_RANGE (val, 1, size) ? val : -1;
112+}
113+
114 /* Generate code to push X onto the stack, assuming it has mode MODE and
115 type TYPE.
116 MODE is redundant except when X is a CONST_INT (since they don't
117 carry mode info).
118 SIZE is an rtx for the size of data to be copied (in bytes),
119 needed only if X is BLKmode.
120+ Return true if successful. May return false if asked to push a
121+ partial argument during a sibcall optimization (as specified by
122+ SIBCALL_P) and the incoming and outgoing pointers cannot be shown
123+ to not overlap.
124
125 ALIGN (in bits) is maximum alignment we can assume.
126
127@@ -4152,11 +4175,11 @@ emit_single_push_insn (machine_mode mode, rtx x, tree type)
128 for arguments passed in registers. If nonzero, it will be the number
129 of bytes required. */
130
131-void
132+bool
133 emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
134 unsigned int align, int partial, rtx reg, int extra,
135 rtx args_addr, rtx args_so_far, int reg_parm_stack_space,
136- rtx alignment_pad)
137+ rtx alignment_pad, bool sibcall_p)
138 {
139 rtx xinner;
140 enum direction stack_direction
141@@ -4179,6 +4202,10 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
142
143 xinner = x;
144
145+ int nregs = partial / UNITS_PER_WORD;
146+ rtx *tmp_regs = NULL;
147+ int overlapping = 0;
148+
149 if (mode == BLKmode
150 || (STRICT_ALIGNMENT && align < GET_MODE_ALIGNMENT (mode)))
151 {
152@@ -4309,6 +4336,43 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
153 PARM_BOUNDARY. Assume the caller isn't lying. */
154 set_mem_align (target, align);
155
156+ /* If part should go in registers and pushing to that part would
157+ overwrite some of the values that need to go into regs, load the
158+ overlapping values into temporary pseudos to be moved into the hard
159+ regs at the end after the stack pushing has completed.
160+ We cannot load them directly into the hard regs here because
161+ they can be clobbered by the block move expansions.
162+ See PR 65358. */
163+
164+ if (partial > 0 && reg != 0 && mode == BLKmode
165+ && GET_CODE (reg) != PARALLEL)
166+ {
167+ overlapping = memory_load_overlap (XEXP (x, 0), temp, partial);
168+ if (overlapping > 0)
169+ {
170+ gcc_assert (overlapping % UNITS_PER_WORD == 0);
171+ overlapping /= UNITS_PER_WORD;
172+
173+ tmp_regs = XALLOCAVEC (rtx, overlapping);
174+
175+ for (int i = 0; i < overlapping; i++)
176+ tmp_regs[i] = gen_reg_rtx (word_mode);
177+
178+ for (int i = 0; i < overlapping; i++)
179+ emit_move_insn (tmp_regs[i],
180+ operand_subword_force (target, i, mode));
181+ }
182+ else if (overlapping == -1)
183+ overlapping = 0;
184+ /* Could not determine whether there is overlap.
185+ Fail the sibcall. */
186+ else
187+ {
188+ overlapping = 0;
189+ if (sibcall_p)
190+ return false;
191+ }
192+ }
193 emit_block_move (target, xinner, size, BLOCK_OP_CALL_PARM);
194 }
195 }
196@@ -4363,12 +4427,13 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
197 has a size a multiple of a word. */
198 for (i = size - 1; i >= not_stack; i--)
199 if (i >= not_stack + offset)
200- emit_push_insn (operand_subword_force (x, i, mode),
201+ if (!emit_push_insn (operand_subword_force (x, i, mode),
202 word_mode, NULL_TREE, NULL_RTX, align, 0, NULL_RTX,
203 0, args_addr,
204 GEN_INT (args_offset + ((i - not_stack + skip)
205 * UNITS_PER_WORD)),
206- reg_parm_stack_space, alignment_pad);
207+ reg_parm_stack_space, alignment_pad, sibcall_p))
208+ return false;
209 }
210 else
211 {
212@@ -4411,9 +4476,8 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
213 }
214 }
215
216- /* If part should go in registers, copy that part
217- into the appropriate registers. Do this now, at the end,
218- since mem-to-mem copies above may do function calls. */
219+ /* Move the partial arguments into the registers and any overlapping
220+ values that we moved into the pseudos in tmp_regs. */
221 if (partial > 0 && reg != 0)
222 {
223 /* Handle calls that pass values in multiple non-contiguous locations.
224@@ -4421,9 +4485,15 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
225 if (GET_CODE (reg) == PARALLEL)
226 emit_group_load (reg, x, type, -1);
227 else
228- {
229+ {
230 gcc_assert (partial % UNITS_PER_WORD == 0);
231- move_block_to_reg (REGNO (reg), x, partial / UNITS_PER_WORD, mode);
232+ move_block_to_reg (REGNO (reg), x, nregs - overlapping, mode);
233+
234+ for (int i = 0; i < overlapping; i++)
235+ emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg)
236+ + nregs - overlapping + i),
237+ tmp_regs[i]);
238+
239 }
240 }
241
242@@ -4432,6 +4502,8 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
243
244 if (alignment_pad && args_addr == 0)
245 anti_adjust_stack (alignment_pad);
246+
247+ return true;
248 }
249
250 /* Return X if X can be used as a subtarget in a sequence of arithmetic
251diff --git a/gcc/expr.h b/gcc/expr.h
252index 867852e..5fcc13f 100644
253--- a/gcc/expr.h
254+++ b/gcc/expr.h
255@@ -218,8 +218,8 @@ extern rtx emit_move_resolve_push (machine_mode, rtx);
256 extern rtx push_block (rtx, int, int);
257
258 /* Generate code to push something onto the stack, given its mode and type. */
259-extern void emit_push_insn (rtx, machine_mode, tree, rtx, unsigned int,
260- int, rtx, int, rtx, rtx, int, rtx);
261+extern bool emit_push_insn (rtx, machine_mode, tree, rtx, unsigned int,
262+ int, rtx, int, rtx, rtx, int, rtx, bool);
263
264 /* Expand an assignment that stores the value of FROM into TO. */
265 extern void expand_assignment (tree, tree, bool);
266diff --git a/gcc/testsuite/gcc.dg/pr65358.c b/gcc/testsuite/gcc.dg/pr65358.c
267new file mode 100644
268index 0000000..ba89fd4
269--- /dev/null
270+++ b/gcc/testsuite/gcc.dg/pr65358.c
271@@ -0,0 +1,33 @@
272+/* { dg-do run } */
273+/* { dg-options "-O2" } */
274+
275+struct pack
276+{
277+ int fine;
278+ int victim;
279+ int killer;
280+};
281+
282+int __attribute__ ((__noinline__, __noclone__))
283+bar (int a, int b, struct pack p)
284+{
285+ if (a != 20 || b != 30)
286+ __builtin_abort ();
287+ if (p.fine != 40 || p.victim != 50 || p.killer != 60)
288+ __builtin_abort ();
289+ return 0;
290+}
291+
292+int __attribute__ ((__noinline__, __noclone__))
293+foo (int arg1, int arg2, int arg3, struct pack p)
294+{
295+ return bar (arg2, arg3, p);
296+}
297+
298+int main (void)
299+{
300+ struct pack p = { 40, 50, 60 };
301+
302+ (void) foo (10, 20, 30, p);
303+ return 0;
304+}
305--
3062.7.0
307
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0054-support-ffile-prefix-map.patch b/meta/recipes-devtools/gcc/gcc-5.4/0054-support-ffile-prefix-map.patch
deleted file mode 100644
index da16879132..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0054-support-ffile-prefix-map.patch
+++ /dev/null
@@ -1,284 +0,0 @@
1From ef7c2bda6b4c88f8007ed663b1108cd4651598c8 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 16 Mar 2016 02:27:43 -0400
4Subject: [PATCH] gcc/libcpp: support -ffile-prefix-map=<old>=<new>
5
6Similar -fdebug-prefix-map, add option -ffile-prefix-map to map one
7directory name (old) to another (new) in __FILE__, __BASE_FILE__ and
8__builtin_FILE ().
9
10https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268
11
12Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 gcc/c-family/c-opts.c | 6 ++++
16 gcc/c-family/c.opt | 4 +++
17 gcc/dwarf2out.c | 1 +
18 gcc/gimplify.c | 2 ++
19 libcpp/Makefile.in | 10 +++---
20 libcpp/file-map.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++
21 libcpp/include/file-map.h | 30 ++++++++++++++++
22 libcpp/macro.c | 2 ++
23 8 files changed, 142 insertions(+), 5 deletions(-)
24 create mode 100644 libcpp/file-map.c
25 create mode 100644 libcpp/include/file-map.h
26
27diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
28index 718a052..3f93c56 100644
29--- a/gcc/c-family/c-opts.c
30+++ b/gcc/c-family/c-opts.c
31@@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see
32 #include "opts.h"
33 #include "plugin.h" /* For PLUGIN_INCLUDE_FILE event. */
34 #include "mkdeps.h"
35+#include "file-map.h"
36 #include "c-target.h"
37 #include "tm.h" /* For BYTES_BIG_ENDIAN,
38 DOLLARS_IN_IDENTIFIERS,
39@@ -510,6 +511,11 @@ c_common_handle_option (size_t scode, const char *arg, int value,
40 cpp_opts->narrow_charset = arg;
41 break;
42
43+ case OPT_ffile_prefix_map_:
44+ if (add_file_prefix_map (arg) < 0)
45+ error ("invalid argument %qs to -ffile-prefix-map", arg);
46+ break;
47+
48 case OPT_fwide_exec_charset_:
49 cpp_opts->wide_charset = arg;
50 break;
51diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
52index 453ec8e..30ad053 100644
53--- a/gcc/c-family/c.opt
54+++ b/gcc/c-family/c.opt
55@@ -1117,6 +1117,10 @@ fexec-charset=
56 C ObjC C++ ObjC++ Joined RejectNegative
57 -fexec-charset=<cset> Convert all strings and character constants to character set <cset>
58
59+ffile-prefix-map=
60+C ObjC C++ ObjC++ Joined RejectNegative
61+-ffile-prefix-map=<old=new> Map one directory name to another in __FILE__, __BASE_FILE__ and __builtin_FILE ()
62+
63 fextended-identifiers
64 C ObjC C++ ObjC++
65 Permit universal character names (\\u and \\U) in identifiers
66diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
67index 526f114..438a475 100644
68--- a/gcc/dwarf2out.c
69+++ b/gcc/dwarf2out.c
70@@ -19671,6 +19671,7 @@ gen_producer_string (void)
71 case OPT_fltrans_output_list_:
72 case OPT_fresolution_:
73 case OPT_fdebug_prefix_map_:
74+ case OPT_ffile_prefix_map_:
75 /* Ignore these. */
76 continue;
77 default:
78diff --git a/gcc/gimplify.c b/gcc/gimplify.c
79index c85f83a..1ffe1e1 100644
80--- a/gcc/gimplify.c
81+++ b/gcc/gimplify.c
82@@ -87,6 +87,7 @@ along with GCC; see the file COPYING3. If not see
83 #include "gimple-low.h"
84 #include "cilk.h"
85 #include "gomp-constants.h"
86+#include "file-map.h"
87
88 #include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name */
89 #include "tree-pass.h" /* FIXME: only for PROP_gimple_any */
90@@ -2370,6 +2371,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
91 case BUILT_IN_FILE:
92 {
93 const char *locfile = LOCATION_FILE (EXPR_LOCATION (*expr_p));
94+ locfile = remap_file_filename (locfile);
95 *expr_p = build_string_literal (strlen (locfile) + 1, locfile);
96 return GS_OK;
97 }
98diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
99index ad35563..c210ff9 100644
100--- a/libcpp/Makefile.in
101+++ b/libcpp/Makefile.in
102@@ -84,12 +84,12 @@ DEPMODE = $(CXXDEPMODE)
103
104
105 libcpp_a_OBJS = charset.o directives.o directives-only.o errors.o \
106- expr.o files.o identifiers.o init.o lex.o line-map.o macro.o \
107- mkdeps.o pch.o symtab.o traditional.o
108+ expr.o file-map.o files.o identifiers.o init.o lex.o line-map.o \
109+ macro.o mkdeps.o pch.o symtab.o traditional.o
110
111 libcpp_a_SOURCES = charset.c directives.c directives-only.c errors.c \
112- expr.c files.c identifiers.c init.c lex.c line-map.c macro.c \
113- mkdeps.c pch.c symtab.c traditional.c
114+ expr.c file-map.c files.c identifiers.c init.c lex.c line-map.c \
115+ macro.c mkdeps.c pch.c symtab.c traditional.c
116
117 all: libcpp.a $(USED_CATALOGS)
118
119@@ -263,7 +263,7 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
120
121 TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h ucnid.h \
122 include/line-map.h include/symtab.h include/cpp-id-data.h \
123- include/cpplib.h include/mkdeps.h system.h
124+ include/cpplib.h include/mkdeps.h system.h include/file-map.h
125
126 TAGS: $(TAGS_SOURCES)
127 cd $(srcdir) && etags $(TAGS_SOURCES)
128diff --git a/libcpp/file-map.c b/libcpp/file-map.c
129new file mode 100644
130index 0000000..04e851b
131--- /dev/null
132+++ b/libcpp/file-map.c
133@@ -0,0 +1,92 @@
134+/* Map one directory name to another in __FILE__, __BASE_FILE__
135+ and __builtin_FILE ().
136+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
137+
138+This program is free software; you can redistribute it and/or modify it
139+under the terms of the GNU General Public License as published by the
140+Free Software Foundation; either version 3, or (at your option) any
141+later version.
142+
143+This program is distributed in the hope that it will be useful,
144+but WITHOUT ANY WARRANTY; without even the implied warranty of
145+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146+GNU General Public License for more details.
147+
148+You should have received a copy of the GNU General Public License
149+along with this program; see the file COPYING3. If not see
150+<http://www.gnu.org/licenses/>.
151+
152+ In other words, you are welcome to use, share and improve this program.
153+ You are forbidden to forbid anyone else to use, share and improve
154+ what you give them. Help stamp out software-hoarding! */
155+
156+#include "config.h"
157+#include "system.h"
158+#include "file-map.h"
159+
160+/* Structure recording the mapping from source file and directory
161+ names at compile time to __FILE__ */
162+typedef struct file_prefix_map
163+{
164+ const char *old_prefix;
165+ const char *new_prefix;
166+ size_t old_len;
167+ size_t new_len;
168+ struct file_prefix_map *next;
169+} file_prefix_map;
170+
171+/* Linked list of such structures. */
172+static file_prefix_map *file_prefix_maps;
173+
174+/* Record prefix mapping of __FILE__. ARG is the argument to
175+ -ffile-prefix-map and must be of the form OLD=NEW. */
176+int
177+add_file_prefix_map (const char *arg)
178+{
179+ file_prefix_map *map;
180+ const char *p;
181+
182+ p = strchr (arg, '=');
183+ if (!p)
184+ {
185+ fprintf(stderr, "invalid argument %qs to -ffile-prefix-map", arg);
186+ return -1;
187+ }
188+ map = XNEW (file_prefix_map);
189+ map->old_prefix = xstrndup (arg, p - arg);
190+ map->old_len = p - arg;
191+ p++;
192+ map->new_prefix = xstrdup (p);
193+ map->new_len = strlen (p);
194+ map->next = file_prefix_maps;
195+ file_prefix_maps = map;
196+
197+ return 0;
198+}
199+
200+/* Perform user-specified mapping of __FILE__ prefixes. Return
201+ the new name corresponding to filename. */
202+
203+const char *
204+remap_file_filename (const char *filename)
205+{
206+ file_prefix_map *map;
207+ char *s;
208+ const char *name;
209+ size_t name_len;
210+
211+ for (map = file_prefix_maps; map; map = map->next)
212+ if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
213+ break;
214+ if (!map)
215+ return filename;
216+ name = filename + map->old_len;
217+ name_len = strlen (name) + 1;
218+ s = (char *) alloca (name_len + map->new_len);
219+ memcpy (s, map->new_prefix, map->new_len);
220+ memcpy (s + map->new_len, name, name_len);
221+
222+ return xstrdup (s);
223+}
224+
225+
226diff --git a/libcpp/include/file-map.h b/libcpp/include/file-map.h
227new file mode 100644
228index 0000000..e6f8cbf
229--- /dev/null
230+++ b/libcpp/include/file-map.h
231@@ -0,0 +1,30 @@
232+/* Map one directory name to another in __FILE__, __BASE_FILE__
233+ and __builtin_FILE ().
234+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
235+
236+This program is free software; you can redistribute it and/or modify it
237+under the terms of the GNU General Public License as published by the
238+Free Software Foundation; either version 3, or (at your option) any
239+later version.
240+
241+This program is distributed in the hope that it will be useful,
242+but WITHOUT ANY WARRANTY; without even the implied warranty of
243+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
244+GNU General Public License for more details.
245+
246+You should have received a copy of the GNU General Public License
247+along with this program; see the file COPYING3. If not see
248+<http://www.gnu.org/licenses/>.
249+
250+ In other words, you are welcome to use, share and improve this program.
251+ You are forbidden to forbid anyone else to use, share and improve
252+ what you give them. Help stamp out software-hoarding! */
253+
254+#ifndef LIBCPP_FILE_MAP_H
255+#define LIBCPP_FILE_MAP_H
256+
257+const char * remap_file_filename (const char *filename);
258+
259+int add_file_prefix_map (const char *arg);
260+
261+#endif /* !LIBCPP_FILE_MAP_H */
262diff --git a/libcpp/macro.c b/libcpp/macro.c
263index 1e0a0b5..c3d330c 100644
264--- a/libcpp/macro.c
265+++ b/libcpp/macro.c
266@@ -26,6 +26,7 @@ along with this program; see the file COPYING3. If not see
267 #include "system.h"
268 #include "cpplib.h"
269 #include "internal.h"
270+#include "file-map.h"
271
272 typedef struct macro_arg macro_arg;
273 /* This structure represents the tokens of a macro argument. These
274@@ -297,6 +298,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
275 if (!name)
276 abort ();
277 }
278+ name = remap_file_filename (name);
279 len = strlen (name);
280 buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
281 result = buf;
282--
2831.9.1
284
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch b/meta/recipes-devtools/gcc/gcc-5.4/0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
deleted file mode 100644
index c7caed8c86..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0055-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From 14b79641ff6b0008aef7fbf7aa300daec11d1e78 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 16 Mar 2016 05:39:59 -0400
4Subject: [PATCH] Reuse -fdebug-prefix-map to replace -ffile-prefix-map
5
6The oe-core may use external toolchain to compile,
7which may not support -ffile-prefix-map.
8
9Since we use -fdebug-prefix-map to do the same thing,
10so we could reuse it to replace -ffile-prefix-map.
11
12Upstream-Status: Inappropriate[oe-core specific]
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 gcc/opts-global.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/gcc/opts-global.c b/gcc/opts-global.c
20index b61bdcf..51bb177 100644
21--- a/gcc/opts-global.c
22+++ b/gcc/opts-global.c
23@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
24 #include "rtl.h"
25 #include "dbgcnt.h"
26 #include "debug.h"
27+#include "file-map.h"
28 #include "hash-map.h"
29 #include "plugin-api.h"
30 #include "ipa-ref.h"
31@@ -378,6 +379,9 @@ handle_common_deferred_options (void)
32
33 case OPT_fdebug_prefix_map_:
34 add_debug_prefix_map (opt->arg);
35+
36+ /* Reuse -fdebug-prefix-map to replace -ffile-prefix-map */
37+ add_file_prefix_map (opt->arg);
38 break;
39
40 case OPT_fdump_:
41--
421.9.1
43
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch b/meta/recipes-devtools/gcc/gcc-5.4/0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch
deleted file mode 100644
index 97913420e0..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0056-Enable-libc-provide-ssp-and-gcc_cv_target_dl_iterate.patch
+++ /dev/null
@@ -1,85 +0,0 @@
1From 5c7bd853c8703f65904083778712ef625c3f3814 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 Mar 2016 20:31:50 -0700
4Subject: [PATCH 56/57] Enable libc provide ssp and
5 gcc_cv_target_dl_iterate_phdr for musl
6
7 * configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*.
8 (gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*.
9 * configure: Regenerate.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13Upstream-Status: Backport
14
15 gcc/configure | 7 +++++++
16 gcc/configure.ac | 7 +++++++
17 2 files changed, 14 insertions(+)
18
19diff --git a/gcc/configure b/gcc/configure
20index fcb05e7..81a449c 100755
21--- a/gcc/configure
22+++ b/gcc/configure
23@@ -27814,6 +27814,9 @@ if test "${gcc_cv_libc_provides_ssp+set}" = set; then :
24 else
25 gcc_cv_libc_provides_ssp=no
26 case "$target" in
27+ *-*-musl*)
28+ # All versions of musl provide stack protector
29+ gcc_cv_libc_provides_ssp=yes;;
30 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
31 # glibc 2.4 and later provides __stack_chk_fail and
32 # either __stack_chk_guard, or TLS access to stack guard canary.
33@@ -27846,6 +27849,7 @@ fi
34 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
35 # simply assert that glibc does provide this, which is true for all
36 # realistically usable GNU/Hurd configurations.
37+ # All supported versions of musl provide it as well
38 gcc_cv_libc_provides_ssp=yes;;
39 *-*-darwin* | *-*-freebsd*)
40 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
41@@ -27942,6 +27946,9 @@ case "$target" in
42 gcc_cv_target_dl_iterate_phdr=no
43 fi
44 ;;
45+ *-linux-musl*)
46+ gcc_cv_target_dl_iterate_phdr=yes
47+ ;;
48 esac
49
50 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
51diff --git a/gcc/configure.ac b/gcc/configure.ac
52index 923bc9a..b08e3dc 100644
53--- a/gcc/configure.ac
54+++ b/gcc/configure.ac
55@@ -5291,6 +5291,9 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
56 gcc_cv_libc_provides_ssp,
57 [gcc_cv_libc_provides_ssp=no
58 case "$target" in
59+ *-*-musl*)
60+ # All versions of musl provide stack protector
61+ gcc_cv_libc_provides_ssp=yes;;
62 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
63 # glibc 2.4 and later provides __stack_chk_fail and
64 # either __stack_chk_guard, or TLS access to stack guard canary.
65@@ -5317,6 +5320,7 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
66 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
67 # simply assert that glibc does provide this, which is true for all
68 # realistically usable GNU/Hurd configurations.
69+ # All supported versions of musl provide it as well
70 gcc_cv_libc_provides_ssp=yes;;
71 *-*-darwin* | *-*-freebsd*)
72 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
73@@ -5390,6 +5394,9 @@ case "$target" in
74 gcc_cv_target_dl_iterate_phdr=no
75 fi
76 ;;
77+ *-linux-musl*)
78+ gcc_cv_target_dl_iterate_phdr=yes
79+ ;;
80 esac
81 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
82 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
83--
842.7.4
85
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0057-unwind-fix-for-musl.patch b/meta/recipes-devtools/gcc/gcc-5.4/0057-unwind-fix-for-musl.patch
deleted file mode 100644
index c193587bf9..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0057-unwind-fix-for-musl.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From c5c33bf881a2aea355310dd90873ed39bc272b3c Mon Sep 17 00:00:00 2001
2From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 22 Apr 2015 14:20:01 +0000
4Subject: [PATCH 57/57] unwind fix for musl
5
6On behalf of szabolcs.nagy@arm.com
7
82015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
9 Szabolcs Nagy <szabolcs.nagy@arm.com>
10
11 * unwind-dw2-fde-dip.c (USE_PT_GNU_EH_FRAME): Define it on
12 Linux if target provides dl_iterate_phdr.
13
14git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222328 138bc75d-0d04-0410-961f-82ee72b054a4
15
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18Upstream-Status: Backport
19
20 libgcc/unwind-dw2-fde-dip.c | 6 ++++++
21 1 file changed, 6 insertions(+)
22
23diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
24index e1e566b..137dced 100644
25--- a/libgcc/unwind-dw2-fde-dip.c
26+++ b/libgcc/unwind-dw2-fde-dip.c
27@@ -59,6 +59,12 @@
28
29 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
30 && defined(TARGET_DL_ITERATE_PHDR) \
31+ && defined(__linux__)
32+# define USE_PT_GNU_EH_FRAME
33+#endif
34+
35+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
36+ && defined(TARGET_DL_ITERATE_PHDR) \
37 && (defined(__DragonFly__) || defined(__FreeBSD__))
38 # define ElfW __ElfN
39 # define USE_PT_GNU_EH_FRAME
40--
412.7.4
42
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0058-fdebug-prefix-map-support-to-remap-relative-path.patch b/meta/recipes-devtools/gcc/gcc-5.4/0058-fdebug-prefix-map-support-to-remap-relative-path.patch
deleted file mode 100644
index 0b91fdbbcf..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0058-fdebug-prefix-map-support-to-remap-relative-path.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From 289ad2969a5966c603bf6928ce442db74c4cbb25 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 24 Mar 2016 11:23:14 -0400
4Subject: [PATCH] gcc/final.c: -fdebug-prefix-map support to remap sources with
5 relative path
6
7PR other/70428
8* final.c (remap_debug_filename): Use lrealpath to translate
9relative path before remapping
10
11https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428
12Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16diff --git a/gcc/final.c b/gcc/final.c
17index 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--
502.7.4
51
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/0059-libgcc-use-ldflags.patch b/meta/recipes-devtools/gcc/gcc-5.4/0059-libgcc-use-ldflags.patch
deleted file mode 100644
index 325b72ab5f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/0059-libgcc-use-ldflags.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS
2
3Signed-off-by: Christopher Larson <chris_larson@mentor.com>
4Upstream-Status: Pending
5
6--- gcc-5.3.0.orig/libgcc/config/t-slibgcc
7+++ gcc-5.3.0/libgcc/config/t-slibgcc
8@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_S
9 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
10
11 SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
12- $(SHLIB_LDFLAGS) \
13+ $(LDFLAGS) $(SHLIB_LDFLAGS) \
14 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
15 $(SHLIB_OBJS) $(SHLIB_LC) && \
16 rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
diff --git a/meta/recipes-devtools/gcc/gcc-5.4/CVE-2016-6131.patch b/meta/recipes-devtools/gcc/gcc-5.4/CVE-2016-6131.patch
deleted file mode 100644
index 88524c342e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-5.4/CVE-2016-6131.patch
+++ /dev/null
@@ -1,251 +0,0 @@
1From b3f6b32165d3f437bd0ac6269c3c499b68ecf036 Mon Sep 17 00:00:00 2001
2From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Thu, 4 Aug 2016 16:53:18 +0000
4Subject: [PATCH] Fix for PR71696 in Libiberty Demangler
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9[BZ #71696] -- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71696
10
112016-08-04 Marcel Böhme <boehme.marcel@gmail.com>
12
13 PR c++/71696
14 * cplus-dem.c: Prevent infinite recursion when there is a cycle
15 in the referencing of remembered mangled types.
16 (work_stuff): New stack to keep track of the remembered mangled
17 types that are currently being processed.
18 (push_processed_type): New method to push currently processed
19 remembered type onto the stack.
20 (pop_processed_type): New method to pop currently processed
21 remembered type from the stack.
22 (work_stuff_copy_to_from): Copy values of new variables.
23 (delete_non_B_K_work_stuff): Free stack memory.
24 (demangle_args): Push/Pop currently processed remembered type.
25 (do_type): Do not demangle a cyclic reference and push/pop
26 referenced remembered type.
27
28cherry-picked from commit of
29git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239143 138bc75d-0d04-0410-961f-82ee72b054a4
30
31Upstream-Status: Backport [master]
32CVE: CVE-2016-6131
33Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
34---
35 libiberty/ChangeLog | 17 ++++++++
36 libiberty/cplus-dem.c | 78 ++++++++++++++++++++++++++++++++---
37 libiberty/testsuite/demangle-expected | 18 ++++++++
38 3 files changed, 108 insertions(+), 5 deletions(-)
39
40diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
41index 9859ad3..7939480 100644
42--- a/libiberty/ChangeLog
43+++ b/libiberty/ChangeLog
44@@ -1,3 +1,20 @@
45+2016-08-04 Marcel Böhme <boehme.marcel@gmail.com>
46+
47+ PR c++/71696
48+ * cplus-dem.c: Prevent infinite recursion when there is a cycle
49+ in the referencing of remembered mangled types.
50+ (work_stuff): New stack to keep track of the remembered mangled
51+ types that are currently being processed.
52+ (push_processed_type): New method to push currently processed
53+ remembered type onto the stack.
54+ (pop_processed_type): New method to pop currently processed
55+ remembered type from the stack.
56+ (work_stuff_copy_to_from): Copy values of new variables.
57+ (delete_non_B_K_work_stuff): Free stack memory.
58+ (demangle_args): Push/Pop currently processed remembered type.
59+ (do_type): Do not demangle a cyclic reference and push/pop
60+ referenced remembered type.
61+
62 2016-06-03 Release Manager
63
64 * GCC 5.4.0 released.
65diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
66index 7514e57..f21e630 100644
67--- a/libiberty/cplus-dem.c
68+++ b/libiberty/cplus-dem.c
69@@ -144,6 +144,9 @@ struct work_stuff
70 string* previous_argument; /* The last function argument demangled. */
71 int nrepeats; /* The number of times to repeat the previous
72 argument. */
73+ int *proctypevec; /* Indices of currently processed remembered typevecs. */
74+ int proctypevec_size;
75+ int nproctypes;
76 };
77
78 #define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
79@@ -435,6 +438,10 @@ iterate_demangle_function (struct work_stuff *,
80
81 static void remember_type (struct work_stuff *, const char *, int);
82
83+static void push_processed_type (struct work_stuff *, int);
84+
85+static void pop_processed_type (struct work_stuff *);
86+
87 static void remember_Btype (struct work_stuff *, const char *, int, int);
88
89 static int register_Btype (struct work_stuff *);
90@@ -1301,6 +1308,10 @@ work_stuff_copy_to_from (struct work_stuff *to, struct work_stuff *from)
91 memcpy (to->btypevec[i], from->btypevec[i], len);
92 }
93
94+ if (from->proctypevec)
95+ to->proctypevec =
96+ XDUPVEC (int, from->proctypevec, from->proctypevec_size);
97+
98 if (from->ntmpl_args)
99 to->tmpl_argvec = XNEWVEC (char *, from->ntmpl_args);
100
101@@ -1329,11 +1340,17 @@ delete_non_B_K_work_stuff (struct work_stuff *work)
102 /* Discard the remembered types, if any. */
103
104 forget_types (work);
105- if (work -> typevec != NULL)
106+ if (work->typevec != NULL)
107 {
108- free ((char *) work -> typevec);
109- work -> typevec = NULL;
110- work -> typevec_size = 0;
111+ free ((char *) work->typevec);
112+ work->typevec = NULL;
113+ work->typevec_size = 0;
114+ }
115+ if (work->proctypevec != NULL)
116+ {
117+ free (work->proctypevec);
118+ work->proctypevec = NULL;
119+ work->proctypevec_size = 0;
120 }
121 if (work->tmpl_argvec)
122 {
123@@ -3552,6 +3569,8 @@ static int
124 do_type (struct work_stuff *work, const char **mangled, string *result)
125 {
126 int n;
127+ int i;
128+ int is_proctypevec;
129 int done;
130 int success;
131 string decl;
132@@ -3564,6 +3583,7 @@ do_type (struct work_stuff *work, const char **mangled, string *result)
133
134 done = 0;
135 success = 1;
136+ is_proctypevec = 0;
137 while (success && !done)
138 {
139 int member;
140@@ -3616,8 +3636,15 @@ do_type (struct work_stuff *work, const char **mangled, string *result)
141 success = 0;
142 }
143 else
144+ for (i = 0; i < work->nproctypes; i++)
145+ if (work -> proctypevec [i] == n)
146+ success = 0;
147+
148+ if (success)
149 {
150- remembered_type = work -> typevec[n];
151+ is_proctypevec = 1;
152+ push_processed_type (work, n);
153+ remembered_type = work->typevec[n];
154 mangled = &remembered_type;
155 }
156 break;
157@@ -3840,6 +3867,9 @@ do_type (struct work_stuff *work, const char **mangled, string *result)
158 string_delete (result);
159 string_delete (&decl);
160
161+ if (is_proctypevec)
162+ pop_processed_type (work);
163+
164 if (success)
165 /* Assume an integral type, if we're not sure. */
166 return (int) ((tk == tk_none) ? tk_integral : tk);
167@@ -4252,6 +4282,41 @@ do_arg (struct work_stuff *work, const char **mangled, string *result)
168 }
169
170 static void
171+push_processed_type (struct work_stuff *work, int typevec_index)
172+{
173+ if (work->nproctypes >= work->proctypevec_size)
174+ {
175+ if (!work->proctypevec_size)
176+ {
177+ work->proctypevec_size = 4;
178+ work->proctypevec = XNEWVEC (int, work->proctypevec_size);
179+ }
180+ else
181+ {
182+ if (work->proctypevec_size < 16)
183+ /* Double when small. */
184+ work->proctypevec_size *= 2;
185+ else
186+ {
187+ /* Grow slower when large. */
188+ if (work->proctypevec_size > (INT_MAX / 3) * 2)
189+ xmalloc_failed (INT_MAX);
190+ work->proctypevec_size = (work->proctypevec_size * 3 / 2);
191+ }
192+ work->proctypevec
193+ = XRESIZEVEC (int, work->proctypevec, work->proctypevec_size);
194+ }
195+ }
196+ work->proctypevec [work->nproctypes++] = typevec_index;
197+}
198+
199+static void
200+pop_processed_type (struct work_stuff *work)
201+{
202+ work->nproctypes--;
203+}
204+
205+static void
206 remember_type (struct work_stuff *work, const char *start, int len)
207 {
208 char *tem;
209@@ -4515,10 +4580,13 @@ demangle_args (struct work_stuff *work, const char **mangled,
210 {
211 string_append (declp, ", ");
212 }
213+ push_processed_type (work, t);
214 if (!do_arg (work, &tem, &arg))
215 {
216+ pop_processed_type (work);
217 return (0);
218 }
219+ pop_processed_type (work);
220 if (PRINT_ARG_TYPES)
221 {
222 string_appends (declp, &arg);
223diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
224index 1d8b771..d690b23 100644
225--- a/libiberty/testsuite/demangle-expected
226+++ b/libiberty/testsuite/demangle-expected
227@@ -4429,3 +4429,21 @@ __vt_90000000000cafebabe
228
229 _Z80800000000000000000000
230 _Z80800000000000000000000
231+#
232+# Tests write access violation PR70926
233+
234+0__Ot2m02R5T0000500000
235+0__Ot2m02R5T0000500000
236+#
237+
238+0__GT50000000000_
239+0__GT50000000000_
240+#
241+
242+__t2m05B500000000000000000_
243+__t2m05B500000000000000000_
244+#
245+# Tests stack overflow PR71696
246+
247+__10%0__S4_0T0T0
248+%0<>::%0(%0<>)
249--
2502.9.3
251
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_5.4.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_5.4.bb
deleted file mode 100644
index bf53c5cd78..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian_5.4.bb
+++ /dev/null
@@ -1,5 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross-canadian.inc
3
4
5
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_5.4.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_5.4.bb
deleted file mode 100644
index 4c73e5ce61..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-initial_5.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross_5.4.bb b/meta/recipes-devtools/gcc/gcc-cross_5.4.bb
deleted file mode 100644
index b43cca0c52..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross_5.4.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_5.4.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_5.4.bb
deleted file mode 100644
index fd90e1140f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_5.4.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-cross-initial_${PV}.bb
2require gcc-crosssdk-initial.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_5.4.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_5.4.bb
deleted file mode 100644
index 40a6c4feff..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk_5.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_5.4.bb b/meta/recipes-devtools/gcc/gcc-runtime_5.4.bb
deleted file mode 100644
index 8f31e7792e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-runtime_5.4.bb
+++ /dev/null
@@ -1,7 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-runtime.inc
3
4FILES_libgomp-dev += "\
5 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/openacc.h \
6"
7
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_5.4.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_5.4.bb
deleted file mode 100644
index 601f666023..0000000000
--- a/meta/recipes-devtools/gcc/gcc-sanitizers_5.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-sanitizers.inc
diff --git a/meta/recipes-devtools/gcc/gcc-source_5.4.bb b/meta/recipes-devtools/gcc/gcc-source_5.4.bb
deleted file mode 100644
index b890fa33ea..0000000000
--- a/meta/recipes-devtools/gcc/gcc-source_5.4.bb
+++ /dev/null
@@ -1,4 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require recipes-devtools/gcc/gcc-source.inc
3
4EXCLUDE_FROM_WORLD = "1"
diff --git a/meta/recipes-devtools/gcc/gcc_5.4.bb b/meta/recipes-devtools/gcc/gcc_5.4.bb
deleted file mode 100644
index 2c618dfb93..0000000000
--- a/meta/recipes-devtools/gcc/gcc_5.4.bb
+++ /dev/null
@@ -1,9 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-target.inc
3
4# Building with thumb enabled on armv4t fails with
5# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs
6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
7ARM_INSTRUCTION_SET_armv4 = "arm"
8
9BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-devtools/gcc/libgcc-initial_5.4.bb b/meta/recipes-devtools/gcc/libgcc-initial_5.4.bb
deleted file mode 100644
index 19f253fce8..0000000000
--- a/meta/recipes-devtools/gcc/libgcc-initial_5.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc-initial.inc
diff --git a/meta/recipes-devtools/gcc/libgcc_5.4.bb b/meta/recipes-devtools/gcc/libgcc_5.4.bb
deleted file mode 100644
index a5152f28e9..0000000000
--- a/meta/recipes-devtools/gcc/libgcc_5.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc
diff --git a/meta/recipes-devtools/gcc/libgfortran_5.4.bb b/meta/recipes-devtools/gcc/libgfortran_5.4.bb
deleted file mode 100644
index 71dd8b4bdc..0000000000
--- a/meta/recipes-devtools/gcc/libgfortran_5.4.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgfortran.inc
3