summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-09-03 08:58:48 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-06 12:45:47 +0100
commit0c8397aa684cc916ddaf345be78e786ab5480b3b (patch)
tree7ec115494d1e1815009d25b9bd816e7643160a28 /meta/recipes-devtools
parent4aa7e00724a2b3596d4d453d250422bb1ab91ca3 (diff)
downloadpoky-0c8397aa684cc916ddaf345be78e786ab5480b3b.tar.gz
gcc-8.3: remove 8.3 from zeus
warrior only had one gcc so lets be consistent. This will also reduce our maintenance overhead and we don't build this either (From OE-Core rev: fa4ecadd980eff95eacd840ba0259f6272daa9aa) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3.inc113
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0002-gcc-poison-system-directories.patch203
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0004-64-bit-multilib-hack.patch85
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0005-optional-libstdc.patch125
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0007-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0008-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch96
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0009-fortran-cross-compile-hack.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0010-cpp-honor-sysroot.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0011-MIPS64-Default-to-N64-ABI.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0012-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch248
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0013-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0014-Disable-sdt.patch113
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0015-libtool.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0016-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0017-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0018-Avoid-using-libdir-from-.la-which-usually-points-to-.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0019-export-CPP.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0020-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0021-Ensure-target-gcc-headers-can-be-included.patch98
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0022-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0023-Don-t-search-host-directory-during-relink-if-inst_pr.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0024-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0025-aarch64-Add-support-for-musl-ldso.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0026-libcc1-fix-libcc1-s-install-path-and-rpath.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0027-handle-sysroot-support-for-nativesdk-gcc.patch213
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0028-Search-target-sysroot-gcc-version-specific-dirs-with.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0029-Fix-various-_FOR_BUILD-and-related-variables.patch137
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0030-nios2-Define-MUSL_DYNAMIC_LINKER.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0031-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch87
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0032-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch125
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0033-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch85
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0035-sync-gcc-stddef.h-with-musl.patch91
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0036-fix-segmentation-fault-in-precompiled-header-generat.patch60
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0037-Fix-for-testsuite-failure.patch258
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0038-Re-introduce-spe-commandline-options.patch41
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0039-riscv-Disable-multilib-for-OE.patch27
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch325
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch94
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0043-PR85434-Prevent-spilling-of-stack-protector-guard-s-.patch813
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_8.3.bb5
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_8.3.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_8.3.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_8.3.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers_8.3.bb7
-rw-r--r--meta/recipes-devtools/gcc/gcc-source_8.3.bb4
-rw-r--r--meta/recipes-devtools/gcc/gcc_8.3.bb14
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial_8.3.bb5
-rw-r--r--meta/recipes-devtools/gcc/libgcc_8.3.bb5
-rw-r--r--meta/recipes-devtools/gcc/libgfortran_8.3.bb3
53 files changed, 0 insertions, 4542 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-8.3.inc b/meta/recipes-devtools/gcc/gcc-8.3.inc
deleted file mode 100644
index 4b0d6f2267..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3.inc
+++ /dev/null
@@ -1,113 +0,0 @@
1require gcc-common.inc
2
3# Third digit in PV should be incremented after a minor release
4
5PV = "8.3.0"
6
7# BINV should be incremented to a revision after a minor gcc release
8
9BINV = "8.3.0"
10
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-8.3:"
12
13DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
14NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native"
15
16LICENSE = "GPL-3.0-with-GCC-exception & GPLv3"
17
18LIC_FILES_CHKSUM = "\
19 file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
20 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
21 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
22 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
23 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
24"
25
26#RELEASE = "8.0.1-RC-20180427"
27BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
28#SRCREV = "f7cf798b73fd1a07098f9a490deec1e2a36e0bed"
29#BASEURI ?= "git://github.com/gcc-mirror/gcc;branch=gcc-6-branch;protocol=git"
30#BASEURI ?= "http://mirrors.concertpass.com/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz"
31
32SRC_URI = "\
33 ${BASEURI} \
34 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
35 file://0002-gcc-poison-system-directories.patch \
36 file://0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
37 file://0004-64-bit-multilib-hack.patch \
38 file://0005-optional-libstdc.patch \
39 file://0007-COLLECT_GCC_OPTIONS.patch \
40 file://0008-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
41 file://0009-fortran-cross-compile-hack.patch \
42 file://0010-cpp-honor-sysroot.patch \
43 file://0011-MIPS64-Default-to-N64-ABI.patch \
44 file://0012-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
45 file://0013-gcc-Fix-argument-list-too-long-error.patch \
46 file://0014-Disable-sdt.patch \
47 file://0015-libtool.patch \
48 file://0016-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
49 file://0017-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
50 file://0018-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
51 file://0019-export-CPP.patch \
52 file://0020-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch \
53 file://0021-Ensure-target-gcc-headers-can-be-included.patch \
54 file://0022-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch \
55 file://0023-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
56 file://0024-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
57 file://0025-aarch64-Add-support-for-musl-ldso.patch \
58 file://0026-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
59 file://0027-handle-sysroot-support-for-nativesdk-gcc.patch \
60 file://0028-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
61 file://0029-Fix-various-_FOR_BUILD-and-related-variables.patch \
62 file://0030-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
63 file://0031-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
64 file://0032-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
65 file://0033-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
66 file://0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
67 file://0035-sync-gcc-stddef.h-with-musl.patch \
68 file://0036-fix-segmentation-fault-in-precompiled-header-generat.patch \
69 file://0037-Fix-for-testsuite-failure.patch \
70 file://0038-Re-introduce-spe-commandline-options.patch \
71 file://0039-riscv-Disable-multilib-for-OE.patch \
72 file://0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch \
73 file://0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch \
74 file://0042-PR-debug-86964.patch \
75 file://0043-PR85434-Prevent-spilling-of-stack-protector-guard-s-.patch \
76 file://CVE-2019-14250.patch \
77"
78SRC_URI[md5sum] = "65b210b4bfe7e060051f799e0f994896"
79SRC_URI[sha256sum] = "64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c"
80
81S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
82#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git"
83#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${RELEASE}"
84B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
85
86# Language Overrides
87FORTRAN = ""
88
89LTO = "--enable-lto"
90SSP ?= "--disable-libssp"
91SSP_mingw32 = "--enable-libssp"
92
93EXTRA_OECONF_BASE = "\
94 ${LTO} \
95 ${SSP} \
96 --enable-libitm \
97 --disable-bootstrap \
98 --disable-libmudflap \
99 --with-system-zlib \
100 ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
101 --enable-linker-build-id \
102 --with-ppl=no \
103 --with-cloog=no \
104 --enable-checking=release \
105 --enable-cheaders=c_global \
106 --without-isl \
107"
108
109EXTRA_OECONF_PATHS = "\
110 --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
111 --with-sysroot=/not/exist \
112 --with-build-sysroot=${STAGING_DIR_TARGET} \
113"
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-8.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
deleted file mode 100644
index 4ad79e44b8..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From d7b284a9bede9d5059ad7e95a867254bf913c638 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/40] 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 0601395512f..8c5b1e9d561 100755
16--- a/configure
17+++ b/configure
18@@ -7507,7 +7507,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 c3433336523..69c31c65ad7 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -3096,7 +3096,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.21.0
42
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0002-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-8.3/0002-gcc-poison-system-directories.patch
deleted file mode 100644
index e7ff124666..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0002-gcc-poison-system-directories.patch
+++ /dev/null
@@ -1,203 +0,0 @@
1From 95ec476dd7726cc9c1bfd6fb23ba3aea8bbf61a4 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 02/40] gcc: poison-system-directories
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/common.opt | 4 ++++
20 gcc/config.in | 6 ++++++
21 gcc/configure | 16 ++++++++++++++++
22 gcc/configure.ac | 10 ++++++++++
23 gcc/doc/invoke.texi | 9 +++++++++
24 gcc/gcc.c | 2 ++
25 gcc/incpath.c | 21 +++++++++++++++++++++
26 7 files changed, 68 insertions(+)
27
28diff --git a/gcc/common.opt b/gcc/common.opt
29index b52ef0b38c8..0de3f0924cd 100644
30--- a/gcc/common.opt
31+++ b/gcc/common.opt
32@@ -679,6 +679,10 @@ Wreturn-local-addr
33 Common Var(warn_return_local_addr) Init(1) Warning
34 Warn about returning a pointer/reference to a local or temporary variable.
35
36+Wpoison-system-directories
37+Common Var(flag_poison_system_directories) Init(1) Warning
38+Warn for -I and -L options using system directories if cross compiling
39+
40 Wshadow
41 Common Var(warn_shadow) Warning
42 Warn when one variable shadows another. Same as -Wshadow=global.
43diff --git a/gcc/config.in b/gcc/config.in
44index 5bccb408016..1c784a8276b 100644
45--- a/gcc/config.in
46+++ b/gcc/config.in
47@@ -194,6 +194,12 @@
48 #endif
49
50
51+/* Define to warn for use of native system header directories */
52+#ifndef USED_FOR_TARGET
53+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
54+#endif
55+
56+
57 /* Define if you want all operations on RTL (the basic data structure of the
58 optimizer and back end) to be checked for dynamic type safety at runtime.
59 This is quite expensive. */
60diff --git a/gcc/configure b/gcc/configure
61index 6121e163259..3901722400c 100755
62--- a/gcc/configure
63+++ b/gcc/configure
64@@ -953,6 +953,7 @@ with_system_zlib
65 enable_maintainer_mode
66 enable_link_mutex
67 enable_version_specific_runtime_libs
68+enable_poison_system_directories
69 enable_plugin
70 enable_host_shared
71 enable_libquadmath_support
72@@ -1696,6 +1697,8 @@ Optional Features:
73 --enable-version-specific-runtime-libs
74 specify that runtime libraries should be installed
75 in a compiler-specific directory
76+ --enable-poison-system-directories
77+ warn for use of native system header directories
78 --enable-plugin enable plugin support
79 --enable-host-shared build host code as shared libraries
80 --disable-libquadmath-support
81@@ -29701,6 +29704,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
82 fi
83
84
85+# Check whether --enable-poison-system-directories was given.
86+if test "${enable_poison_system_directories+set}" = set; then :
87+ enableval=$enable_poison_system_directories;
88+else
89+ enable_poison_system_directories=no
90+fi
91+
92+if test "x${enable_poison_system_directories}" = "xyes"; then
93+
94+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
95+
96+fi
97+
98 # Substitute configuration variables
99
100
101diff --git a/gcc/configure.ac b/gcc/configure.ac
102index b066cc609e1..1b1362f70fe 100644
103--- a/gcc/configure.ac
104+++ b/gcc/configure.ac
105@@ -6327,6 +6327,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
106 [specify that runtime libraries should be
107 installed in a compiler-specific directory])])
108
109+AC_ARG_ENABLE([poison-system-directories],
110+ AS_HELP_STRING([--enable-poison-system-directories],
111+ [warn for use of native system header directories]),,
112+ [enable_poison_system_directories=no])
113+if test "x${enable_poison_system_directories}" = "xyes"; then
114+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
115+ [1],
116+ [Define to warn for use of native system header directories])
117+fi
118+
119 # Substitute configuration variables
120 AC_SUBST(subdirs)
121 AC_SUBST(srcdir)
122diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
123index e5c4e8125aa..fb228631a42 100644
124--- a/gcc/doc/invoke.texi
125+++ b/gcc/doc/invoke.texi
126@@ -304,6 +304,7 @@ Objective-C and Objective-C++ Dialects}.
127 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
128 -Wparentheses -Wno-pedantic-ms-format @gol
129 -Wplacement-new -Wplacement-new=@var{n} @gol
130+-Wno-poison-system-directories @gol
131 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
132 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
133 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
134@@ -5743,6 +5744,14 @@ made up of data only and thus requires no special treatment. But, for
135 most targets, it is made up of code and thus requires the stack to be
136 made executable in order for the program to work properly.
137
138+@item -Wno-poison-system-directories
139+@opindex Wno-poison-system-directories
140+Do not warn for @option{-I} or @option{-L} options using system
141+directories such as @file{/usr/include} when cross compiling. This
142+option is intended for use in chroot environments when such
143+directories contain the correct headers and libraries for the target
144+system rather than the host.
145+
146 @item -Wfloat-equal
147 @opindex Wfloat-equal
148 @opindex Wno-float-equal
149diff --git a/gcc/gcc.c b/gcc/gcc.c
150index a716f708259..02b3cd39fc2 100644
151--- a/gcc/gcc.c
152+++ b/gcc/gcc.c
153@@ -1037,6 +1037,8 @@ proper position among the other output files. */
154 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
155 "%X %{o*} %{e*} %{N} %{n} %{r}\
156 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
157+ %{Wno-poison-system-directories:--no-poison-system-directories} \
158+ %{Werror=poison-system-directories:--error-poison-system-directories} \
159 %{static|no-pie|static-pie:} %{L*} %(mfwrap) %(link_libgcc) " \
160 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \
161 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
162diff --git a/gcc/incpath.c b/gcc/incpath.c
163index b11c6a57939..9a457e02dd3 100644
164--- a/gcc/incpath.c
165+++ b/gcc/incpath.c
166@@ -26,6 +26,7 @@
167 #include "intl.h"
168 #include "incpath.h"
169 #include "cppdefault.h"
170+#include "diagnostic-core.h"
171
172 /* Microsoft Windows does not natively support inodes.
173 VMS has non-numeric inodes. */
174@@ -393,6 +394,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
175 }
176 fprintf (stderr, _("End of search list.\n"));
177 }
178+
179+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
180+ if (flag_poison_system_directories)
181+ {
182+ struct cpp_dir *p;
183+
184+ for (p = heads[INC_QUOTE]; p; p = p->next)
185+ {
186+ if ((!strncmp (p->name, "/usr/include", 12))
187+ || (!strncmp (p->name, "/usr/local/include", 18))
188+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
189+ || (!strncmp (p->name, "/sw/include", 11))
190+ || (!strncmp (p->name, "/opt/include", 12)))
191+ warning (OPT_Wpoison_system_directories,
192+ "include location \"%s\" is unsafe for "
193+ "cross-compilation",
194+ p->name);
195+ }
196+ }
197+#endif
198 }
199
200 /* Use given -I paths for #include "..." but not #include <...>, and
201--
2022.21.0
203
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-8.3/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
deleted file mode 100644
index e62deb2e47..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,73 +0,0 @@
1From 6640d7e39b13d1ef26d249153ab15d510fda3566 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 03/40] 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 8c5b1e9d561..2d1fc6b94d9 100755
30--- a/configure
31+++ b/configure
32@@ -6768,6 +6768,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.21.0
73
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0004-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc-8.3/0004-64-bit-multilib-hack.patch
deleted file mode 100644
index 371d877594..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0004-64-bit-multilib-hack.patch
+++ /dev/null
@@ -1,85 +0,0 @@
1From 1e649d81ca662c4cdf73882ebb8a11f0f19f5baf 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 04/40] 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 8ea0faff369..266c6008004 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 c017b7d04c5..126892cf40b 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 0faa2a02df4..13fd8ca971e 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.21.0
85
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0005-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc-8.3/0005-optional-libstdc.patch
deleted file mode 100644
index f9cf6c2087..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0005-optional-libstdc.patch
+++ /dev/null
@@ -1,125 +0,0 @@
1From b486380dcc4758e856ab6d847eb358d05bd79d64 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 05/40] 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 | 32 +++++++++++++++++++++++++++++++-
24 gcc/gcc.c | 1 +
25 4 files changed, 37 insertions(+), 1 deletion(-)
26
27diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
28index f591b39be5a..2955fcea867 100644
29--- a/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt
31@@ -1901,6 +1901,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 443a1746da3..e9b51be62ef 100644
44--- a/gcc/cp/g++spec.c
45+++ b/gcc/cp/g++spec.c
46@@ -137,6 +137,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 fb228631a42..310ba8109ed 100644
56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi
58@@ -212,6 +212,9 @@ in the following sections.
59 -fno-weak -nostdinc++ @gol
60 -fvisibility-inlines-hidden @gol
61 -fvisibility-ms-compat @gol
62+-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
63+-fvtv-counts -fvtv-debug @gol
64+-nostdlib++ @gol
65 -fext-numeric-literals @gol
66 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
67 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
68@@ -510,7 +513,7 @@ Objective-C and Objective-C++ Dialects}.
69 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
70 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
71 -static-libmpx -static-libmpxwrappers @gol
72--shared -shared-libgcc -symbolic @gol
73+-shared -shared-libgcc -symbolic -nostdlib++ @gol
74 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
75 -u @var{symbol} -z @var{keyword}}
76
77@@ -12359,6 +12362,33 @@ library subroutines.
78 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
79 GNU Compiler Collection (GCC) Internals}.)
80
81+@item -nostdlib++
82+@opindex nostdlib++
83+Do not use the standard system C++ runtime libraries when linking.
84+Only the libraries you specify will be passed to the linker.
85+
86+@cindex @option{-lgcc}, use with @option{-nostdlib}
87+@cindex @option{-nostdlib} and unresolved references
88+@cindex unresolved references and @option{-nostdlib}
89+@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
90+@cindex @option{-nodefaultlibs} and unresolved references
91+@cindex unresolved references and @option{-nodefaultlibs}
92+One of the standard libraries bypassed by @option{-nostdlib} and
93+@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
94+which GCC uses to overcome shortcomings of particular machines, or special
95+needs for some languages.
96+(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
97+Collection (GCC) Internals},
98+for more discussion of @file{libgcc.a}.)
99+In most cases, you need @file{libgcc.a} even when you want to avoid
100+other standard libraries. In other words, when you specify @option{-nostdlib}
101+or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
102+This ensures that you have no unresolved references to internal GCC
103+library subroutines.
104+(An example of such an internal subroutine is @code{__main}, used to ensure C++
105+constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
106+GNU Compiler Collection (GCC) Internals}.)
107+
108 @item -pie
109 @opindex pie
110 Produce a dynamically linked position independent executable on targets
111diff --git a/gcc/gcc.c b/gcc/gcc.c
112index 02b3cd39fc2..8cd27a5dad5 100644
113--- a/gcc/gcc.c
114+++ b/gcc/gcc.c
115@@ -1047,6 +1047,7 @@ proper position among the other output files. */
116 %(mflib) " STACK_SPLIT_SPEC "\
117 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
118 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
119+ %{!nostdlib++:}\
120 %{!nostdlib:%{!nostartfiles:%E}} %{T*} \n%(post_link) }}}}}}"
121 #endif
122
123--
1242.21.0
125
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0007-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-8.3/0007-COLLECT_GCC_OPTIONS.patch
deleted file mode 100644
index 8c7e72e1b7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0007-COLLECT_GCC_OPTIONS.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From 209e46f45382088caab54425b92b5dfc43ebb4fc 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 07/40] 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 8cd27a5dad5..d355d65583a 100644
18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c
20@@ -4677,6 +4677,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.21.0
38
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0008-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-8.3/0008-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
deleted file mode 100644
index f9632afecc..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0008-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
+++ /dev/null
@@ -1,96 +0,0 @@
1From 3bcbdf5ade54a72820ad7798119d0bbad4baf6ec 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 08/40] 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 20bee0494b1..1367136bfac 100644
31--- a/gcc/Makefile.in
32+++ b/gcc/Makefile.in
33@@ -538,7 +538,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 0c9b8ac5f55..134c2c2f156 100755
44--- a/gcc/configure
45+++ b/gcc/configure
46@@ -12158,8 +12158,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 53840363115..0c3c82e4ff7 100644
59--- a/gcc/configure.ac
60+++ b/gcc/configure.ac
61@@ -1922,8 +1922,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 0f75c863c0b..68d8d6613cf 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@@ -106,7 +106,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.21.0
96
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0009-fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-8.3/0009-fortran-cross-compile-hack.patch
deleted file mode 100644
index 50d895bfd7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0009-fortran-cross-compile-hack.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From e654573352d28f160f379ee77e4067cf108714d0 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 09/40] 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 91fce8fecd0..6747f86eb98 100755
20--- a/libgfortran/configure
21+++ b/libgfortran/configure
22@@ -12883,7 +12883,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 bf6d3634dda..9dbe43cc616 100644
33--- a/libgfortran/configure.ac
34+++ b/libgfortran/configure.ac
35@@ -250,7 +250,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.21.0
46
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0010-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-8.3/0010-cpp-honor-sysroot.patch
deleted file mode 100644
index 037eacf431..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0010-cpp-honor-sysroot.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From 2ae7af4eb70eff6aeda1fe96333ff50cfaa9d906 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 10/40] 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 f0802b8915c..f324d299849 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -64,5 +64,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 d355d65583a..570cdc00034 100644
41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c
43@@ -1343,7 +1343,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.21.0
54
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0011-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc-8.3/0011-MIPS64-Default-to-N64-ABI.patch
deleted file mode 100644
index c863cff932..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0011-MIPS64-Default-to-N64-ABI.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 1e1ea0eb55a594ac4cd7b838f74dec7405aae02b 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 11/40] 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 7af8e028104..fc7c91246ed 100644
18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc
20@@ -2143,29 +2143,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.21.0
57
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0012-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc-8.3/0012-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
deleted file mode 100644
index d3be10f207..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0012-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
+++ /dev/null
@@ -1,248 +0,0 @@
1From 6f8649936df3677109b8396f563c716ae8b237fe 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 12/40] 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/riscv/linux.h | 2 +-
27 gcc/config/rs6000/linux64.h | 16 ++++++----------
28 gcc/config/sh/linux.h | 2 +-
29 gcc/config/sparc/linux.h | 2 +-
30 gcc/config/sparc/linux64.h | 4 ++--
31 12 files changed, 30 insertions(+), 34 deletions(-)
32
33diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
34index 36b74dc1993..02373578af8 100644
35--- a/gcc/config/alpha/linux-elf.h
36+++ b/gcc/config/alpha/linux-elf.h
37@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
38 #define EXTRA_SPECS \
39 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
40
41-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
42-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
43+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
44+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
45 #if DEFAULT_LIBC == LIBC_UCLIBC
46 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
47 #elif DEFAULT_LIBC == LIBC_GLIBC
48diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
49index 8585fde3d41..b3af68cac57 100644
50--- a/gcc/config/arm/linux-eabi.h
51+++ b/gcc/config/arm/linux-eabi.h
52@@ -62,8 +62,8 @@
53 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
54
55 #undef GLIBC_DYNAMIC_LINKER
56-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
57-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
58+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
59+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
60 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
61
62 #define GLIBC_DYNAMIC_LINKER \
63diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
64index cfcd9cb1a5c..a798e987ecb 100644
65--- a/gcc/config/arm/linux-elf.h
66+++ b/gcc/config/arm/linux-elf.h
67@@ -60,7 +60,7 @@
68
69 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
70
71-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
72+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
73
74 #define LINUX_TARGET_LINK_SPEC "%{h*} \
75 %{static:-Bstatic} \
76diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
77index 69f97f15b0d..71bc31d9231 100644
78--- a/gcc/config/i386/linux.h
79+++ b/gcc/config/i386/linux.h
80@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
81 <http://www.gnu.org/licenses/>. */
82
83 #define GNU_USER_LINK_EMULATION "elf_i386"
84-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
85+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
86
87 #undef MUSL_DYNAMIC_LINKER
88 #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
89diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
90index f2d913e30ac..8725f33d8a5 100644
91--- a/gcc/config/i386/linux64.h
92+++ b/gcc/config/i386/linux64.h
93@@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
94 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
95 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
96
97-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
98-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
99-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
100+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
101+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
102+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
103
104 #undef MUSL_DYNAMIC_LINKER32
105 #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
106diff --git a/gcc/config/linux.h b/gcc/config/linux.h
107index 2ea4ff92c1d..487b0c0923b 100644
108--- a/gcc/config/linux.h
109+++ b/gcc/config/linux.h
110@@ -81,10 +81,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
111 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
112 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
113 supporting both 32-bit and 64-bit compilation. */
114-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
115-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
116-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
117-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
118+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
119+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
120+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
121+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
122 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
123 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
124 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
125diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
126index 2dfd0c18b90..12057c51b5e 100644
127--- a/gcc/config/mips/linux.h
128+++ b/gcc/config/mips/linux.h
129@@ -22,20 +22,20 @@ along with GCC; see the file COPYING3. If not see
130 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
131
132 #define GLIBC_DYNAMIC_LINKER32 \
133- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
134+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
135 #define GLIBC_DYNAMIC_LINKER64 \
136- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
137+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
138 #define GLIBC_DYNAMIC_LINKERN32 \
139- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
140+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
141
142 #undef UCLIBC_DYNAMIC_LINKER32
143 #define UCLIBC_DYNAMIC_LINKER32 \
144- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
145+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
146 #undef UCLIBC_DYNAMIC_LINKER64
147 #define UCLIBC_DYNAMIC_LINKER64 \
148- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
149+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
150 #define UCLIBC_DYNAMIC_LINKERN32 \
151- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
152+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
153
154 #undef MUSL_DYNAMIC_LINKER32
155 #define MUSL_DYNAMIC_LINKER32 \
156diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
157index aa8a28d5d31..ebf9551c955 100644
158--- a/gcc/config/riscv/linux.h
159+++ b/gcc/config/riscv/linux.h
160@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
161 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
162 } while (0)
163
164-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
165+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
166
167 #define MUSL_ABI_SUFFIX \
168 "%{mabi=ilp32:-sf}" \
169diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
170index 44eab40a234..54aa8d957e7 100644
171--- a/gcc/config/rs6000/linux64.h
172+++ b/gcc/config/rs6000/linux64.h
173@@ -413,16 +413,11 @@ extern int dot_symbols;
174 #undef LINK_OS_DEFAULT_SPEC
175 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
176
177-#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
178-
179+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
180 #ifdef LINUX64_DEFAULT_ABI_ELFv2
181-#define GLIBC_DYNAMIC_LINKER64 \
182-"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
183-":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
184+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
185 #else
186-#define GLIBC_DYNAMIC_LINKER64 \
187-"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
188-":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
189+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
190 #endif
191
192 #define MUSL_DYNAMIC_LINKER32 \
193@@ -430,8 +425,9 @@ extern int dot_symbols;
194 #define MUSL_DYNAMIC_LINKER64 \
195 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
196
197-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
198-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
199+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
200+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
201+
202 #if DEFAULT_LIBC == LIBC_UCLIBC
203 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
204 "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
205diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
206index 6d2ccd012ba..ec78a89ce15 100644
207--- a/gcc/config/sh/linux.h
208+++ b/gcc/config/sh/linux.h
209@@ -64,7 +64,7 @@ along with GCC; see the file COPYING3. If not see
210 "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
211 "%{mfdpic:-fdpic}.so.1"
212
213-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
214+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
215
216 #undef SUBTARGET_LINK_EMUL_SUFFIX
217 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
218diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
219index 9fb03af0fe9..401fddbbb22 100644
220--- a/gcc/config/sparc/linux.h
221+++ b/gcc/config/sparc/linux.h
222@@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
223 When the -shared link option is used a final link is not being
224 done. */
225
226-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
227+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
228
229 #undef LINK_SPEC
230 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
231diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
232index c1fe42165b7..26a79bfa2e3 100644
233--- a/gcc/config/sparc/linux64.h
234+++ b/gcc/config/sparc/linux64.h
235@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. If not see
236 When the -shared link option is used a final link is not being
237 done. */
238
239-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
240-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
241+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
242+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
243
244 #ifdef SPARC_BI_ARCH
245
246--
2472.21.0
248
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0013-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc-8.3/0013-gcc-Fix-argument-list-too-long-error.patch
deleted file mode 100644
index e9d2cac22e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0013-gcc-Fix-argument-list-too-long-error.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 9e815965fbaa90134be0e777cfc2fbcfab16b674 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 13/40] 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 1367136bfac..71a8275c39f 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -3538,7 +3538,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.21.0
40
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0014-Disable-sdt.patch b/meta/recipes-devtools/gcc/gcc-8.3/0014-Disable-sdt.patch
deleted file mode 100644
index 2bc44515cb..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0014-Disable-sdt.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1From 00c7a7fdd4b4aad9e57d8b541de17ad209b6cd06 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 14/40] 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 134c2c2f156..5111ec0aabb 100755
29--- a/gcc/configure
30+++ b/gcc/configure
31@@ -29282,12 +29282,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 0c3c82e4ff7..3e09af916fd 100644
52--- a/gcc/configure.ac
53+++ b/gcc/configure.ac
54@@ -5943,15 +5943,15 @@ fi
55 AC_SUBST([enable_default_ssp])
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 5535bfa2b5a..13d793f5059 100755
81--- a/libstdc++-v3/configure
82+++ b/libstdc++-v3/configure
83@@ -21786,11 +21786,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 0ef96270c9c..afe55a1b215 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.21.0
113
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0015-libtool.patch b/meta/recipes-devtools/gcc/gcc-8.3/0015-libtool.patch
deleted file mode 100644
index 750f8a244e..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0015-libtool.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 80f2b01b3f917cea08294328c8bbc51dadece4af 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 15/40] 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 9503ec85d70..0121fba707f 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.21.0
42
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0016-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta/recipes-devtools/gcc/gcc-8.3/0016-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
deleted file mode 100644
index 9b1b4d4df5..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0016-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From a66ec1e382bf869749588f072a4a7c09039f2b3a 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 16/40] 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 b3af68cac57..330b6e13c5f 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -88,10 +88,14 @@
26 #define MUSL_DYNAMIC_LINKER \
27 "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
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.21.0
43
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0017-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta/recipes-devtools/gcc/gcc-8.3/0017-Use-the-multilib-config-files-from-B-instead-of-usin.patch
deleted file mode 100644
index 382fecdbc5..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0017-Use-the-multilib-config-files-from-B-instead-of-usin.patch
+++ /dev/null
@@ -1,102 +0,0 @@
1From 624db734f656ad8cdf8b3cf3fc8e860b70c6c251 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 17/40] 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 5111ec0aabb..3d9dcbdc93d 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -12138,10 +12138,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@@ -12152,6 +12162,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 3e09af916fd..e09c840b605 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -1902,10 +1902,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@@ -1916,6 +1926,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.21.0
102
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0018-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta/recipes-devtools/gcc/gcc-8.3/0018-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
deleted file mode 100644
index 20e77d6eaa..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0018-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 27cca95dcfeead8c52d292c4824ee96f178d6183 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 18/40] 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 0121fba707f..52bdbdb5f9c 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.21.0
31
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0019-export-CPP.patch b/meta/recipes-devtools/gcc/gcc-8.3/0019-export-CPP.patch
deleted file mode 100644
index 140c67a486..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0019-export-CPP.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From a2936382da81aefa9b69c1fc625f6c706b7ea1d8 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 19/40] 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 38774f542a6..b426d4f9350 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.21.0
53
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0020-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch b/meta/recipes-devtools/gcc/gcc-8.3/0020-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
deleted file mode 100644
index b22557eaf7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0020-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From d4326ab74a362b0fc83ed866f82c359389a36adc 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 20/40] 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 b9897785a89..7d06f0d0edb 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$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
39+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
40--
412.21.0
42
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0021-Ensure-target-gcc-headers-can-be-included.patch b/meta/recipes-devtools/gcc/gcc-8.3/0021-Ensure-target-gcc-headers-can-be-included.patch
deleted file mode 100644
index 58b4d1aa68..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0021-Ensure-target-gcc-headers-can-be-included.patch
+++ /dev/null
@@ -1,98 +0,0 @@
1From 94cc995cee76a9d59204a900fcaa2afb2eaa75c2 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 21/40] 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 71a8275c39f..aa4adc3db24 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -614,6 +614,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 = $(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@@ -2870,6 +2871,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 b36a979d5ba..e2e187dedaf 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 9035b333be8..5982bbda61d 100644
62--- a/gcc/defaults.h
63+++ b/gcc/defaults.h
64@@ -1455,4 +1455,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
65 #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
66 #endif
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 570cdc00034..3fb64d453f1 100644
80--- a/gcc/gcc.c
81+++ b/gcc/gcc.c
82@@ -1464,13 +1464,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.22.1
98
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0022-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch b/meta/recipes-devtools/gcc/gcc-8.3/0022-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
deleted file mode 100644
index 6f0d3f11d3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0022-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From bc192f0a07ad819dee93446c5ef6895d9550d92d 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 22/40] 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 803b292cce5..b47842eb590 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 c8f38be5835..4fab7cec3ea 100644
40--- a/libatomic/Makefile.in
41+++ b/libatomic/Makefile.in
42@@ -335,7 +335,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.21.0
54
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0023-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta/recipes-devtools/gcc/gcc-8.3/0023-Don-t-search-host-directory-during-relink-if-inst_pr.patch
deleted file mode 100644
index fe3f3436f0..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0023-Don-t-search-host-directory-during-relink-if-inst_pr.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From 0409d2dd7322ecbed731cbe29b034fea43c5dddc 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 23/40] 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 52bdbdb5f9c..82bcec39f05 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.21.0
38
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0024-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/meta/recipes-devtools/gcc/gcc-8.3/0024-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
deleted file mode 100644
index c388a0ad02..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0024-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 56e2e1fc2a27c4a5cc9b471d5d0af90bcb871bfa 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 24/40] Use SYSTEMLIBS_DIR replacement instead of hardcoding base_libdir
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 gcc/config/aarch64/aarch64-linux.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
14index bf1327e98cc..64436183bc8 100644
15--- a/gcc/config/aarch64/aarch64-linux.h
16+++ b/gcc/config/aarch64/aarch64-linux.h
17@@ -21,7 +21,7 @@
18 #ifndef GCC_AARCH64_LINUX_H
19 #define GCC_AARCH64_LINUX_H
20
21-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
22+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
23
24 #undef MUSL_DYNAMIC_LINKER
25 #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
26--
272.21.0
28
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0025-aarch64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc-8.3/0025-aarch64-Add-support-for-musl-ldso.patch
deleted file mode 100644
index 03f9725b89..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0025-aarch64-Add-support-for-musl-ldso.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From b142e77e44e1acece6da54ccdc24c4da89cf4b99 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 25/40] aarch64: Add support for musl ldso
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 gcc/config/aarch64/aarch64-linux.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
14index 64436183bc8..ba156676026 100644
15--- a/gcc/config/aarch64/aarch64-linux.h
16+++ b/gcc/config/aarch64/aarch64-linux.h
17@@ -24,7 +24,7 @@
18 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
19
20 #undef MUSL_DYNAMIC_LINKER
21-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
22+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
23
24 #undef ASAN_CC1_SPEC
25 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
26--
272.21.0
28
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0026-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta/recipes-devtools/gcc/gcc-8.3/0026-libcc1-fix-libcc1-s-install-path-and-rpath.patch
deleted file mode 100644
index 8591738962..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0026-libcc1-fix-libcc1-s-install-path-and-rpath.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From 3d4e53fc7cd71ce1181af8a5e9655398857af741 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 26/40] 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 6ecb66b4365..634cce3c2a9 100644
24--- a/libcc1/Makefile.am
25+++ b/libcc1/Makefile.am
26@@ -37,8 +37,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 libcp1plugin.la
37diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
38index 47be10025ad..8d5481d87bd 100644
39--- a/libcc1/Makefile.in
40+++ b/libcc1/Makefile.in
41@@ -303,8 +303,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 libcp1plugin.la
50 @ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la
51 shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \
52--
532.21.0
54
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0027-handle-sysroot-support-for-nativesdk-gcc.patch b/meta/recipes-devtools/gcc/gcc-8.3/0027-handle-sysroot-support-for-nativesdk-gcc.patch
deleted file mode 100644
index 4b955de8a5..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0027-handle-sysroot-support-for-nativesdk-gcc.patch
+++ /dev/null
@@ -1,213 +0,0 @@
1From c033c1df11b692213d03db91d6cc145b4adedfac 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 27/40] 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 e2e187dedaf..2faba2b1d63 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 4a0186d1cf2..29e5d9da0dc 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 3fb64d453f1..cd0c7fbe961 100644
153--- a/gcc/gcc.c
154+++ b/gcc/gcc.c
155@@ -248,6 +248,8 @@ FILE *report_times_to_file = NULL;
156 #endif
157 static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
158
159+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
160+
161 /* Nonzero means pass the updated target_system_root to the compiler. */
162
163 static int target_system_root_changed;
164@@ -519,6 +521,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@@ -1487,10 +1490,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@@ -1498,9 +1501,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@@ -5849,6 +5852,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.21.0
213
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0028-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta/recipes-devtools/gcc/gcc-8.3/0028-Search-target-sysroot-gcc-version-specific-dirs-with.patch
deleted file mode 100644
index 1b25d7808b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0028-Search-target-sysroot-gcc-version-specific-dirs-with.patch
+++ /dev/null
@@ -1,102 +0,0 @@
1From 62240d4c725ea0b43abfb901ddad90e83e29a25c 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 28/40] 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 cd0c7fbe961..f6f3aa077c8 100644
55--- a/gcc/gcc.c
56+++ b/gcc/gcc.c
57@@ -2527,7 +2527,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@@ -2539,6 +2539,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.21.0
102
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0029-Fix-various-_FOR_BUILD-and-related-variables.patch b/meta/recipes-devtools/gcc/gcc-8.3/0029-Fix-various-_FOR_BUILD-and-related-variables.patch
deleted file mode 100644
index 0c8bdb17de..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0029-Fix-various-_FOR_BUILD-and-related-variables.patch
+++ /dev/null
@@ -1,137 +0,0 @@
1From 1377c738e31a1e1599cfab189485a9459f803e79 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 29/40] 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 b426d4f9350..a2af9905cce 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 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
40@@ -169,6 +170,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@@ -186,6 +190,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@@ -743,6 +748,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 1f23b79b4b2..6c5652e811d 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 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
78@@ -171,6 +172,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@@ -188,6 +192,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 5ae693fb06c..02ee0aa72f4 100644
98--- a/gcc/Makefile.in
99+++ b/gcc/Makefile.in
100@@ -801,7 +801,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@
101 BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@
102 BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG)
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 3d9dcbdc93d..aa127a4f6a4 100755
111--- a/gcc/configure
112+++ b/gcc/configure
113@@ -11797,7 +11797,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 e09c840b605..18bf53c7e0a 100644
124--- a/gcc/configure.ac
125+++ b/gcc/configure.ac
126@@ -1708,7 +1708,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.21.0
137
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0030-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc-8.3/0030-nios2-Define-MUSL_DYNAMIC_LINKER.patch
deleted file mode 100644
index 04e126c5c3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0030-nios2-Define-MUSL_DYNAMIC_LINKER.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 75da3cc9ca2d3de8c2062f23bf4f72415741ef83 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 30/40] nios2: Define MUSL_DYNAMIC_LINKER
5
6Upstream-Status: Pending
7
8Signed-off-by: Marek Vasut <marex@denx.de>
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
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 4729105626d..36181eb7b85 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.21.0
28
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0031-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta/recipes-devtools/gcc/gcc-8.3/0031-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
deleted file mode 100644
index 002cf2becc..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0031-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
+++ /dev/null
@@ -1,87 +0,0 @@
1From f715aeef294b85fa593ef69e6d0114cc7b15312b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 18:10:54 -0700
4Subject: [PATCH 31/40] Add ssp_nonshared to link commandline for musl targets
5
6when -fstack-protector options are enabled we need to
7link with ssp_shared on musl since it does not provide
8the __stack_chk_fail_local() so essentially it provides
9libssp but not libssp_nonshared something like
10TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED
11 where-as for glibc the needed symbols
12are already present in libc_nonshared library therefore
13we do not need any library helper on glibc based systems
14but musl needs the libssp_noshared from gcc
15
16Upstream-Status: Pending
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/config/linux.h | 7 +++++++
21 gcc/config/rs6000/linux.h | 10 ++++++++++
22 gcc/config/rs6000/linux64.h | 10 ++++++++++
23 3 files changed, 27 insertions(+)
24
25diff --git a/gcc/config/linux.h b/gcc/config/linux.h
26index 487b0c0923b..4769d089538 100644
27--- a/gcc/config/linux.h
28+++ b/gcc/config/linux.h
29@@ -182,6 +182,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
30 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
31 { 0, 0, 0, 0, 0, 0 } \
32 }
33+#ifdef TARGET_LIBC_PROVIDES_SSP
34+#undef LINK_SSP_SPEC
35+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
36+ "|fstack-protector-strong|fstack-protector-explicit" \
37+ ":-lssp_nonshared}"
38+#endif
39+
40 #endif
41
42 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
43diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
44index 01b40c762f6..e7c5e92215c 100644
45--- a/gcc/config/rs6000/linux.h
46+++ b/gcc/config/rs6000/linux.h
47@@ -92,6 +92,16 @@
48 " -m elf32ppclinux")
49 #endif
50
51+/* link libssp_nonshared.a with musl */
52+#if DEFAULT_LIBC == LIBC_MUSL
53+#ifdef TARGET_LIBC_PROVIDES_SSP
54+#undef LINK_SSP_SPEC
55+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
56+ "|fstack-protector-strong|fstack-protector-explicit" \
57+ ":-lssp_nonshared}"
58+#endif
59+#endif
60+
61 #undef LINK_OS_LINUX_SPEC
62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
63 %{!static-pie: \
64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
65index 54aa8d957e7..619e113e2b8 100644
66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h
68@@ -466,6 +466,16 @@ extern int dot_symbols;
69 " -m elf64ppc")
70 #endif
71
72+/* link libssp_nonshared.a with musl */
73+#if DEFAULT_LIBC == LIBC_MUSL
74+#ifdef TARGET_LIBC_PROVIDES_SSP
75+#undef LINK_SSP_SPEC
76+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
77+ "|fstack-protector-strong|fstack-protector-explicit" \
78+ ":-lssp_nonshared}"
79+#endif
80+#endif
81+
82 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
83 %{!static-pie: \
84 %{rdynamic:-export-dynamic} \
85--
862.21.0
87
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0032-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-8.3/0032-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
deleted file mode 100644
index 025caba318..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0032-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
+++ /dev/null
@@ -1,125 +0,0 @@
1From 6dfbca78b8d253aecf9cbb5e68e04b8dd3d6a543 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Apr 2016 20:03:28 +0000
4Subject: [PATCH 32/40] libgcc: Add knob to use ldbl-128 on ppc
5
6musl does not support ldbl 128 so we can not assume
7that linux as a whole supports ldbl-128 bits, instead
8act upon configure option passed to gcc and assume no
9on musl and yes otherwise if no option is passed since
10default behaviour is to assume ldbl128 it does not
11change the defaults
12
13Upstream-Status: Pending
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 libgcc/Makefile.in | 1 +
18 libgcc/config/rs6000/t-linux | 5 ++++-
19 libgcc/configure | 18 ++++++++++++++++++
20 libgcc/configure.ac | 12 ++++++++++++
21 4 files changed, 35 insertions(+), 1 deletion(-)
22 mode change 100644 => 100755 libgcc/configure
23
24diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
25index dd8cee99fd3..b5f478af382 100644
26--- a/libgcc/Makefile.in
27+++ b/libgcc/Makefile.in
28@@ -48,6 +48,7 @@ unwind_header = @unwind_header@
29 md_unwind_header = @md_unwind_header@
30 sfp_machine_header = @sfp_machine_header@
31 thread_header = @thread_header@
32+with_ldbl128 = @with_ldbl128@
33
34 host_noncanonical = @host_noncanonical@
35 real_host_noncanonical = @real_host_noncanonical@
36diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
37index 4f6d4c4a4d2..c50dd94a2da 100644
38--- a/libgcc/config/rs6000/t-linux
39+++ b/libgcc/config/rs6000/t-linux
40@@ -1,3 +1,6 @@
41 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
42
43-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
44+ifeq ($(with_ldbl128),yes)
45+HOST_LIBGCC2_CFLAGS += -mlong-double-128
46+endif
47+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
48diff --git a/libgcc/configure b/libgcc/configure
49old mode 100644
50new mode 100755
51index b2f3f870844..ed806587c17
52--- a/libgcc/configure
53+++ b/libgcc/configure
54@@ -619,6 +619,7 @@ build_vendor
55 build_cpu
56 build
57 with_aix_soname
58+with_ldbl128
59 enable_vtable_verify
60 enable_shared
61 libgcc_topdir
62@@ -668,6 +669,7 @@ with_cross_host
63 with_ld
64 enable_shared
65 enable_vtable_verify
66+with_long_double_128
67 with_aix_soname
68 enable_version_specific_runtime_libs
69 with_slibdir
70@@ -1329,6 +1331,7 @@ Optional Packages:
71 --with-target-subdir=SUBDIR Configuring in a subdirectory for target
72 --with-cross-host=HOST Configuring with a cross compiler
73 --with-ld arrange to use the specified ld (full pathname)
74+ --with-long-double-128 use 128-bit long double by default
75 --with-aix-soname=aix|svr4|both
76 shared library versioning (aka "SONAME") variant to
77 provide on AIX
78@@ -2213,6 +2216,21 @@ fi
79
80
81
82+# Check whether --with-long-double-128 was given.
83+if test "${with_long_double_128+set}" = set; then :
84+ withval=$with_long_double_128; with_ldbl128="$with_long_double_128"
85+else
86+ case "${host}" in
87+ power*-*-musl*)
88+ with_ldbl128="no";;
89+ *) with_ldbl128="yes";;
90+ esac
91+
92+fi
93+
94+
95+
96+
97 # Check whether --with-aix-soname was given.
98 if test "${with_aix_soname+set}" = set; then :
99 withval=$with_aix_soname; case "${host}:${enable_shared}" in
100diff --git a/libgcc/configure.ac b/libgcc/configure.ac
101index b59aa746afc..42220a263c5 100644
102--- a/libgcc/configure.ac
103+++ b/libgcc/configure.ac
104@@ -78,6 +78,18 @@ AC_ARG_ENABLE(vtable-verify,
105 [enable_vtable_verify=no])
106 AC_SUBST(enable_vtable_verify)
107
108+AC_ARG_WITH(long-double-128,
109+[AS_HELP_STRING([--with-long-double-128],
110+ [use 128-bit long double by default])],
111+ with_ldbl128="$with_long_double_128",
112+[case "${host}" in
113+ power*-*-musl*)
114+ with_ldbl128="no";;
115+ *) with_ldbl128="yes";;
116+ esac
117+])
118+AC_SUBST(with_ldbl128)
119+
120 AC_ARG_WITH(aix-soname,
121 [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
122 [shared library versioning (aka "SONAME") variant to provide on AIX])],
123--
1242.21.0
125
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0033-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch b/meta/recipes-devtools/gcc/gcc-8.3/0033-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
deleted file mode 100644
index 343f7aad1b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0033-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 7e55147e8e609ace6f9eecd86a956636687671f0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 4 May 2016 21:11:34 -0700
4Subject: [PATCH 33/40] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS
5
6Upstream-Status: Pending
7
8Signed-off-by: Christopher Larson <chris_larson@mentor.com>
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 libgcc/config/t-slibgcc | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc
15index 7e60b621a2d..ea22ede3361 100644
16--- a/libgcc/config/t-slibgcc
17+++ b/libgcc/config/t-slibgcc
18@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
19 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
20
21 SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
22- $(SHLIB_LDFLAGS) \
23+ $(LDFLAGS) $(SHLIB_LDFLAGS) \
24 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
25 $(SHLIB_OBJS) $(SHLIB_LC) && \
26 rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
27--
282.21.0
29
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta/recipes-devtools/gcc/gcc-8.3/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
deleted file mode 100644
index 92224cc561..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
+++ /dev/null
@@ -1,85 +0,0 @@
1From 46ca51dd413330bb8425b06283e7667bfb507c3d Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH 34/40] libgcc_s: Use alias for __cpu_indicator_init instead of symver
5
6Adapter from
7
8https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
9
10This fix was debated but hasnt been applied gcc upstream since
11they expect musl to support '@' in symbol versioning which is
12a sun/gnu versioning extention. This patch however avoids the
13need for the '@' symbols at all
14
15libgcc/Changelog:
16
172015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
18
19 * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
20 (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
21
22 * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
23
24gcc/Changelog:
25
262015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
27
28 * config/i386/i386.c (ix86_expand_builtin): Make __builtin_cpu_init
29 call __cpu_indicator_init_local instead of __cpu_indicator_init.
30
31Upstream-Status: Pending
32
33Signed-off-by: Khem Raj <raj.khem@gmail.com>
34---
35 gcc/config/i386/i386.c | 4 ++--
36 libgcc/config/i386/cpuinfo.c | 6 +++---
37 libgcc/config/i386/t-linux | 2 +-
38 3 files changed, 6 insertions(+), 6 deletions(-)
39
40diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
41index a88a29b51e6..6f3f5187970 100644
42--- a/gcc/config/i386/i386.c
43+++ b/gcc/config/i386/i386.c
44@@ -36555,10 +36555,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
45 {
46 case IX86_BUILTIN_CPU_INIT:
47 {
48- /* Make it call __cpu_indicator_init in libgcc. */
49+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
50 tree call_expr, fndecl, type;
51 type = build_function_type_list (integer_type_node, NULL_TREE);
52- fndecl = build_fn_decl ("__cpu_indicator_init", type);
53+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
54 call_expr = build_call_expr (fndecl, 0);
55 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
56 }
57diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
58index d1853d5515b..864150c9249 100644
59--- a/libgcc/config/i386/cpuinfo.c
60+++ b/libgcc/config/i386/cpuinfo.c
61@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
62 return 0;
63 }
64
65-#if defined SHARED && defined USE_ELF_SYMVER
66-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
67-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
68+#ifndef SHARED
69+int __cpu_indicator_init_local (void)
70+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
71 #endif
72diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
73index 8506a635790..564296f788e 100644
74--- a/libgcc/config/i386/t-linux
75+++ b/libgcc/config/i386/t-linux
76@@ -3,5 +3,5 @@
77 # t-slibgcc-elf-ver and t-linux
78 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
79
80-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
81+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
82 CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
83--
842.21.0
85
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0035-sync-gcc-stddef.h-with-musl.patch b/meta/recipes-devtools/gcc/gcc-8.3/0035-sync-gcc-stddef.h-with-musl.patch
deleted file mode 100644
index 6ecd6e972d..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0035-sync-gcc-stddef.h-with-musl.patch
+++ /dev/null
@@ -1,91 +0,0 @@
1From 38d401fb6ab555d09f4a9a677721dde0743876e1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Feb 2017 12:56:00 -0800
4Subject: [PATCH 35/40] sync gcc stddef.h with musl
5
6musl defines ptrdiff_t size_t and wchar_t
7so dont define them here if musl is definining them
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 gcc/ginclude/stddef.h | 9 +++++++++
14 1 file changed, 9 insertions(+)
15
16diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
17index 31b96a7e5e1..438a3ce7c56 100644
18--- a/gcc/ginclude/stddef.h
19+++ b/gcc/ginclude/stddef.h
20@@ -134,6 +134,7 @@ _TYPE_wchar_t;
21 #ifndef ___int_ptrdiff_t_h
22 #ifndef _GCC_PTRDIFF_T
23 #ifndef _PTRDIFF_T_DECLARED /* DragonFly */
24+#ifndef __DEFINED_ptrdiff_t /* musl */
25 #define _PTRDIFF_T
26 #define _T_PTRDIFF_
27 #define _T_PTRDIFF
28@@ -143,10 +144,12 @@ _TYPE_wchar_t;
29 #define ___int_ptrdiff_t_h
30 #define _GCC_PTRDIFF_T
31 #define _PTRDIFF_T_DECLARED
32+#define __DEFINED_ptrdiff_t /* musl */
33 #ifndef __PTRDIFF_TYPE__
34 #define __PTRDIFF_TYPE__ long int
35 #endif
36 typedef __PTRDIFF_TYPE__ ptrdiff_t;
37+#endif /* __DEFINED_ptrdiff_t */
38 #endif /* _PTRDIFF_T_DECLARED */
39 #endif /* _GCC_PTRDIFF_T */
40 #endif /* ___int_ptrdiff_t_h */
41@@ -184,6 +187,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
42 #ifndef _GCC_SIZE_T
43 #ifndef _SIZET_
44 #ifndef __size_t
45+#ifndef __DEFINED_size_t /* musl */
46 #define __size_t__ /* BeOS */
47 #define __SIZE_T__ /* Cray Unicos/Mk */
48 #define _SIZE_T
49@@ -200,6 +204,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
50 #define ___int_size_t_h
51 #define _GCC_SIZE_T
52 #define _SIZET_
53+#define __DEFINED_size_t /* musl */
54 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
55 || defined(__DragonFly__) \
56 || defined(__FreeBSD_kernel__)
57@@ -235,6 +240,7 @@ typedef long ssize_t;
58 #endif /* _SIZE_T */
59 #endif /* __SIZE_T__ */
60 #endif /* __size_t__ */
61+#endif /* __DEFINED_size_t */
62 #undef __need_size_t
63 #endif /* _STDDEF_H or __need_size_t. */
64
65@@ -264,6 +270,7 @@ typedef long ssize_t;
66 #ifndef ___int_wchar_t_h
67 #ifndef __INT_WCHAR_T_H
68 #ifndef _GCC_WCHAR_T
69+#ifndef __DEFINED_wchar_t /* musl */
70 #define __wchar_t__ /* BeOS */
71 #define __WCHAR_T__ /* Cray Unicos/Mk */
72 #define _WCHAR_T
73@@ -279,6 +286,7 @@ typedef long ssize_t;
74 #define __INT_WCHAR_T_H
75 #define _GCC_WCHAR_T
76 #define _WCHAR_T_DECLARED
77+#define __DEFINED_wchar_t /* musl */
78
79 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
80 instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
81@@ -344,6 +352,7 @@ typedef __WCHAR_TYPE__ wchar_t;
82 #endif
83 #endif /* __WCHAR_T__ */
84 #endif /* __wchar_t__ */
85+#endif /* __DEFINED_wchar_t musl */
86 #undef __need_wchar_t
87 #endif /* _STDDEF_H or __need_wchar_t. */
88
89--
902.21.0
91
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0036-fix-segmentation-fault-in-precompiled-header-generat.patch b/meta/recipes-devtools/gcc/gcc-8.3/0036-fix-segmentation-fault-in-precompiled-header-generat.patch
deleted file mode 100644
index c4ce5db553..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0036-fix-segmentation-fault-in-precompiled-header-generat.patch
+++ /dev/null
@@ -1,60 +0,0 @@
1From a9bb29a4e9b478f9b126e483467ce9031c33fe4f Mon Sep 17 00:00:00 2001
2From: Juro Bystricky <juro.bystricky@intel.com>
3Date: Mon, 19 Mar 2018 22:31:20 -0700
4Subject: [PATCH 36/40] fix segmentation fault in precompiled header generation
5
6Prevent a segmentation fault which occurs when using incorrect
7structure trying to access name of some named operators, such as
8CPP_NOT, CPP_AND etc. "token->val.node.spelling" cannot be used in
9those cases, as is may not be initialized at all.
10
11[YOCTO #11738]
12
13Upstream-Status: Pending
14
15Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 libcpp/lex.c | 26 +++++++++++++++++++++-----
19 1 file changed, 21 insertions(+), 5 deletions(-)
20
21diff --git a/libcpp/lex.c b/libcpp/lex.c
22index 37c365a3560..63480048db6 100644
23--- a/libcpp/lex.c
24+++ b/libcpp/lex.c
25@@ -3279,11 +3279,27 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token,
26 spell_ident:
27 case SPELL_IDENT:
28 if (forstring)
29- {
30- memcpy (buffer, NODE_NAME (token->val.node.spelling),
31- NODE_LEN (token->val.node.spelling));
32- buffer += NODE_LEN (token->val.node.spelling);
33- }
34+ {
35+ if (token->type == CPP_NAME)
36+ {
37+ memcpy (buffer, NODE_NAME (token->val.node.spelling),
38+ NODE_LEN (token->val.node.spelling));
39+ buffer += NODE_LEN (token->val.node.spelling);
40+ break;
41+ }
42+ /* NAMED_OP, cannot use node.spelling */
43+ if (token->flags & NAMED_OP)
44+ {
45+ const char *str = cpp_named_operator2name (token->type);
46+ if (str)
47+ {
48+ size_t len = strlen(str);
49+ memcpy(buffer, str, len);
50+ buffer += len;
51+ }
52+ break;
53+ }
54+ }
55 else
56 buffer = _cpp_spell_ident_ucns (buffer, token->val.node.node);
57 break;
58--
592.21.0
60
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0037-Fix-for-testsuite-failure.patch b/meta/recipes-devtools/gcc/gcc-8.3/0037-Fix-for-testsuite-failure.patch
deleted file mode 100644
index 70999dd453..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0037-Fix-for-testsuite-failure.patch
+++ /dev/null
@@ -1,258 +0,0 @@
1From 1e5c1ef34d92b4157e1a24ca743d45f3a7375a5e Mon Sep 17 00:00:00 2001
2From: RAGHUNATH LOLUR <raghunath.lolur@kpit.com>
3Date: Wed, 6 Dec 2017 22:52:26 -0800
4Subject: [PATCH 37/40] Fix for testsuite failure
5
62017-11-16 Raghunath Lolur <raghunath.lolur@kpit.com>
7
8 * gcc.dg/pr56275.c: If SSE is disabled, ensure that
9 "-mfpmath" is not set to use SSE. Set "-mfpmath=387".
10 * gcc.dg/pr68306.c: Likewise
11 * gcc.dg/pr68306-2.c: Likewise
12 * gcc.dg/pr68306-3.c: Likewise
13 * gcc.dg/pr69634.c: Likewise
14 * gcc.target/i386/amd64-abi-1.c: Likewise
15 * gcc.target/i386/funcspec-6.c: Likewise
16 * gcc.target/i386/interrupt-387-err-1.c: Likewise
17 * gcc.target/i386/isa-14.c: Likewise
18 * gcc.target/i386/pr44948-2b.c: Likewise
19 * gcc.target/i386/pr53425-1.c: Likewise
20 * gcc.target/i386/pr53425-2.c: Likewise
21 * gcc.target/i386/pr55247.c: Likewise
22 * gcc.target/i386/pr59644.c: Likewise
23 * gcc.target/i386/pr62120.c: Likewise
24 * gcc.target/i386/pr70467-1.c: Likewise
25 * gcc.target/i386/warn-vect-op-1.c: Likewise
26
27If -Wall, -Werror are used during compilation various test cases fail
28to compile.
29
30If SSE is disabled, be sure to -mfpmath=387 to resolve this.
31
32This patch removes the changes to Changelog from the original patch.
33This will help us avoid conflicts.
34
35Upstream-Status: Pending
36
37Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
38---
39 gcc/testsuite/gcc.dg/pr56275.c | 2 +-
40 gcc/testsuite/gcc.dg/pr68306-2.c | 2 +-
41 gcc/testsuite/gcc.dg/pr68306-3.c | 2 +-
42 gcc/testsuite/gcc.dg/pr68306.c | 2 +-
43 gcc/testsuite/gcc.dg/pr69634.c | 2 +-
44 gcc/testsuite/gcc.target/i386/amd64-abi-1.c | 2 +-
45 gcc/testsuite/gcc.target/i386/funcspec-6.c | 1 +
46 gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c | 2 +-
47 gcc/testsuite/gcc.target/i386/isa-14.c | 2 +-
48 gcc/testsuite/gcc.target/i386/pr44948-2b.c | 2 +-
49 gcc/testsuite/gcc.target/i386/pr53425-1.c | 2 +-
50 gcc/testsuite/gcc.target/i386/pr53425-2.c | 2 +-
51 gcc/testsuite/gcc.target/i386/pr55247.c | 2 +-
52 gcc/testsuite/gcc.target/i386/pr59644.c | 2 +-
53 gcc/testsuite/gcc.target/i386/pr62120.c | 2 +-
54 gcc/testsuite/gcc.target/i386/pr70467-1.c | 2 +-
55 gcc/testsuite/gcc.target/i386/warn-vect-op-1.c | 2 +-
56 17 files changed, 17 insertions(+), 16 deletions(-)
57
58diff --git a/gcc/testsuite/gcc.dg/pr56275.c b/gcc/testsuite/gcc.dg/pr56275.c
59index b901bb2b199..a4f6c95e1a1 100644
60--- a/gcc/testsuite/gcc.dg/pr56275.c
61+++ b/gcc/testsuite/gcc.dg/pr56275.c
62@@ -1,6 +1,6 @@
63 /* { dg-do compile } */
64 /* { dg-options "-O2" } */
65-/* { dg-additional-options "-mno-sse" { target { i?86-*-* x86_64-*-* } } } */
66+/* { dg-additional-options "-mno-sse -mfpmath=387" { target { i?86-*-* x86_64-*-* } } } */
67
68 typedef long long v2tw __attribute__ ((vector_size (2 * sizeof (long long))));
69
70diff --git a/gcc/testsuite/gcc.dg/pr68306-2.c b/gcc/testsuite/gcc.dg/pr68306-2.c
71index 4672ebe7987..2a368c484b6 100644
72--- a/gcc/testsuite/gcc.dg/pr68306-2.c
73+++ b/gcc/testsuite/gcc.dg/pr68306-2.c
74@@ -1,6 +1,6 @@
75 /* { dg-do compile } */
76 /* { dg-options "-O3" } */
77-/* { dg-additional-options "-mno-sse -mno-mmx" { target i?86-*-* x86_64-*-* } } */
78+/* { dg-additional-options "-mno-sse -mno-mmx -mfpmath=387" { target i?86-*-* x86_64-*-* } } */
79
80 struct {
81 int tz_minuteswest;
82diff --git a/gcc/testsuite/gcc.dg/pr68306-3.c b/gcc/testsuite/gcc.dg/pr68306-3.c
83index f5a8c102cf8..df3390c64c2 100644
84--- a/gcc/testsuite/gcc.dg/pr68306-3.c
85+++ b/gcc/testsuite/gcc.dg/pr68306-3.c
86@@ -1,6 +1,6 @@
87 /* { dg-do compile } */
88 /* { dg-options "-O3" } */
89-/* { dg-additional-options "-mno-sse -mno-mmx" { target i?86-*-* x86_64-*-* } } */
90+/* { dg-additional-options "-mno-sse -mno-mmx -mfpmath=387" { target i?86-*-* x86_64-*-* } } */
91 /* { dg-additional-options "-mno-altivec -mno-vsx" { target powerpc*-*-* } } */
92
93 extern void fn2();
94diff --git a/gcc/testsuite/gcc.dg/pr68306.c b/gcc/testsuite/gcc.dg/pr68306.c
95index 54e5b40f221..0813389e2c1 100644
96--- a/gcc/testsuite/gcc.dg/pr68306.c
97+++ b/gcc/testsuite/gcc.dg/pr68306.c
98@@ -1,6 +1,6 @@
99 /* { dg-do compile } */
100 /* { dg-options "-O3" } */
101-/* { dg-additional-options "-mno-sse -mno-mmx" { target i?86-*-* x86_64-*-* } } */
102+/* { dg-additional-options "-mno-sse -mno-mmx -mfpmath=387" { target i?86-*-* x86_64-*-* } } */
103
104 enum powerpc_pmc_type { PPC_PMC_IBM };
105 struct {
106diff --git a/gcc/testsuite/gcc.dg/pr69634.c b/gcc/testsuite/gcc.dg/pr69634.c
107index 60a56149463..bcc23f9ccd6 100644
108--- a/gcc/testsuite/gcc.dg/pr69634.c
109+++ b/gcc/testsuite/gcc.dg/pr69634.c
110@@ -1,6 +1,6 @@
111 /* { dg-do compile } */
112 /* { dg-options "-O2 -fno-dce -fschedule-insns -fno-tree-vrp -fcompare-debug -Wno-psabi" } */
113-/* { dg-additional-options "-mno-sse" { target i?86-*-* x86_64-*-* } } */
114+/* { dg-additional-options "-mno-sse -mfpmath=387" { target i?86-*-* x86_64-*-* } } */
115 /* { dg-require-effective-target scheduling } */
116
117 typedef unsigned short u16;
118diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-1.c b/gcc/testsuite/gcc.target/i386/amd64-abi-1.c
119index 69fde57bf06..7f1f1c03edf 100644
120--- a/gcc/testsuite/gcc.target/i386/amd64-abi-1.c
121+++ b/gcc/testsuite/gcc.target/i386/amd64-abi-1.c
122@@ -1,5 +1,5 @@
123 /* { dg-do compile { target { ! ia32 } } } */
124-/* { dg-options "-mno-sse" } */
125+/* { dg-options "-mno-sse -mfpmath=387" } */
126 /* { dg-additional-options "-mabi=sysv" { target *-*-mingw* } } */
127
128 double foo(void) { return 0; } /* { dg-error "SSE disabled" } */
129diff --git a/gcc/testsuite/gcc.target/i386/funcspec-6.c b/gcc/testsuite/gcc.target/i386/funcspec-6.c
130index ea896b7ebfd..bf15569b826 100644
131--- a/gcc/testsuite/gcc.target/i386/funcspec-6.c
132+++ b/gcc/testsuite/gcc.target/i386/funcspec-6.c
133@@ -1,6 +1,7 @@
134 /* Test whether all of the 64-bit function specific options are accepted
135 without error. */
136 /* { dg-do compile { target { ! ia32 } } } */
137+/* { dg-additional-options "-mfpmath=387" } */
138
139 #include "funcspec-56.inc"
140
141diff --git a/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c
142index 3fbdc881dda..6b4d9d1252a 100644
143--- a/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c
144+++ b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c
145@@ -1,5 +1,5 @@
146 /* { dg-do compile } */
147-/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mno-iamcu -m80387" } */
148+/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mno-iamcu -m80387 -mfpmath=387" } */
149
150 typedef unsigned int uword_t __attribute__ ((mode (__word__)));
151
152diff --git a/gcc/testsuite/gcc.target/i386/isa-14.c b/gcc/testsuite/gcc.target/i386/isa-14.c
153index 5d49e6e77fe..1de2db92bdd 100644
154--- a/gcc/testsuite/gcc.target/i386/isa-14.c
155+++ b/gcc/testsuite/gcc.target/i386/isa-14.c
156@@ -1,5 +1,5 @@
157 /* { dg-do run } */
158-/* { dg-options "-march=x86-64 -msse4a -mfma4 -mno-sse" } */
159+/* { dg-options "-march=x86-64 -msse4a -mfma4 -mno-sse -mfpmath=387" } */
160
161 extern void abort (void);
162
163diff --git a/gcc/testsuite/gcc.target/i386/pr44948-2b.c b/gcc/testsuite/gcc.target/i386/pr44948-2b.c
164index fa1769b62fb..f79fb12726f 100644
165--- a/gcc/testsuite/gcc.target/i386/pr44948-2b.c
166+++ b/gcc/testsuite/gcc.target/i386/pr44948-2b.c
167@@ -1,5 +1,5 @@
168 /* { dg-do compile } */
169-/* { dg-options "-O -mno-sse -Wno-psabi -mtune=generic" } */
170+/* { dg-options "-O -mno-sse -Wno-psabi -mtune=generic -mfpmath=387" } */
171
172 struct A
173 {
174diff --git a/gcc/testsuite/gcc.target/i386/pr53425-1.c b/gcc/testsuite/gcc.target/i386/pr53425-1.c
175index 2e89ff7d81d..6339bf6b736 100644
176--- a/gcc/testsuite/gcc.target/i386/pr53425-1.c
177+++ b/gcc/testsuite/gcc.target/i386/pr53425-1.c
178@@ -1,6 +1,6 @@
179 /* PR target/53425 */
180 /* { dg-do compile { target { ! ia32 } } } */
181-/* { dg-options "-O2 -mno-sse" } */
182+/* { dg-options "-O2 -mno-sse -mfpmath=387" } */
183 /* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */
184
185 typedef double __v2df __attribute__ ((__vector_size__ (16)));
186diff --git a/gcc/testsuite/gcc.target/i386/pr53425-2.c b/gcc/testsuite/gcc.target/i386/pr53425-2.c
187index 61f6283dbe9..2c5a55f0ac3 100644
188--- a/gcc/testsuite/gcc.target/i386/pr53425-2.c
189+++ b/gcc/testsuite/gcc.target/i386/pr53425-2.c
190@@ -1,6 +1,6 @@
191 /* PR target/53425 */
192 /* { dg-do compile { target { ! ia32 } } } */
193-/* { dg-options "-O2 -mno-sse" } */
194+/* { dg-options "-O2 -mno-sse -mfpmath=387" } */
195 /* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */
196
197 typedef float __v2sf __attribute__ ((__vector_size__ (8)));
198diff --git a/gcc/testsuite/gcc.target/i386/pr55247.c b/gcc/testsuite/gcc.target/i386/pr55247.c
199index 23366d0909d..9810e3abb76 100644
200--- a/gcc/testsuite/gcc.target/i386/pr55247.c
201+++ b/gcc/testsuite/gcc.target/i386/pr55247.c
202@@ -1,6 +1,6 @@
203 /* { dg-do compile { target { ! ia32 } } } */
204 /* { dg-require-effective-target maybe_x32 } */
205-/* { dg-options "-O2 -mno-sse -mno-mmx -mx32 -maddress-mode=long" } */
206+/* { dg-options "-O2 -mno-sse -mno-mmx -mx32 -maddress-mode=long -mfpmath=387" } */
207
208 typedef unsigned int uint32_t;
209 typedef uint32_t Elf32_Word;
210diff --git a/gcc/testsuite/gcc.target/i386/pr59644.c b/gcc/testsuite/gcc.target/i386/pr59644.c
211index 96006b3e338..4287e4538bf 100644
212--- a/gcc/testsuite/gcc.target/i386/pr59644.c
213+++ b/gcc/testsuite/gcc.target/i386/pr59644.c
214@@ -1,6 +1,6 @@
215 /* PR target/59644 */
216 /* { dg-do run { target lp64 } } */
217-/* { dg-options "-O2 -ffreestanding -mno-sse -mpreferred-stack-boundary=3 -maccumulate-outgoing-args -mno-red-zone" } */
218+/* { dg-options "-O2 -ffreestanding -mno-sse -mpreferred-stack-boundary=3 -maccumulate-outgoing-args -mno-red-zone -mfpmath=387" } */
219
220 /* This test uses __builtin_trap () instead of e.g. abort,
221 because due to -mpreferred-stack-boundary=3 it should not call
222diff --git a/gcc/testsuite/gcc.target/i386/pr62120.c b/gcc/testsuite/gcc.target/i386/pr62120.c
223index bfb8c4703eb..ed04cf181f3 100644
224--- a/gcc/testsuite/gcc.target/i386/pr62120.c
225+++ b/gcc/testsuite/gcc.target/i386/pr62120.c
226@@ -1,5 +1,5 @@
227 /* { dg-do compile } */
228-/* { dg-options "-mno-sse" } */
229+/* { dg-options "-mno-sse -mfpmath=387" } */
230
231 void foo ()
232 {
233diff --git a/gcc/testsuite/gcc.target/i386/pr70467-1.c b/gcc/testsuite/gcc.target/i386/pr70467-1.c
234index 4e112c88d07..bcfb396a68d 100644
235--- a/gcc/testsuite/gcc.target/i386/pr70467-1.c
236+++ b/gcc/testsuite/gcc.target/i386/pr70467-1.c
237@@ -1,6 +1,6 @@
238 /* PR rtl-optimization/70467 */
239 /* { dg-do compile } */
240-/* { dg-options "-O2 -mno-sse" } */
241+/* { dg-options "-O2 -mno-sse -mfpmath=387" } */
242
243 void foo (unsigned long long *);
244
245diff --git a/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c b/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c
246index 6cda1534311..26e37f5b8ba 100644
247--- a/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c
248+++ b/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c
249@@ -1,5 +1,5 @@
250 /* { dg-do compile { target { ! ia32 } } } */
251-/* { dg-options "-mno-sse -Wvector-operation-performance" } */
252+/* { dg-options "-mno-sse -Wvector-operation-performance -mfpmath=387" } */
253 #define vector(elcount, type) \
254 __attribute__((vector_size((elcount)*sizeof(type)))) type
255
256--
2572.21.0
258
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0038-Re-introduce-spe-commandline-options.patch b/meta/recipes-devtools/gcc/gcc-8.3/0038-Re-introduce-spe-commandline-options.patch
deleted file mode 100644
index 8de8892b89..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0038-Re-introduce-spe-commandline-options.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From f0bea96434ac478c3cff8c29dd97cccfac5b35e3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 6 Jun 2018 12:10:22 -0700
4Subject: [PATCH 38/40] Re-introduce spe commandline options
5
6This should ensure that we keep accepting
7spe options
8
9Upstream-Status: Inappropriate [SPE port is removed from rs600 port]
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 gcc/config/rs6000/rs6000.opt | 12 ++++++++++++
14 1 file changed, 12 insertions(+)
15
16diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
17index ace8a477550..d6a8f825d88 100644
18--- a/gcc/config/rs6000/rs6000.opt
19+++ b/gcc/config/rs6000/rs6000.opt
20@@ -365,6 +365,18 @@ mdebug=
21 Target RejectNegative Joined
22 -mdebug= Enable debug output.
23
24+mspe
25+Target Var(rs6000_spe) Save
26+Generate SPE SIMD instructions on E500.
27+
28+mabi=spe
29+Target RejectNegative Var(rs6000_spe_abi) Save
30+Use the SPE ABI extensions.
31+
32+mabi=no-spe
33+Target RejectNegative Var(rs6000_spe_abi, 0)
34+Do not use the SPE ABI extensions.
35+
36 mabi=altivec
37 Target RejectNegative Var(rs6000_altivec_abi) Save
38 Use the AltiVec ABI extensions.
39--
402.21.0
41
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0039-riscv-Disable-multilib-for-OE.patch b/meta/recipes-devtools/gcc/gcc-8.3/0039-riscv-Disable-multilib-for-OE.patch
deleted file mode 100644
index f7b222e812..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0039-riscv-Disable-multilib-for-OE.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 24f74444c00c6c9bf076fb002614ebf6dec31f1a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 28 Dec 2018 09:59:53 -0800
4Subject: [PATCH 39/40] riscv: Disable multilib for OE
5
6Upstream-Status: Inappropriate [OE-Specific]
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 gcc/config/riscv/t-linux | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
12
13diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
14index 216d2776a18..e4d817621fc 100644
15--- a/gcc/config/riscv/t-linux
16+++ b/gcc/config/riscv/t-linux
17@@ -1,3 +1,5 @@
18 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
19-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
20-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
21+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
22+MULTILIB_DIRNAMES := . .
23+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
24+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
25--
262.21.0
27
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc-8.3/0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch
deleted file mode 100644
index 9fba163778..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 4bd0a3866f302725cb4eddcaddaeece64900c42f Mon Sep 17 00:00:00 2001
2From: Serhey Popovych <serhe.popovych@gmail.com>
3Date: Tue, 11 Dec 2018 02:30:50 -0500
4Subject: [PATCH 40/40] powerpc/powerpc64: Add support for musl ldso
5
6Upstream-Status: Inappropriate [OE-Specific]
7
8Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
9---
10 gcc/config/rs6000/linux64.h | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
14index 619e113e2b8..ee8b44f9374 100644
15--- a/gcc/config/rs6000/linux64.h
16+++ b/gcc/config/rs6000/linux64.h
17@@ -421,9 +421,9 @@ extern int dot_symbols;
18 #endif
19
20 #define MUSL_DYNAMIC_LINKER32 \
21- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
22+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
23 #define MUSL_DYNAMIC_LINKER64 \
24- "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
25+ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
26
27 #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
28 #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
29--
302.21.0
31
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch b/meta/recipes-devtools/gcc/gcc-8.3/0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch
deleted file mode 100644
index f3303b6858..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch
+++ /dev/null
@@ -1,325 +0,0 @@
1From e1744e11b1c2b36f91a8847b61bafb8c5e7407ae Mon Sep 17 00:00:00 2001
2From: nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Fri, 7 Dec 2018 10:33:30 +0000
4Subject: [PATCH] Add a recursion limit to libiberty's demangling code. The
5 limit is enabled by default, but can be disabled via a new demangling option.
6
7include * demangle.h (DMGL_NO_RECURSE_LIMIT): Define.
8 (DEMANGLE_RECURSION_LIMIT): Define
9
10 PR 87681
11 PR 87675
12 PR 87636
13 PR 87350
14 PR 87335
15libiberty * cp-demangle.h (struct d_info): Add recursion_level field.
16 * cp-demangle.c (d_function_type): Add recursion counter.
17 If the recursion limit is reached and the check is not disabled,
18 then return with a failure result.
19 (cplus_demangle_init_info): Initialise the recursion_level field.
20 (d_demangle_callback): If the recursion limit is enabled, check
21 for a mangled string that is so long that there is not enough
22 stack space for the local arrays.
23 * cplus-dem.c (struct work): Add recursion_level field.
24 (squangle_mop_up): Set the numb and numk fields to zero.
25 (work_stuff_copy_to_from): Handle the case where a btypevec or
26 ktypevec field is NULL.
27 (demangle_nested_args): Add recursion counter. If
28 the recursion limit is not disabled and reached, return with a
29 failure result.
30
31git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266886 138bc75d-0d04-0410-961f-82ee72b054a4
32
33CVE: CVE-2018-18484
34Upstream-Status: Backport [https://github.com/gcc-mirror/gcc/commit/03e51746ed98d9106803f6009ebd71ea670ad3b9]
35Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
36---
37 include/ChangeLog | 5 +++++
38 include/demangle.h | 11 +++++++++++
39 libiberty/ChangeLog | 23 ++++++++++++++++++++++
40 libiberty/cp-demangle.c | 51 ++++++++++++++++++++++++++++++++++++++-----------
41 libiberty/cp-demangle.h | 3 +++
42 libiberty/cplus-dem.c | 37 +++++++++++++++++++++++++++++++++--
43 6 files changed, 117 insertions(+), 13 deletions(-)
44
45diff --git a/include/ChangeLog b/include/ChangeLog
46index 02ab336..88b0648 100644
47--- a/include/ChangeLog
48+++ b/include/ChangeLog
49@@ -2,6 +2,11 @@
50
51 * GCC 8.3.0 released.
52
53+2018-12-07 Nick Clifton <nickc@redhat.com>
54+
55+ * demangle.h (DMGL_NO_RECURSE_LIMIT): Define.
56+ (DEMANGLE_RECURSION_LIMIT): Define
57+
58 2018-07-26 Release Manager
59
60 * GCC 8.2.0 released.
61diff --git a/include/demangle.h b/include/demangle.h
62index b8d57cf..9bb8a19 100644
63--- a/include/demangle.h
64+++ b/include/demangle.h
65@@ -68,6 +68,17 @@ extern "C" {
66 /* If none of these are set, use 'current_demangling_style' as the default. */
67 #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST)
68
69+/* Disable a limit on the depth of recursion in mangled strings.
70+ Note if this limit is disabled then stack exhaustion is possible when
71+ demangling pathologically complicated strings. Bug reports about stack
72+ exhaustion when the option is enabled will be rejected. */
73+#define DMGL_NO_RECURSE_LIMIT (1 << 18)
74+
75+/* If DMGL_NO_RECURSE_LIMIT is not enabled, then this is the value used as
76+ the maximum depth of recursion allowed. It should be enough for any
77+ real-world mangled name. */
78+#define DEMANGLE_RECURSION_LIMIT 1024
79+
80 /* Enumeration of possible demangling styles.
81
82 Lucid and ARM styles are still kept logically distinct, even though
83diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
84index 1dd05da..2f77038 100644
85--- a/libiberty/ChangeLog
86+++ b/libiberty/ChangeLog
87@@ -9,6 +9,29 @@
88 (simple_object_copy_lto_debug_sections): Create file in binary
89 mode.
90
91+2018-12-07 Nick Clifton <nickc@redhat.com>
92+
93+ PR 87681
94+ PR 87675
95+ PR 87636
96+ PR 87350
97+ PR 87335
98+ * cp-demangle.h (struct d_info): Add recursion_level field.
99+ * cp-demangle.c (d_function_type): Add recursion counter.
100+ If the recursion limit is reached and the check is not disabled,
101+ then return with a failure result.
102+ (cplus_demangle_init_info): Initialise the recursion_level field.
103+ (d_demangle_callback): If the recursion limit is enabled, check
104+ for a mangled string that is so long that there is not enough
105+ stack space for the local arrays.
106+ * cplus-dem.c (struct work): Add recursion_level field.
107+ (squangle_mop_up): Set the numb and numk fields to zero.
108+ (work_stuff_copy_to_from): Handle the case where a btypevec or
109+ ktypevec field is NULL.
110+ (demangle_nested_args): Add recursion counter. If
111+ the recursion limit is not disabled and reached, return with a
112+ failure result.
113+
114 2018-07-26 Release Manager
115
116 * GCC 8.2.0 released.
117diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
118index 3f2a097..c374e46 100644
119--- a/libiberty/cp-demangle.c
120+++ b/libiberty/cp-demangle.c
121@@ -2843,21 +2843,35 @@ d_ref_qualifier (struct d_info *di, struct demangle_component *sub)
122 static struct demangle_component *
123 d_function_type (struct d_info *di)
124 {
125- struct demangle_component *ret;
126+ struct demangle_component *ret = NULL;
127
128- if (! d_check_char (di, 'F'))
129- return NULL;
130- if (d_peek_char (di) == 'Y')
131+ if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
132 {
133- /* Function has C linkage. We don't print this information.
134- FIXME: We should print it in verbose mode. */
135- d_advance (di, 1);
136+ if (di->recursion_level > DEMANGLE_RECURSION_LIMIT)
137+ /* FIXME: There ought to be a way to report
138+ that the recursion limit has been reached. */
139+ return NULL;
140+
141+ di->recursion_level ++;
142 }
143- ret = d_bare_function_type (di, 1);
144- ret = d_ref_qualifier (di, ret);
145
146- if (! d_check_char (di, 'E'))
147- return NULL;
148+ if (d_check_char (di, 'F'))
149+ {
150+ if (d_peek_char (di) == 'Y')
151+ {
152+ /* Function has C linkage. We don't print this information.
153+ FIXME: We should print it in verbose mode. */
154+ d_advance (di, 1);
155+ }
156+ ret = d_bare_function_type (di, 1);
157+ ret = d_ref_qualifier (di, ret);
158+
159+ if (! d_check_char (di, 'E'))
160+ ret = NULL;
161+ }
162+
163+ if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
164+ di->recursion_level --;
165 return ret;
166 }
167
168@@ -6188,6 +6202,7 @@ cplus_demangle_init_info (const char *mangled, int options, size_t len,
169 di->expansion = 0;
170 di->is_expression = 0;
171 di->is_conversion = 0;
172+ di->recursion_level = 0;
173 }
174
175 /* Internal implementation for the demangler. If MANGLED is a g++ v3 ABI
176@@ -6227,6 +6242,20 @@ d_demangle_callback (const char *mangled, int options,
177
178 cplus_demangle_init_info (mangled, options, strlen (mangled), &di);
179
180+ /* PR 87675 - Check for a mangled string that is so long
181+ that we do not have enough stack space to demangle it. */
182+ if (((options & DMGL_NO_RECURSE_LIMIT) == 0)
183+ /* This check is a bit arbitrary, since what we really want to do is to
184+ compare the sizes of the di.comps and di.subs arrays against the
185+ amount of stack space remaining. But there is no portable way to do
186+ this, so instead we use the recursion limit as a guide to the maximum
187+ size of the arrays. */
188+ && (unsigned long) di.num_comps > DEMANGLE_RECURSION_LIMIT)
189+ {
190+ /* FIXME: We need a way to indicate that a stack limit has been reached. */
191+ return 0;
192+ }
193+
194 {
195 #ifdef CP_DYNAMIC_ARRAYS
196 __extension__ struct demangle_component comps[di.num_comps];
197diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h
198index 51b8a24..d87a830 100644
199--- a/libiberty/cp-demangle.h
200+++ b/libiberty/cp-demangle.h
201@@ -122,6 +122,9 @@ struct d_info
202 /* Non-zero if we are parsing the type operand of a conversion
203 operator, but not when in an expression. */
204 int is_conversion;
205+ /* If DMGL_NO_RECURSE_LIMIT is not active then this is set to
206+ the current recursion level. */
207+ unsigned int recursion_level;
208 };
209
210 /* To avoid running past the ending '\0', don't:
211diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
212index 6d58bd8..8b9646f 100644
213--- a/libiberty/cplus-dem.c
214+++ b/libiberty/cplus-dem.c
215@@ -146,6 +146,7 @@ struct work_stuff
216 int *proctypevec; /* Indices of currently processed remembered typevecs. */
217 int proctypevec_size;
218 int nproctypes;
219+ unsigned int recursion_level;
220 };
221
222 #define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
223@@ -1292,12 +1293,14 @@ squangle_mop_up (struct work_stuff *work)
224 free ((char *) work -> btypevec);
225 work->btypevec = NULL;
226 work->bsize = 0;
227+ work->numb = 0;
228 }
229 if (work -> ktypevec != NULL)
230 {
231 free ((char *) work -> ktypevec);
232 work->ktypevec = NULL;
233 work->ksize = 0;
234+ work->numk = 0;
235 }
236 }
237
238@@ -1331,8 +1334,15 @@ work_stuff_copy_to_from (struct work_stuff *to, struct work_stuff *from)
239
240 for (i = 0; i < from->numk; i++)
241 {
242- int len = strlen (from->ktypevec[i]) + 1;
243+ int len;
244+
245+ if (from->ktypevec[i] == NULL)
246+ {
247+ to->ktypevec[i] = NULL;
248+ continue;
249+ }
250
251+ len = strlen (from->ktypevec[i]) + 1;
252 to->ktypevec[i] = XNEWVEC (char, len);
253 memcpy (to->ktypevec[i], from->ktypevec[i], len);
254 }
255@@ -1342,8 +1352,15 @@ work_stuff_copy_to_from (struct work_stuff *to, struct work_stuff *from)
256
257 for (i = 0; i < from->numb; i++)
258 {
259- int len = strlen (from->btypevec[i]) + 1;
260+ int len;
261+
262+ if (from->btypevec[i] == NULL)
263+ {
264+ to->btypevec[i] = NULL;
265+ continue;
266+ }
267
268+ len = strlen (from->btypevec[i]) + 1;
269 to->btypevec[i] = XNEWVEC (char , len);
270 memcpy (to->btypevec[i], from->btypevec[i], len);
271 }
272@@ -1401,6 +1418,7 @@ delete_non_B_K_work_stuff (struct work_stuff *work)
273
274 free ((char*) work->tmpl_argvec);
275 work->tmpl_argvec = NULL;
276+ work->ntmpl_args = 0;
277 }
278 if (work->previous_argument)
279 {
280@@ -4477,6 +4495,7 @@ remember_Btype (struct work_stuff *work, const char *start,
281 }
282
283 /* Lose all the info related to B and K type codes. */
284+
285 static void
286 forget_B_and_K_types (struct work_stuff *work)
287 {
288@@ -4502,6 +4521,7 @@ forget_B_and_K_types (struct work_stuff *work)
289 }
290 }
291 }
292+
293 /* Forget the remembered types, but not the type vector itself. */
294
295 static void
296@@ -4696,6 +4716,16 @@ demangle_nested_args (struct work_stuff *work, const char **mangled,
297 int result;
298 int saved_nrepeats;
299
300+ if ((work->options & DMGL_NO_RECURSE_LIMIT) == 0)
301+ {
302+ if (work->recursion_level > DEMANGLE_RECURSION_LIMIT)
303+ /* FIXME: There ought to be a way to report
304+ that the recursion limit has been reached. */
305+ return 0;
306+
307+ work->recursion_level ++;
308+ }
309+
310 /* The G++ name-mangling algorithm does not remember types on nested
311 argument lists, unless -fsquangling is used, and in that case the
312 type vector updated by remember_type is not used. So, we turn
313@@ -4722,6 +4752,9 @@ demangle_nested_args (struct work_stuff *work, const char **mangled,
314 --work->forgetting_types;
315 work->nrepeats = saved_nrepeats;
316
317+ if ((work->options & DMGL_NO_RECURSE_LIMIT) == 0)
318+ --work->recursion_level;
319+
320 return result;
321 }
322
323--
3242.7.4
325
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch b/meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch
deleted file mode 100644
index d9b5d39b77..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch
+++ /dev/null
@@ -1,94 +0,0 @@
1From beb921e1106b5bcbb0c6e2be84b241327e2ffc51 Mon Sep 17 00:00:00 2001
2From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 25 Mar 2019 21:19:09 +0000
4Subject: [PATCH] PR debug/86964 * dwarf2out.c
5 (premark_used_variables): New function. (prune_unused_types_walk): Do
6 not mark not premarked external variables. (prune_unused_types):
7 Call premark_used_variables.
8
9 * gcc.dg/debug/dwarf2/pr86964.c: New testcase.
10
11git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269925 138bc75d-0d04-0410-961f-82ee72b054a4
12
13Upstream-Status: Backport
14Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
15---
16 gcc/ChangeLog | 8 ++++++
17 gcc/dwarf2out.c | 32 +++++++++++++++++++++
18 2 files changed, 40 insertions(+)
19
20diff --git a/gcc/ChangeLog b/gcc/ChangeLog
21index 2075480ca2b..cdce539ac6f 100644
22--- a/gcc/ChangeLog
23+++ b/gcc/ChangeLog
24@@ -1,3 +1,11 @@
25+2019-03-25 Johan Karlsson <johan.karlsson@enea.com>
26+
27+ PR debug/86964
28+ * dwarf2out.c (premark_used_variables): New function.
29+ (prune_unused_types_walk): Do not mark not premarked external
30+ variables.
31+ (prune_unused_types): Call premark_used_variables.
32+
33 2019-02-22 Release Manager
34
35 * GCC 8.3.0 released.
36diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
37index ae8bdee9981..b9a624e1ac7 100644
38--- a/gcc/dwarf2out.c
39+++ b/gcc/dwarf2out.c
40@@ -22658,6 +22658,21 @@ premark_types_used_by_global_vars (void)
41 ->traverse<void *, premark_types_used_by_global_vars_helper> (NULL);
42 }
43
44+/* Mark all variables used by the symtab as perennial. */
45+
46+static void
47+premark_used_variables (void)
48+{
49+ /* Mark DIEs in the symtab as used. */
50+ varpool_node *var;
51+ FOR_EACH_VARIABLE (var)
52+ {
53+ dw_die_ref die = lookup_decl_die (var->decl);
54+ if (die)
55+ die->die_perennial_p = 1;
56+ }
57+}
58+
59 /* Generate a DW_TAG_call_site DIE in function DECL under SUBR_DIE
60 for CA_LOC call arg loc node. */
61
62@@ -29264,6 +29279,19 @@ prune_unused_types_walk (dw_die_ref die)
63
64 return;
65
66+ case DW_TAG_variable:
67+ if (flag_debug_only_used_symbols)
68+ {
69+ if (die->die_perennial_p)
70+ break;
71+
72+ /* premark_used_variables marks external variables --- don't mark
73+ them here. */
74+ if (get_AT (die, DW_AT_external))
75+ return;
76+ }
77+ /* FALLTHROUGH */
78+
79 default:
80 /* Mark everything else. */
81 break;
82@@ -29390,6 +29418,10 @@ prune_unused_types (void)
83 /* Mark types that are used in global variables. */
84 premark_types_used_by_global_vars ();
85
86+ /* Mark variables used in the symtab. */
87+ if (flag_debug_only_used_symbols)
88+ premark_used_variables ();
89+
90 /* Set the mark on nodes that are actually used. */
91 prune_unused_types_walk (comp_unit_die ());
92 for (node = limbo_die_list; node; node = node->next)
93--
942.21.0
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0043-PR85434-Prevent-spilling-of-stack-protector-guard-s-.patch b/meta/recipes-devtools/gcc/gcc-8.3/0043-PR85434-Prevent-spilling-of-stack-protector-guard-s-.patch
deleted file mode 100644
index f15207f581..0000000000
--- a/meta/recipes-devtools/gcc/gcc-8.3/0043-PR85434-Prevent-spilling-of-stack-protector-guard-s-.patch
+++ /dev/null
@@ -1,813 +0,0 @@
1From f98495d90ba66f67fe922a4b9229ea787041c418 Mon Sep 17 00:00:00 2001
2From: thopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Thu, 22 Nov 2018 14:46:17 +0000
4Subject: [PATCH] PR85434: Prevent spilling of stack protector guard's address
5 on ARM
6
7In case of high register pressure in PIC mode, address of the stack
8protector's guard can be spilled on ARM targets as shown in PR85434,
9thus allowing an attacker to control what the canary would be compared
10against. ARM does lack stack_protect_set and stack_protect_test insn
11patterns, defining them does not help as the address is expanded
12regularly and the patterns only deal with the copy and test of the
13guard with the canary.
14
15This problem does not occur for x86 targets because the PIC access and
16the test can be done in the same instruction. Aarch64 is exempt too
17because PIC access insn pattern are mov of UNSPEC which prevents it from
18the second access in the epilogue being CSEd in cse_local pass with the
19first access in the prologue.
20
21The approach followed here is to create new "combined" set and test
22standard pattern names that take the unexpanded guard and do the set or
23test. This allows the target to use an opaque pattern (eg. using UNSPEC)
24to hide the individual instructions being generated to the compiler and
25split the pattern into generic load, compare and branch instruction
26after register allocator, therefore avoiding any spilling. This is here
27implemented for the ARM targets. For targets not implementing these new
28standard pattern names, the existing stack_protect_set and
29stack_protect_test pattern names are used.
30
31To be able to split PIC access after register allocation, the functions
32had to be augmented to force a new PIC register load and to control
33which register it loads into. This is because sharing the PIC register
34between prologue and epilogue could lead to spilling due to CSE again
35which an attacker could use to control what the canary gets compared
36against.
37
382018-11-22 Thomas Preud'homme <thomas.preudhomme@linaro.org>
39
40 gcc/
41 PR target/85434
42 * target-insns.def (stack_protect_combined_set): Define new standard
43 pattern name.
44 (stack_protect_combined_test): Likewise.
45 * cfgexpand.c (stack_protect_prologue): Try new
46 stack_protect_combined_set pattern first.
47 * function.c (stack_protect_epilogue): Try new
48 stack_protect_combined_test pattern first.
49 * config/arm/arm.c (require_pic_register): Add pic_reg and compute_now
50 parameters to control which register to use as PIC register and force
51 reloading PIC register respectively. Insert in the stream of insns if
52 possible.
53 (legitimize_pic_address): Expose above new parameters in prototype and
54 adapt recursive calls accordingly. Use pic_reg if non null instead of
55 cached one.
56 (arm_load_pic_register): Add pic_reg parameter and use it if non null.
57 (arm_legitimize_address): Adapt to new legitimize_pic_address
58 prototype.
59 (thumb_legitimize_address): Likewise.
60 (arm_emit_call_insn): Adapt to require_pic_register prototype change.
61 (arm_expand_prologue): Adapt to arm_load_pic_register prototype change.
62 (thumb1_expand_prologue): Likewise.
63 * config/arm/arm-protos.h (legitimize_pic_address): Adapt to prototype
64 change.
65 (arm_load_pic_register): Likewise.
66 * config/arm/predicated.md (guard_addr_operand): New predicate.
67 (guard_operand): New predicate.
68 * config/arm/arm.md (movsi expander): Adapt to legitimize_pic_address
69 prototype change.
70 (builtin_setjmp_receiver expander): Adapt to thumb1_expand_prologue
71 prototype change.
72 (stack_protect_combined_set): New expander..
73 (stack_protect_combined_set_insn): New insn_and_split pattern.
74 (stack_protect_set_insn): New insn pattern.
75 (stack_protect_combined_test): New expander.
76 (stack_protect_combined_test_insn): New insn_and_split pattern.
77 (arm_stack_protect_test_insn): New insn pattern.
78 * config/arm/thumb1.md (thumb1_stack_protect_test_insn): New insn pattern.
79 * config/arm/unspecs.md (UNSPEC_SP_SET): New unspec.
80 (UNSPEC_SP_TEST): Likewise.
81 * doc/md.texi (stack_protect_combined_set): Document new standard
82 pattern name.
83 (stack_protect_set): Clarify that the operand for guard's address is
84 legal.
85 (stack_protect_combined_test): Document new standard pattern name.
86 (stack_protect_test): Clarify that the operand for guard's address is
87 legal.
88
89
90git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266379 138bc75d-0d04-0410-961f-82ee72b054a4
91
92Upstream-Status: Backport
93CVE: CVE-2018-12886
94Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
95---
96 gcc/ChangeLog | 49 ++++++
97 gcc/cfgexpand.c | 17 +++
98 gcc/config/arm/arm-protos.h | 4 +-
99 gcc/config/arm/arm.c | 87 ++++++++---
100 gcc/config/arm/arm.md | 163 +++++++++++++++++++-
101 gcc/config/arm/predicates.md | 17 +++
102 gcc/config/arm/thumb1.md | 13 ++
103 gcc/config/arm/unspecs.md | 3 +
104 gcc/doc/md.texi | 55 ++++++-
105 gcc/function.c | 32 +++-
106 gcc/target-insns.def | 2 +
107 11 files changed, 399 insertions(+), 43 deletions(-)
108 create mode 100644 gcc/testsuite/gcc.target/arm/pr85434.c
109
110diff --git a/gcc/ChangeLog b/gcc/ChangeLog
111index e2ebfd34214..fa41e7112e0 100644
112--- a/gcc/ChangeLog
113+++ b/gcc/ChangeLog
114@@ -1537,6 +1537,55 @@
115 * config/arm/neon.md (movv4hf, movv8hf): Refactored to..
116 (mov<mov>): ..this and enable unconditionally.
117
118+2018-11-22 Thomas Preud'homme <thomas.preudhomme@linaro.org>
119+
120+ * target-insns.def (stack_protect_combined_set): Define new standard
121+ pattern name.
122+ (stack_protect_combined_test): Likewise.
123+ * cfgexpand.c (stack_protect_prologue): Try new
124+ stack_protect_combined_set pattern first.
125+ * function.c (stack_protect_epilogue): Try new
126+ stack_protect_combined_test pattern first.
127+ * config/arm/arm.c (require_pic_register): Add pic_reg and compute_now
128+ parameters to control which register to use as PIC register and force
129+ reloading PIC register respectively. Insert in the stream of insns if
130+ possible.
131+ (legitimize_pic_address): Expose above new parameters in prototype and
132+ adapt recursive calls accordingly. Use pic_reg if non null instead of
133+ cached one.
134+ (arm_load_pic_register): Add pic_reg parameter and use it if non null.
135+ (arm_legitimize_address): Adapt to new legitimize_pic_address
136+ prototype.
137+ (thumb_legitimize_address): Likewise.
138+ (arm_emit_call_insn): Adapt to require_pic_register prototype change.
139+ (arm_expand_prologue): Adapt to arm_load_pic_register prototype change.
140+ (thumb1_expand_prologue): Likewise.
141+ * config/arm/arm-protos.h (legitimize_pic_address): Adapt to prototype
142+ change.
143+ (arm_load_pic_register): Likewise.
144+ * config/arm/predicated.md (guard_addr_operand): New predicate.
145+ (guard_operand): New predicate.
146+ * config/arm/arm.md (movsi expander): Adapt to legitimize_pic_address
147+ prototype change.
148+ (builtin_setjmp_receiver expander): Adapt to thumb1_expand_prologue
149+ prototype change.
150+ (stack_protect_combined_set): New expander..
151+ (stack_protect_combined_set_insn): New insn_and_split pattern.
152+ (stack_protect_set_insn): New insn pattern.
153+ (stack_protect_combined_test): New expander.
154+ (stack_protect_combined_test_insn): New insn_and_split pattern.
155+ (arm_stack_protect_test_insn): New insn pattern.
156+ * config/arm/thumb1.md (thumb1_stack_protect_test_insn): New insn pattern.
157+ * config/arm/unspecs.md (UNSPEC_SP_SET): New unspec.
158+ (UNSPEC_SP_TEST): Likewise.
159+ * doc/md.texi (stack_protect_combined_set): Document new standard
160+ pattern name.
161+ (stack_protect_set): Clarify that the operand for guard's address is
162+ legal.
163+ (stack_protect_combined_test): Document new standard pattern name.
164+ (stack_protect_test): Clarify that the operand for guard's address is
165+ legal.
166+
167 2018-11-22 Uros Bizjak <ubizjak@gmail.com>
168
169 Backport from mainline
170diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
171index 8fa392fcd8a..21bdcdaeaa3 100644
172--- a/gcc/cfgexpand.c
173+++ b/gcc/cfgexpand.c
174@@ -6185,6 +6185,23 @@ stack_protect_prologue (void)
175 rtx x, y;
176
177 x = expand_normal (crtl->stack_protect_guard);
178+
179+ if (targetm.have_stack_protect_combined_set () && guard_decl)
180+ {
181+ gcc_assert (DECL_P (guard_decl));
182+ y = DECL_RTL (guard_decl);
183+
184+ /* Allow the target to compute address of Y and copy it to X without
185+ leaking Y into a register. This combined address + copy pattern
186+ allows the target to prevent spilling of any intermediate results by
187+ splitting it after register allocator. */
188+ if (rtx_insn *insn = targetm.gen_stack_protect_combined_set (x, y))
189+ {
190+ emit_insn (insn);
191+ return;
192+ }
193+ }
194+
195 if (guard_decl)
196 y = expand_normal (guard_decl);
197 else
198diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
199index 8d6d2395b84..00f5f16ed02 100644
200--- a/gcc/config/arm/arm-protos.h
201+++ b/gcc/config/arm/arm-protos.h
202@@ -28,7 +28,7 @@ extern enum unwind_info_type arm_except_unwind_info (struct gcc_options *);
203 extern int use_return_insn (int, rtx);
204 extern bool use_simple_return_p (void);
205 extern enum reg_class arm_regno_class (int);
206-extern void arm_load_pic_register (unsigned long);
207+extern void arm_load_pic_register (unsigned long, rtx);
208 extern int arm_volatile_func (void);
209 extern void arm_expand_prologue (void);
210 extern void arm_expand_epilogue (bool);
211@@ -69,7 +69,7 @@ extern int const_ok_for_dimode_op (HOST_WIDE_INT, enum rtx_code);
212 extern int arm_split_constant (RTX_CODE, machine_mode, rtx,
213 HOST_WIDE_INT, rtx, rtx, int);
214 extern int legitimate_pic_operand_p (rtx);
215-extern rtx legitimize_pic_address (rtx, machine_mode, rtx);
216+extern rtx legitimize_pic_address (rtx, machine_mode, rtx, rtx, bool);
217 extern rtx legitimize_tls_address (rtx, rtx);
218 extern bool arm_legitimate_address_p (machine_mode, rtx, bool);
219 extern int arm_legitimate_address_outer_p (machine_mode, rtx, RTX_CODE, int);
220diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
221index 8393f0b87f3..12417de5102 100644
222--- a/gcc/config/arm/arm.c
223+++ b/gcc/config/arm/arm.c
224@@ -7379,21 +7379,34 @@ legitimate_pic_operand_p (rtx x)
225 return 1;
226 }
227
228-/* Record that the current function needs a PIC register. Initialize
229- cfun->machine->pic_reg if we have not already done so. */
230+/* Record that the current function needs a PIC register. If PIC_REG is null,
231+ a new pseudo is allocated as PIC register, otherwise PIC_REG is used. In
232+ both case cfun->machine->pic_reg is initialized if we have not already done
233+ so. COMPUTE_NOW decide whether and where to set the PIC register. If true,
234+ PIC register is reloaded in the current position of the instruction stream
235+ irregardless of whether it was loaded before. Otherwise, it is only loaded
236+ if not already done so (crtl->uses_pic_offset_table is null). Note that
237+ nonnull PIC_REG is only supported iff COMPUTE_NOW is true and null PIC_REG
238+ is only supported iff COMPUTE_NOW is false. */
239
240 static void
241-require_pic_register (void)
242+require_pic_register (rtx pic_reg, bool compute_now)
243 {
244+ gcc_assert (compute_now == (pic_reg != NULL_RTX));
245+
246 /* A lot of the logic here is made obscure by the fact that this
247 routine gets called as part of the rtx cost estimation process.
248 We don't want those calls to affect any assumptions about the real
249 function; and further, we can't call entry_of_function() until we
250 start the real expansion process. */
251- if (!crtl->uses_pic_offset_table)
252+ if (!crtl->uses_pic_offset_table || compute_now)
253 {
254- gcc_assert (can_create_pseudo_p ());
255+ gcc_assert (can_create_pseudo_p ()
256+ || (pic_reg != NULL_RTX
257+ && REG_P (pic_reg)
258+ && GET_MODE (pic_reg) == Pmode));
259 if (arm_pic_register != INVALID_REGNUM
260+ && !compute_now
261 && !(TARGET_THUMB1 && arm_pic_register > LAST_LO_REGNUM))
262 {
263 if (!cfun->machine->pic_reg)
264@@ -7409,8 +7422,10 @@ require_pic_register (void)
265 {
266 rtx_insn *seq, *insn;
267
268+ if (pic_reg == NULL_RTX)
269+ pic_reg = gen_reg_rtx (Pmode);
270 if (!cfun->machine->pic_reg)
271- cfun->machine->pic_reg = gen_reg_rtx (Pmode);
272+ cfun->machine->pic_reg = pic_reg;
273
274 /* Play games to avoid marking the function as needing pic
275 if we are being called as part of the cost-estimation
276@@ -7421,11 +7436,12 @@ require_pic_register (void)
277 start_sequence ();
278
279 if (TARGET_THUMB1 && arm_pic_register != INVALID_REGNUM
280- && arm_pic_register > LAST_LO_REGNUM)
281+ && arm_pic_register > LAST_LO_REGNUM
282+ && !compute_now)
283 emit_move_insn (cfun->machine->pic_reg,
284 gen_rtx_REG (Pmode, arm_pic_register));
285 else
286- arm_load_pic_register (0UL);
287+ arm_load_pic_register (0UL, pic_reg);
288
289 seq = get_insns ();
290 end_sequence ();
291@@ -7438,16 +7454,33 @@ require_pic_register (void)
292 we can't yet emit instructions directly in the final
293 insn stream. Queue the insns on the entry edge, they will
294 be committed after everything else is expanded. */
295- insert_insn_on_edge (seq,
296- single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
297+ if (currently_expanding_to_rtl)
298+ insert_insn_on_edge (seq,
299+ single_succ_edge
300+ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
301+ else
302+ emit_insn (seq);
303 }
304 }
305 }
306 }
307
308+/* Legitimize PIC load to ORIG into REG. If REG is NULL, a new pseudo is
309+ created to hold the result of the load. If not NULL, PIC_REG indicates
310+ which register to use as PIC register, otherwise it is decided by register
311+ allocator. COMPUTE_NOW forces the PIC register to be loaded at the current
312+ location in the instruction stream, irregardless of whether it was loaded
313+ previously. Note that nonnull PIC_REG is only supported iff COMPUTE_NOW is
314+ true and null PIC_REG is only supported iff COMPUTE_NOW is false.
315+
316+ Returns the register REG into which the PIC load is performed. */
317+
318 rtx
319-legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
320+legitimize_pic_address (rtx orig, machine_mode mode, rtx reg, rtx pic_reg,
321+ bool compute_now)
322 {
323+ gcc_assert (compute_now == (pic_reg != NULL_RTX));
324+
325 if (GET_CODE (orig) == SYMBOL_REF
326 || GET_CODE (orig) == LABEL_REF)
327 {
328@@ -7480,9 +7513,12 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
329 rtx mem;
330
331 /* If this function doesn't have a pic register, create one now. */
332- require_pic_register ();
333+ require_pic_register (pic_reg, compute_now);
334+
335+ if (pic_reg == NULL_RTX)
336+ pic_reg = cfun->machine->pic_reg;
337
338- pat = gen_calculate_pic_address (reg, cfun->machine->pic_reg, orig);
339+ pat = gen_calculate_pic_address (reg, pic_reg, orig);
340
341 /* Make the MEM as close to a constant as possible. */
342 mem = SET_SRC (pat);
343@@ -7531,9 +7567,11 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
344
345 gcc_assert (GET_CODE (XEXP (orig, 0)) == PLUS);
346
347- base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
348+ base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg,
349+ pic_reg, compute_now);
350 offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
351- base == reg ? 0 : reg);
352+ base == reg ? 0 : reg, pic_reg,
353+ compute_now);
354
355 if (CONST_INT_P (offset))
356 {
357@@ -7633,16 +7671,17 @@ static GTY(()) int pic_labelno;
358 low register. */
359
360 void
361-arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED)
362+arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED, rtx pic_reg)
363 {
364- rtx l1, labelno, pic_tmp, pic_rtx, pic_reg;
365+ rtx l1, labelno, pic_tmp, pic_rtx;
366
367 if (crtl->uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE)
368 return;
369
370 gcc_assert (flag_pic);
371
372- pic_reg = cfun->machine->pic_reg;
373+ if (pic_reg == NULL_RTX)
374+ pic_reg = cfun->machine->pic_reg;
375 if (TARGET_VXWORKS_RTP)
376 {
377 pic_rtx = gen_rtx_SYMBOL_REF (Pmode, VXWORKS_GOTT_BASE);
378@@ -8718,7 +8757,8 @@ arm_legitimize_address (rtx x, rtx orig_x, machine_mode mode)
379 {
380 /* We need to find and carefully transform any SYMBOL and LABEL
381 references; so go back to the original address expression. */
382- rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX);
383+ rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX, NULL_RTX,
384+ false /*compute_now*/);
385
386 if (new_x != orig_x)
387 x = new_x;
388@@ -8786,7 +8826,8 @@ thumb_legitimize_address (rtx x, rtx orig_x, machine_mode mode)
389 {
390 /* We need to find and carefully transform any SYMBOL and LABEL
391 references; so go back to the original address expression. */
392- rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX);
393+ rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX, NULL_RTX,
394+ false /*compute_now*/);
395
396 if (new_x != orig_x)
397 x = new_x;
398@@ -18074,7 +18115,7 @@ arm_emit_call_insn (rtx pat, rtx addr, bool sibcall)
399 ? !targetm.binds_local_p (SYMBOL_REF_DECL (addr))
400 : !SYMBOL_REF_LOCAL_P (addr)))
401 {
402- require_pic_register ();
403+ require_pic_register (NULL_RTX, false /*compute_now*/);
404 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), cfun->machine->pic_reg);
405 }
406
407@@ -22006,7 +22047,7 @@ arm_expand_prologue (void)
408 mask &= THUMB2_WORK_REGS;
409 if (!IS_NESTED (func_type))
410 mask |= (1 << IP_REGNUM);
411- arm_load_pic_register (mask);
412+ arm_load_pic_register (mask, NULL_RTX);
413 }
414
415 /* If we are profiling, make sure no instructions are scheduled before
416@@ -25237,7 +25278,7 @@ thumb1_expand_prologue (void)
417 /* Load the pic register before setting the frame pointer,
418 so we can use r7 as a temporary work register. */
419 if (flag_pic && arm_pic_register != INVALID_REGNUM)
420- arm_load_pic_register (live_regs_mask);
421+ arm_load_pic_register (live_regs_mask, NULL_RTX);
422
423 if (!frame_pointer_needed && CALLER_INTERWORKING_SLOT_SIZE > 0)
424 emit_move_insn (gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM),
425diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
426index c8dc9474b1b..f6196e93168 100644
427--- a/gcc/config/arm/arm.md
428+++ b/gcc/config/arm/arm.md
429@@ -6021,7 +6021,8 @@
430 operands[1] = legitimize_pic_address (operands[1], SImode,
431 (!can_create_pseudo_p ()
432 ? operands[0]
433- : 0));
434+ : NULL_RTX), NULL_RTX,
435+ false /*compute_now*/);
436 }
437 "
438 )
439@@ -6309,7 +6310,7 @@
440 /* r3 is clobbered by set/longjmp, so we can use it as a scratch
441 register. */
442 if (arm_pic_register != INVALID_REGNUM)
443- arm_load_pic_register (1UL << 3);
444+ arm_load_pic_register (1UL << 3, NULL_RTX);
445 DONE;
446 }")
447
448@@ -8634,6 +8635,164 @@
449 (set_attr "conds" "clob")]
450 )
451
452+;; Named patterns for stack smashing protection.
453+(define_expand "stack_protect_combined_set"
454+ [(parallel
455+ [(set (match_operand:SI 0 "memory_operand" "")
456+ (unspec:SI [(match_operand:SI 1 "guard_operand" "")]
457+ UNSPEC_SP_SET))
458+ (clobber (match_scratch:SI 2 ""))
459+ (clobber (match_scratch:SI 3 ""))])]
460+ ""
461+ ""
462+)
463+
464+;; Use a separate insn from the above expand to be able to have the mem outside
465+;; the operand #1 when register allocation comes. This is needed to avoid LRA
466+;; try to reload the guard since we need to control how PIC access is done in
467+;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling
468+;; legitimize_pic_address ()).
469+(define_insn_and_split "*stack_protect_combined_set_insn"
470+ [(set (match_operand:SI 0 "memory_operand" "=m,m")
471+ (unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))]
472+ UNSPEC_SP_SET))
473+ (clobber (match_scratch:SI 2 "=&l,&r"))
474+ (clobber (match_scratch:SI 3 "=&l,&r"))]
475+ ""
476+ "#"
477+ "reload_completed"
478+ [(parallel [(set (match_dup 0) (unspec:SI [(mem:SI (match_dup 2))]
479+ UNSPEC_SP_SET))
480+ (clobber (match_dup 2))])]
481+ "
482+{
483+ if (flag_pic)
484+ {
485+ /* Forces recomputing of GOT base now. */
486+ legitimize_pic_address (operands[1], SImode, operands[2], operands[3],
487+ true /*compute_now*/);
488+ }
489+ else
490+ {
491+ if (address_operand (operands[1], SImode))
492+ operands[2] = operands[1];
493+ else
494+ {
495+ rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
496+ emit_move_insn (operands[2], mem);
497+ }
498+ }
499+}"
500+ [(set_attr "arch" "t1,32")]
501+)
502+
503+(define_insn "*stack_protect_set_insn"
504+ [(set (match_operand:SI 0 "memory_operand" "=m,m")
505+ (unspec:SI [(mem:SI (match_operand:SI 1 "register_operand" "+&l,&r"))]
506+ UNSPEC_SP_SET))
507+ (clobber (match_dup 1))]
508+ ""
509+ "@
510+ ldr\\t%1, [%1]\;str\\t%1, %0\;movs\t%1,#0
511+ ldr\\t%1, [%1]\;str\\t%1, %0\;mov\t%1,#0"
512+ [(set_attr "length" "8,12")
513+ (set_attr "conds" "clob,nocond")
514+ (set_attr "type" "multiple")
515+ (set_attr "arch" "t1,32")]
516+)
517+
518+(define_expand "stack_protect_combined_test"
519+ [(parallel
520+ [(set (pc)
521+ (if_then_else
522+ (eq (match_operand:SI 0 "memory_operand" "")
523+ (unspec:SI [(match_operand:SI 1 "guard_operand" "")]
524+ UNSPEC_SP_TEST))
525+ (label_ref (match_operand 2))
526+ (pc)))
527+ (clobber (match_scratch:SI 3 ""))
528+ (clobber (match_scratch:SI 4 ""))
529+ (clobber (reg:CC CC_REGNUM))])]
530+ ""
531+ ""
532+)
533+
534+;; Use a separate insn from the above expand to be able to have the mem outside
535+;; the operand #1 when register allocation comes. This is needed to avoid LRA
536+;; try to reload the guard since we need to control how PIC access is done in
537+;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling
538+;; legitimize_pic_address ()).
539+(define_insn_and_split "*stack_protect_combined_test_insn"
540+ [(set (pc)
541+ (if_then_else
542+ (eq (match_operand:SI 0 "memory_operand" "m,m")
543+ (unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))]
544+ UNSPEC_SP_TEST))
545+ (label_ref (match_operand 2))
546+ (pc)))
547+ (clobber (match_scratch:SI 3 "=&l,&r"))
548+ (clobber (match_scratch:SI 4 "=&l,&r"))
549+ (clobber (reg:CC CC_REGNUM))]
550+ ""
551+ "#"
552+ "reload_completed"
553+ [(const_int 0)]
554+{
555+ rtx eq;
556+
557+ if (flag_pic)
558+ {
559+ /* Forces recomputing of GOT base now. */
560+ legitimize_pic_address (operands[1], SImode, operands[3], operands[4],
561+ true /*compute_now*/);
562+ }
563+ else
564+ {
565+ if (address_operand (operands[1], SImode))
566+ operands[3] = operands[1];
567+ else
568+ {
569+ rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
570+ emit_move_insn (operands[3], mem);
571+ }
572+ }
573+ if (TARGET_32BIT)
574+ {
575+ emit_insn (gen_arm_stack_protect_test_insn (operands[4], operands[0],
576+ operands[3]));
577+ rtx cc_reg = gen_rtx_REG (CC_Zmode, CC_REGNUM);
578+ eq = gen_rtx_EQ (CC_Zmode, cc_reg, const0_rtx);
579+ emit_jump_insn (gen_arm_cond_branch (operands[2], eq, cc_reg));
580+ }
581+ else
582+ {
583+ emit_insn (gen_thumb1_stack_protect_test_insn (operands[4], operands[0],
584+ operands[3]));
585+ eq = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
586+ emit_jump_insn (gen_cbranchsi4 (eq, operands[4], const0_rtx,
587+ operands[2]));
588+ }
589+ DONE;
590+}
591+ [(set_attr "arch" "t1,32")]
592+)
593+
594+(define_insn "arm_stack_protect_test_insn"
595+ [(set (reg:CC_Z CC_REGNUM)
596+ (compare:CC_Z (unspec:SI [(match_operand:SI 1 "memory_operand" "m,m")
597+ (mem:SI (match_operand:SI 2 "register_operand" "+l,r"))]
598+ UNSPEC_SP_TEST)
599+ (const_int 0)))
600+ (clobber (match_operand:SI 0 "register_operand" "=&l,&r"))
601+ (clobber (match_dup 2))]
602+ "TARGET_32BIT"
603+ "ldr\t%0, [%2]\;ldr\t%2, %1\;eors\t%0, %2, %0"
604+ [(set_attr "length" "8,12")
605+ (set_attr "conds" "set")
606+ (set_attr "type" "multiple")
607+ (set_attr "arch" "t,32")]
608+)
609+
610 (define_expand "casesi"
611 [(match_operand:SI 0 "s_register_operand" "") ; index to jump on
612 (match_operand:SI 1 "const_int_operand" "") ; lower bound
613diff --git a/gcc/config/arm/predicates.md b/gcc/config/arm/predicates.md
614index 7e198f9bce4..69718ee9c7a 100644
615--- a/gcc/config/arm/predicates.md
616+++ b/gcc/config/arm/predicates.md
617@@ -31,6 +31,23 @@
618 || REGNO_REG_CLASS (REGNO (op)) != NO_REGS));
619 })
620
621+; Predicate for stack protector guard's address in
622+; stack_protect_combined_set_insn and stack_protect_combined_test_insn patterns
623+(define_predicate "guard_addr_operand"
624+ (match_test "true")
625+{
626+ return (CONSTANT_ADDRESS_P (op)
627+ || !targetm.cannot_force_const_mem (mode, op));
628+})
629+
630+; Predicate for stack protector guard in stack_protect_combined_set and
631+; stack_protect_combined_test patterns
632+(define_predicate "guard_operand"
633+ (match_code "mem")
634+{
635+ return guard_addr_operand (XEXP (op, 0), mode);
636+})
637+
638 (define_predicate "imm_for_neon_inv_logic_operand"
639 (match_code "const_vector")
640 {
641diff --git a/gcc/config/arm/thumb1.md b/gcc/config/arm/thumb1.md
642index 19dcdbcdd73..cd199c9c529 100644
643--- a/gcc/config/arm/thumb1.md
644+++ b/gcc/config/arm/thumb1.md
645@@ -1962,4 +1962,17 @@
646 }"
647 [(set_attr "type" "mov_reg")]
648 )
649+
650+(define_insn "thumb1_stack_protect_test_insn"
651+ [(set (match_operand:SI 0 "register_operand" "=&l")
652+ (unspec:SI [(match_operand:SI 1 "memory_operand" "m")
653+ (mem:SI (match_operand:SI 2 "register_operand" "+l"))]
654+ UNSPEC_SP_TEST))
655+ (clobber (match_dup 2))]
656+ "TARGET_THUMB1"
657+ "ldr\t%0, [%2]\;ldr\t%2, %1\;eors\t%0, %2, %0"
658+ [(set_attr "length" "8")
659+ (set_attr "conds" "set")
660+ (set_attr "type" "multiple")]
661+)
662
663diff --git a/gcc/config/arm/unspecs.md b/gcc/config/arm/unspecs.md
664index 19416736ef9..8f9dbcb08dc 100644
665--- a/gcc/config/arm/unspecs.md
666+++ b/gcc/config/arm/unspecs.md
667@@ -86,6 +86,9 @@
668 UNSPEC_PROBE_STACK ; Probe stack memory reference
669 UNSPEC_NONSECURE_MEM ; Represent non-secure memory in ARMv8-M with
670 ; security extension
671+ UNSPEC_SP_SET ; Represent the setting of stack protector's canary
672+ UNSPEC_SP_TEST ; Represent the testing of stack protector's canary
673+ ; against the guard.
674 ])
675
676 (define_c_enum "unspec" [
677diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
678index 295fc1f1143..895309b2f3c 100644
679--- a/gcc/doc/md.texi
680+++ b/gcc/doc/md.texi
681@@ -7450,22 +7450,61 @@ builtins.
682 The get/set patterns have a single output/input operand respectively,
683 with @var{mode} intended to be @code{Pmode}.
684
685+@cindex @code{stack_protect_combined_set} instruction pattern
686+@item @samp{stack_protect_combined_set}
687+This pattern, if defined, moves a @code{ptr_mode} value from an address
688+whose declaration RTX is given in operand 1 to the memory in operand 0
689+without leaving the value in a register afterward. If several
690+instructions are needed by the target to perform the operation (eg. to
691+load the address from a GOT entry then load the @code{ptr_mode} value
692+and finally store it), it is the backend's responsibility to ensure no
693+intermediate result gets spilled. This is to avoid leaking the value
694+some place that an attacker might use to rewrite the stack guard slot
695+after having clobbered it.
696+
697+If this pattern is not defined, then the address declaration is
698+expanded first in the standard way and a @code{stack_protect_set}
699+pattern is then generated to move the value from that address to the
700+address in operand 0.
701+
702 @cindex @code{stack_protect_set} instruction pattern
703 @item @samp{stack_protect_set}
704-This pattern, if defined, moves a @code{ptr_mode} value from the memory
705-in operand 1 to the memory in operand 0 without leaving the value in
706-a register afterward. This is to avoid leaking the value some place
707-that an attacker might use to rewrite the stack guard slot after
708-having clobbered it.
709+This pattern, if defined, moves a @code{ptr_mode} value from the valid
710+memory location in operand 1 to the memory in operand 0 without leaving
711+the value in a register afterward. This is to avoid leaking the value
712+some place that an attacker might use to rewrite the stack guard slot
713+after having clobbered it.
714+
715+Note: on targets where the addressing modes do not allow to load
716+directly from stack guard address, the address is expanded in a standard
717+way first which could cause some spills.
718
719 If this pattern is not defined, then a plain move pattern is generated.
720
721+@cindex @code{stack_protect_combined_test} instruction pattern
722+@item @samp{stack_protect_combined_test}
723+This pattern, if defined, compares a @code{ptr_mode} value from an
724+address whose declaration RTX is given in operand 1 with the memory in
725+operand 0 without leaving the value in a register afterward and
726+branches to operand 2 if the values were equal. If several
727+instructions are needed by the target to perform the operation (eg. to
728+load the address from a GOT entry then load the @code{ptr_mode} value
729+and finally store it), it is the backend's responsibility to ensure no
730+intermediate result gets spilled. This is to avoid leaking the value
731+some place that an attacker might use to rewrite the stack guard slot
732+after having clobbered it.
733+
734+If this pattern is not defined, then the address declaration is
735+expanded first in the standard way and a @code{stack_protect_test}
736+pattern is then generated to compare the value from that address to the
737+value at the memory in operand 0.
738+
739 @cindex @code{stack_protect_test} instruction pattern
740 @item @samp{stack_protect_test}
741 This pattern, if defined, compares a @code{ptr_mode} value from the
742-memory in operand 1 with the memory in operand 0 without leaving the
743-value in a register afterward and branches to operand 2 if the values
744-were equal.
745+valid memory location in operand 1 with the memory in operand 0 without
746+leaving the value in a register afterward and branches to operand 2 if
747+the values were equal.
748
749 If this pattern is not defined, then a plain compare pattern and
750 conditional branch pattern is used.
751diff --git a/gcc/function.c b/gcc/function.c
752index 85a5d9f43f7..69523c1d723 100644
753--- a/gcc/function.c
754+++ b/gcc/function.c
755@@ -4937,18 +4937,34 @@ stack_protect_epilogue (void)
756 tree guard_decl = targetm.stack_protect_guard ();
757 rtx_code_label *label = gen_label_rtx ();
758 rtx x, y;
759- rtx_insn *seq;
760+ rtx_insn *seq = NULL;
761
762 x = expand_normal (crtl->stack_protect_guard);
763- if (guard_decl)
764- y = expand_normal (guard_decl);
765+
766+ if (targetm.have_stack_protect_combined_test () && guard_decl)
767+ {
768+ gcc_assert (DECL_P (guard_decl));
769+ y = DECL_RTL (guard_decl);
770+ /* Allow the target to compute address of Y and compare it with X without
771+ leaking Y into a register. This combined address + compare pattern
772+ allows the target to prevent spilling of any intermediate results by
773+ splitting it after register allocator. */
774+ seq = targetm.gen_stack_protect_combined_test (x, y, label);
775+ }
776 else
777- y = const0_rtx;
778+ {
779+ if (guard_decl)
780+ y = expand_normal (guard_decl);
781+ else
782+ y = const0_rtx;
783+
784+ /* Allow the target to compare Y with X without leaking either into
785+ a register. */
786+ if (targetm.have_stack_protect_test ())
787+ seq = targetm.gen_stack_protect_test (x, y, label);
788+ }
789
790- /* Allow the target to compare Y with X without leaking either into
791- a register. */
792- if (targetm.have_stack_protect_test ()
793- && ((seq = targetm.gen_stack_protect_test (x, y, label)) != NULL_RTX))
794+ if (seq)
795 emit_insn (seq);
796 else
797 emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
798diff --git a/gcc/target-insns.def b/gcc/target-insns.def
799index 9a552c3d11c..d39889b3522 100644
800--- a/gcc/target-insns.def
801+++ b/gcc/target-insns.def
802@@ -96,7 +96,9 @@ DEF_TARGET_INSN (sibcall_value, (rtx x0, rtx x1, rtx opt2, rtx opt3,
803 DEF_TARGET_INSN (simple_return, (void))
804 DEF_TARGET_INSN (split_stack_prologue, (void))
805 DEF_TARGET_INSN (split_stack_space_check, (rtx x0, rtx x1))
806+DEF_TARGET_INSN (stack_protect_combined_set, (rtx x0, rtx x1))
807 DEF_TARGET_INSN (stack_protect_set, (rtx x0, rtx x1))
808+DEF_TARGET_INSN (stack_protect_combined_test, (rtx x0, rtx x1, rtx x2))
809 DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2))
810 DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2))
811 DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1))
812--
8132.21.0
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_8.3.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_8.3.bb
deleted file mode 100644
index bf53c5cd78..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian_8.3.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_8.3.bb b/meta/recipes-devtools/gcc/gcc-cross_8.3.bb
deleted file mode 100644
index b43cca0c52..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross_8.3.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_8.3.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_8.3.bb
deleted file mode 100644
index 40a6c4feff..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk_8.3.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_8.3.bb b/meta/recipes-devtools/gcc/gcc-runtime_8.3.bb
deleted file mode 100644
index dd430b57eb..0000000000
--- a/meta/recipes-devtools/gcc/gcc-runtime_8.3.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-runtime.inc
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_8.3.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_8.3.bb
deleted file mode 100644
index f3c7058114..0000000000
--- a/meta/recipes-devtools/gcc/gcc-sanitizers_8.3.bb
+++ /dev/null
@@ -1,7 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-sanitizers.inc
3
4# Building with thumb enabled on armv4t armv5t fails with
5# sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
6ARM_INSTRUCTION_SET_armv4 = "arm"
7ARM_INSTRUCTION_SET_armv5 = "arm"
diff --git a/meta/recipes-devtools/gcc/gcc-source_8.3.bb b/meta/recipes-devtools/gcc/gcc-source_8.3.bb
deleted file mode 100644
index b890fa33ea..0000000000
--- a/meta/recipes-devtools/gcc/gcc-source_8.3.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_8.3.bb b/meta/recipes-devtools/gcc/gcc_8.3.bb
deleted file mode 100644
index 7d93590588..0000000000
--- a/meta/recipes-devtools/gcc/gcc_8.3.bb
+++ /dev/null
@@ -1,14 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-target.inc
3
4# Building with thumb enabled on armv4t armv5t 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"
8ARM_INSTRUCTION_SET_armv5 = "arm"
9
10ARMFPARCHEXT_armv6 = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
11ARMFPARCHEXT_armv7a = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
12ARMFPARCHEXT_armv7ve = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
13
14BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-devtools/gcc/libgcc-initial_8.3.bb b/meta/recipes-devtools/gcc/libgcc-initial_8.3.bb
deleted file mode 100644
index 0c698c26ec..0000000000
--- a/meta/recipes-devtools/gcc/libgcc-initial_8.3.bb
+++ /dev/null
@@ -1,5 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc-initial.inc
3
4# Building with thumb enabled on armv6t fails
5ARM_INSTRUCTION_SET_armv6 = "arm"
diff --git a/meta/recipes-devtools/gcc/libgcc_8.3.bb b/meta/recipes-devtools/gcc/libgcc_8.3.bb
deleted file mode 100644
index ea210a1130..0000000000
--- a/meta/recipes-devtools/gcc/libgcc_8.3.bb
+++ /dev/null
@@ -1,5 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc
3
4# Building with thumb enabled on armv6t fails
5ARM_INSTRUCTION_SET_armv6 = "arm"
diff --git a/meta/recipes-devtools/gcc/libgfortran_8.3.bb b/meta/recipes-devtools/gcc/libgfortran_8.3.bb
deleted file mode 100644
index 71dd8b4bdc..0000000000
--- a/meta/recipes-devtools/gcc/libgfortran_8.3.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgfortran.inc
3