summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-10.1
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-10.1')
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0002-gcc-poison-system-directories.patch200
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch70
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0004-64-bit-multilib-hack.patch116
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0005-optional-libstdc.patch122
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0006-COLLECT_GCC_OPTIONS.patch35
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch92
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0008-fortran-cross-compile-hack.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0009-cpp-honor-sysroot.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0010-MIPS64-Default-to-N64-ABI.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch243
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0012-gcc-Fix-argument-list-too-long-error.patch37
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0013-Disable-sdt.patch110
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0014-libtool.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch99
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0018-export-CPP.patch50
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0019-Ensure-target-gcc-headers-can-be-included.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch35
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch26
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0022-aarch64-Add-support-for-musl-ldso.patch25
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0024-handle-sysroot-support-for-nativesdk-gcc.patch346
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch99
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0026-Fix-various-_FOR_BUILD-and-related-variables.patch134
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch25
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch84
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch26
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0030-sync-gcc-stddef.h-with-musl.patch88
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0031-fix-segmentation-fault-in-precompiled-header-generat.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0032-Fix-for-testsuite-failure.patch255
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0033-Re-introduce-spe-commandline-options.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch83
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch182
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0036-Enable-CET-in-cross-compiler-if-possible.patch150
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/0037-mingw32-Enable-operation_not_supported.patch26
37 files changed, 3255 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-10.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..82ae9f8d14
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,39 @@
1From f2a5dc3bc7e5727d6bf77e1c6e8a31a6f000883d 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] 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 4cc938ebb7d..226a64939d1 100755
16--- a/configure
17+++ b/configure
18@@ -7722,7 +7722,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 c78d9cbea62..f024f4bac9b 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -3227,7 +3227,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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0002-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-10.1/0002-gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..30a8486016
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0002-gcc-poison-system-directories.patch
@@ -0,0 +1,200 @@
1From 74cc21f474402cf3578e37e1d7a1a22bbd070f6a 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] 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 65a82410abc..415f38fa1f4 100644
30--- a/gcc/common.opt
31+++ b/gcc/common.opt
32@@ -682,6 +682,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 809e7b26823..5adeaeed36b 100644
45--- a/gcc/config.in
46+++ b/gcc/config.in
47@@ -224,6 +224,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 cd3d9516fce..8de766a942c 100755
62--- a/gcc/configure
63+++ b/gcc/configure
64@@ -1010,6 +1010,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@@ -1766,6 +1767,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@@ -30235,6 +30238,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 0de3b4bf97b..8bfd6feb780 100644
103--- a/gcc/configure.ac
104+++ b/gcc/configure.ac
105@@ -6595,6 +6595,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 f98161391a0..f12d8d12150 100644
124--- a/gcc/doc/invoke.texi
125+++ b/gcc/doc/invoke.texi
126@@ -348,6 +348,7 @@ Objective-C and Objective-C++ Dialects}.
127 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
128 -Wparentheses -Wno-pedantic-ms-format @gol
129 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
130+-Wno-poison-system-directories @gol
131 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
132 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
133 -Wno-scalar-storage-order -Wsequence-point @gol
134@@ -6924,6 +6925,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 9f790db0daf..b2200c5185a 100644
151--- a/gcc/gcc.c
152+++ b/gcc/gcc.c
153@@ -1041,6 +1041,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:%{!r:%{!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 "" \
161 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
162diff --git a/gcc/incpath.c b/gcc/incpath.c
163index 8a2bda00f80..9098ab044ab 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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-10.1/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..27237feb5a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,70 @@
1From 6e3395c0bc933bdc3242d1dead4896d0aa4e11a8 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] 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 226a64939d1..b31dc137fc9 100755
30--- a/configure
31+++ b/configure
32@@ -6971,6 +6971,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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0004-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc-10.1/0004-64-bit-multilib-hack.patch
new file mode 100644
index 0000000000..7c751bef65
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0004-64-bit-multilib-hack.patch
@@ -0,0 +1,116 @@
1From 85a7c5aeb82ed61e6ef6d8e061b9da9e6a4a652c 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] 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
22Do same for riscv64 and aarch64
23
24RP 15/8/11
25
26Upstream-Status: Inappropriate[OE-Specific]
27
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
30Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
31---
32 gcc/config/aarch64/t-aarch64-linux | 8 ++++----
33 gcc/config/i386/t-linux64 | 6 ++----
34 gcc/config/mips/t-linux64 | 10 +++-------
35 gcc/config/riscv/t-linux | 6 ++++--
36 gcc/config/rs6000/t-linux64 | 5 ++---
37 5 files changed, 15 insertions(+), 20 deletions(-)
38
39diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
40index 83e59e33b85..b1356be1fb4 100644
41--- a/gcc/config/aarch64/t-aarch64-linux
42+++ b/gcc/config/aarch64/t-aarch64-linux
43@@ -21,8 +21,8 @@
44 LIB1ASMSRC = aarch64/lib1funcs.asm
45 LIB1ASMFUNCS = _aarch64_sync_cache_range
46
47-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
48-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
49-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
50+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
51+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
52+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
53
54-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
55+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
56diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
57index 1171e218578..5e057b7e5db 100644
58--- a/gcc/config/i386/t-linux64
59+++ b/gcc/config/i386/t-linux64
60@@ -32,7 +32,5 @@
61 #
62 comma=,
63 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
64-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
65-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
66-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
67-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
68+MULTILIB_DIRNAMES = . .
69+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
70diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
71index ceb58d3b5f3..43fe2bf28ab 100644
72--- a/gcc/config/mips/t-linux64
73+++ b/gcc/config/mips/t-linux64
74@@ -17,10 +17,6 @@
75 # <http://www.gnu.org/licenses/>.
76
77 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
78-MULTILIB_DIRNAMES = n32 32 64
79-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
80-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
81-MULTILIB_OSDIRNAMES = \
82- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
83- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
84- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
85+MULTILIB_DIRNAMES = . . .
86+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
87+
88diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
89index 216d2776a18..e4d817621fc 100644
90--- a/gcc/config/riscv/t-linux
91+++ b/gcc/config/riscv/t-linux
92@@ -1,3 +1,5 @@
93 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
94-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
95-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
96+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
97+MULTILIB_DIRNAMES := . .
98+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
99+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
100diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
101index 264a7e27524..dc9d440f66b 100644
102--- a/gcc/config/rs6000/t-linux64
103+++ b/gcc/config/rs6000/t-linux64
104@@ -26,10 +26,9 @@
105 # MULTILIB_OSDIRNAMES according to what is found on the target.
106
107 MULTILIB_OPTIONS := m64/m32
108-MULTILIB_DIRNAMES := 64 32
109+MULTILIB_DIRNAMES := . .
110 MULTILIB_EXTRA_OPTS :=
111-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
112-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
113+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
114
115 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
116 $(COMPILE) $<
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0005-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc-10.1/0005-optional-libstdc.patch
new file mode 100644
index 0000000000..4020c9e3cf
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0005-optional-libstdc.patch
@@ -0,0 +1,122 @@
1From 6ddfb0bfcd1eea71acd37ab06f7a4510b9f1d12b 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] 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 c49da99d395..35f712e2c84 100644
29--- a/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt
31@@ -2025,6 +2025,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 0ab63bcd211..7b081e9e4f0 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 f12d8d12150..cf6cb428e7d 100644
56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi
58@@ -230,6 +230,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-tag -Wcatch-value -Wcatch-value=@var{n} @gol
67 -Wno-class-conversion -Wclass-memaccess @gol
68@@ -599,7 +602,7 @@ Objective-C and Objective-C++ Dialects}.
69 -pie -pthread -r -rdynamic @gol
70 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
71 -static-libasan -static-libtsan -static-liblsan -static-libubsan @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@@ -14407,6 +14410,33 @@ Specify that the program entry point is @var{entry}. The argument is
78 interpreted by the linker; the GNU linker accepts either a symbol name
79 or an address.
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 b2200c5185a..f8be58ce0a6 100644
113--- a/gcc/gcc.c
114+++ b/gcc/gcc.c
115@@ -1051,6 +1051,7 @@ proper position among the other output files. */
116 %(mflib) " STACK_SPLIT_SPEC "\
117 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
118 %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\
119+ %{!nostdlib++:}\
120 %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}"
121 #endif
122
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0006-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-10.1/0006-COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000000..9fbbe80703
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0006-COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,35 @@
1From a6c90d3a9c5010b4aa7cc30467cf81ca7e0f430e 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] 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 f8be58ce0a6..48b0f9dde81 100644
18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c
20@@ -4806,6 +4806,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;
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-10.1/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
new file mode 100644
index 0000000000..a764bdd0f4
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,92 @@
1From 5670d4489f119d2da661734895ac0be99b606d1b 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] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}
5
6Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
7the source can be shared between gcc-cross-initial,
8gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Upstream-Status: Pending
13
14While compiling gcc-crosssdk-initial-x86_64 on some host, there is
15occasionally failure that test the existance of default.h doesn't
16work, the reason is tm_include_list='** defaults.h' rather than
17tm_include_list='** ./defaults.h'
18
19So we add the test condition for this situation.
20Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
21---
22 gcc/Makefile.in | 2 +-
23 gcc/configure | 4 ++--
24 gcc/configure.ac | 4 ++--
25 gcc/mkconfig.sh | 4 ++--
26 4 files changed, 7 insertions(+), 7 deletions(-)
27
28diff --git a/gcc/Makefile.in b/gcc/Makefile.in
29index 543b477ff18..a67d2cc18d6 100644
30--- a/gcc/Makefile.in
31+++ b/gcc/Makefile.in
32@@ -540,7 +540,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
33 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
34
35 xmake_file=@xmake_file@
36-tmake_file=@tmake_file@
37+tmake_file=@tmake_file@ ./t-oe
38 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
39 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
40 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
41diff --git a/gcc/configure b/gcc/configure
42index 8de766a942c..b26e8fc7fee 100755
43--- a/gcc/configure
44+++ b/gcc/configure
45@@ -12705,8 +12705,8 @@ for f in $tm_file; do
46 tm_include_list="${tm_include_list} $f"
47 ;;
48 defaults.h )
49- tm_file_list="${tm_file_list} \$(srcdir)/$f"
50- tm_include_list="${tm_include_list} $f"
51+ tm_file_list="${tm_file_list} ./$f"
52+ tm_include_list="${tm_include_list} ./$f"
53 ;;
54 * )
55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
56diff --git a/gcc/configure.ac b/gcc/configure.ac
57index 8bfd6feb780..26fa46802c7 100644
58--- a/gcc/configure.ac
59+++ b/gcc/configure.ac
60@@ -2138,8 +2138,8 @@ for f in $tm_file; do
61 tm_include_list="${tm_include_list} $f"
62 ;;
63 defaults.h )
64- tm_file_list="${tm_file_list} \$(srcdir)/$f"
65- tm_include_list="${tm_include_list} $f"
66+ tm_file_list="${tm_file_list} ./$f"
67+ tm_include_list="${tm_include_list} ./$f"
68 ;;
69 * )
70 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
71diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
72index d2c677a4a42..d03852481cb 100644
73--- a/gcc/mkconfig.sh
74+++ b/gcc/mkconfig.sh
75@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
76 if [ $# -ge 1 ]; then
77 echo '#ifdef IN_GCC' >> ${output}T
78 for file in "$@"; do
79- if test x"$file" = x"defaults.h"; then
80+ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
81 postpone_defaults_h="yes"
82 else
83 echo "# include \"$file\"" >> ${output}T
84@@ -106,7 +106,7 @@ esac
85
86 # If we postponed including defaults.h, add the #include now.
87 if test x"$postpone_defaults_h" = x"yes"; then
88- echo "# include \"defaults.h\"" >> ${output}T
89+ echo "# include \"./defaults.h\"" >> ${output}T
90 fi
91
92 # Add multiple inclusion protection guard, part two.
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0008-fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-10.1/0008-fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..714db3bef5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0008-fortran-cross-compile-hack.patch
@@ -0,0 +1,43 @@
1From f05062625e7a4751be723595a2f7a4b7fbeff311 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] 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 b4cf854ddb3..e8e0ac3b1cf 100755
20--- a/libgfortran/configure
21+++ b/libgfortran/configure
22@@ -13090,7 +13090,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 711dc60ff78..3c9bbfbf47d 100644
33--- a/libgfortran/configure.ac
34+++ b/libgfortran/configure.ac
35@@ -258,7 +258,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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0009-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-10.1/0009-cpp-honor-sysroot.patch
new file mode 100644
index 0000000000..8ad6853d81
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0009-cpp-honor-sysroot.patch
@@ -0,0 +1,51 @@
1From 1d76de7f1f5c99f1fa1a4b14aedad3d702e4e136 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] 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 0ad4a33b93e..16c744f4f90 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -66,5 +66,5 @@ along with GCC; see the file COPYING3. If not see
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!E:%{!M:%{!MM:"
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 48b0f9dde81..c87f603955f 100644
41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c
43@@ -1348,7 +1348,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},
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0010-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc-10.1/0010-MIPS64-Default-to-N64-ABI.patch
new file mode 100644
index 0000000000..625e2d8709
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0010-MIPS64-Default-to-N64-ABI.patch
@@ -0,0 +1,54 @@
1From 4fad4433c96bc9d0d9d124f9674fb3389f6f426e 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] 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 cf1a87e2efd..37c4221a39f 100644
18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc
20@@ -2511,29 +2511,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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc-10.1/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
new file mode 100644
index 0000000000..e357976330
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,243 @@
1From 8fc016a53c22c19feccbfa13ebdf19090dc67058 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] 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 | 15 +++++----------
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, 29 insertions(+), 34 deletions(-)
32
33diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
34index e25fcac3c59..01aca0c6542 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 5bdcfa0c5d3..0c0332f317f 100644
50--- a/gcc/config/arm/linux-eabi.h
51+++ b/gcc/config/arm/linux-eabi.h
52@@ -65,8 +65,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 0ec3aa53189..abfa9566d74 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 9f823f125ed..e0390b7d5e3 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 6cb68d1ccfa..7de09ec857c 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 95654bcdb5a..0c1a8118a26 100644
108--- a/gcc/config/linux.h
109+++ b/gcc/config/linux.h
110@@ -94,10 +94,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 54446e58e5f..4786ee304c1 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 4afef7c228c..01997330741 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 34776c8421e..967c1c43c63 100644
171--- a/gcc/config/rs6000/linux64.h
172+++ b/gcc/config/rs6000/linux64.h
173@@ -419,24 +419,19 @@ 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 #undef MUSL_DYNAMIC_LINKER32
193 #define MUSL_DYNAMIC_LINKER32 \
194- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
195+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
196 #undef MUSL_DYNAMIC_LINKER64
197 #define MUSL_DYNAMIC_LINKER64 \
198- "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
199+ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
200
201 #undef DEFAULT_ASM_ENDIAN
202 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
203diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
204index c1d0441d488..81373eb8336 100644
205--- a/gcc/config/sh/linux.h
206+++ b/gcc/config/sh/linux.h
207@@ -64,7 +64,7 @@ along with GCC; see the file COPYING3. If not see
208 "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
209 "%{mfdpic:-fdpic}.so.1"
210
211-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
212+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
213
214 #undef SUBTARGET_LINK_EMUL_SUFFIX
215 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
216diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
217index 81201e67a2f..8b6fc577594 100644
218--- a/gcc/config/sparc/linux.h
219+++ b/gcc/config/sparc/linux.h
220@@ -84,7 +84,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
221 When the -shared link option is used a final link is not being
222 done. */
223
224-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
225+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
226
227 #undef LINK_SPEC
228 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
229diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
230index a1a0efd8f28..85d1084afc2 100644
231--- a/gcc/config/sparc/linux64.h
232+++ b/gcc/config/sparc/linux64.h
233@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. If not see
234 When the -shared link option is used a final link is not being
235 done. */
236
237-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
238-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
239+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
240+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
241
242 #ifdef SPARC_BI_ARCH
243
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0012-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc-10.1/0012-gcc-Fix-argument-list-too-long-error.patch
new file mode 100644
index 0000000000..acbd75f139
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0012-gcc-Fix-argument-list-too-long-error.patch
@@ -0,0 +1,37 @@
1From a22d1264049d29b90663cf5667049ae6f9b7a5ce 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] 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 a67d2cc18d6..480c9366418 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -3606,7 +3606,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 \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0013-Disable-sdt.patch b/meta/recipes-devtools/gcc/gcc-10.1/0013-Disable-sdt.patch
new file mode 100644
index 0000000000..207cdb57af
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0013-Disable-sdt.patch
@@ -0,0 +1,110 @@
1From fa47586935a18ecfc2ad5586802e326e21741b7b 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] 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 b26e8fc7fee..6080f86145e 100755
29--- a/gcc/configure
30+++ b/gcc/configure
31@@ -29789,12 +29789,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 26fa46802c7..42be5252778 100644
52--- a/gcc/configure.ac
53+++ b/gcc/configure.ac
54@@ -6190,15 +6190,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 9f9c5a2419a..71ed13b815b 100755
81--- a/libstdc++-v3/configure
82+++ b/libstdc++-v3/configure
83@@ -22615,11 +22615,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 699e55fd829..5c7a7bda439 100644
100--- a/libstdc++-v3/configure.ac
101+++ b/libstdc++-v3/configure.ac
102@@ -241,7 +241,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 \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0014-libtool.patch b/meta/recipes-devtools/gcc/gcc-10.1/0014-libtool.patch
new file mode 100644
index 0000000000..f4e70c3b18
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0014-libtool.patch
@@ -0,0 +1,39 @@
1From 6ecd478881468934444ff85611fd43f7033b1e81 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] 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 70990740b6c..ee938056bef 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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta/recipes-devtools/gcc/gcc-10.1/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
new file mode 100644
index 0000000000..bc2674abcc
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,40 @@
1From de4427fa49c07dc651ee6ceaf5c5078700ca3b08 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] 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 0c0332f317f..7b3769e8459 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -91,10 +91,14 @@
26 #define MUSL_DYNAMIC_LINKER \
27 "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta/recipes-devtools/gcc/gcc-10.1/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
new file mode 100644
index 0000000000..1dc4bb859a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,99 @@
1From 6b363c2c1c089ee900efa6013aefba1003840a37 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] Use the multilib config files from ${B} instead of using the
5 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 6080f86145e..825a9652329 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -12685,10 +12685,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_}${omp_device_property_tmake_file}"
48
49@@ -12699,6 +12709,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 42be5252778..6099eb3251f 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -2118,10 +2118,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_}${omp_device_property_tmake_file}"
88
89@@ -2132,6 +2142,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"
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta/recipes-devtools/gcc/gcc-10.1/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
new file mode 100644
index 0000000000..05f12847e9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -0,0 +1,28 @@
1From 08752c2f1d21553301bee5757c453c6a36cbe03c 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] Avoid using libdir from .la which usually points to a host
5 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 ee938056bef..9ebc7e3d1e0 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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0018-export-CPP.patch b/meta/recipes-devtools/gcc/gcc-10.1/0018-export-CPP.patch
new file mode 100644
index 0000000000..886a1221d3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0018-export-CPP.patch
@@ -0,0 +1,50 @@
1From 5c3d66378c7ff60ca11a875aa4aa6f8a8529d43a 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] 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 36e369df6e7..c717903bb13 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; \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0019-Ensure-target-gcc-headers-can-be-included.patch b/meta/recipes-devtools/gcc/gcc-10.1/0019-Ensure-target-gcc-headers-can-be-included.patch
new file mode 100644
index 0000000000..2797b2c22d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0019-Ensure-target-gcc-headers-can-be-included.patch
@@ -0,0 +1,57 @@
1From 378b752c5d9a3dba4e58cdadf8b4b4f34ea99a76 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] 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 2 files changed, 6 insertions(+)
22
23diff --git a/gcc/Makefile.in b/gcc/Makefile.in
24index 480c9366418..011c7ac2db6 100644
25--- a/gcc/Makefile.in
26+++ b/gcc/Makefile.in
27@@ -618,6 +618,7 @@ libexecdir = @libexecdir@
28
29 # Directory in which the compiler finds libraries etc.
30 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
31+libsubdir_target = $(target_noncanonical)/$(version)
32 # Directory in which the compiler finds executables
33 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
34 # Directory in which all plugin resources are installed
35@@ -2946,6 +2947,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
36
37 PREPROCESSOR_DEFINES = \
38 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
39+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
40 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
41 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
42 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
43diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
44index af38cc494ea..2f43b88a0c3 100644
45--- a/gcc/cppdefault.c
46+++ b/gcc/cppdefault.c
47@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[]
48 /* This is the dir for gcc's private headers. */
49 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
50 #endif
51+#ifdef GCC_INCLUDE_SUBDIR_TARGET
52+ /* This is the dir for gcc's private headers under the specified sysroot. */
53+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
54+#endif
55 #ifdef LOCAL_INCLUDE_DIR
56 /* /usr/local/include comes before the fixincluded header files. */
57 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta/recipes-devtools/gcc/gcc-10.1/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch
new file mode 100644
index 0000000000..c3baf8b451
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch
@@ -0,0 +1,35 @@
1From 870e805d705d99d9b9d7dbd09727f9c1d2ad9c1d 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] Don't search host directory during "relink" if $inst_prefix
5 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 9ebc7e3d1e0..7ea79fa8be6 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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/meta/recipes-devtools/gcc/gcc-10.1/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
new file mode 100644
index 0000000000..abee48669d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
@@ -0,0 +1,26 @@
1From aba42de763a619355471efd1573561b0cbf51162 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] Use SYSTEMLIBS_DIR replacement instead of hardcoding
5 base_libdir
6
7Upstream-Status: Pending
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 gcc/config/aarch64/aarch64-linux.h | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
15index e587e2e9ad6..ddc62895693 100644
16--- a/gcc/config/aarch64/aarch64-linux.h
17+++ b/gcc/config/aarch64/aarch64-linux.h
18@@ -21,7 +21,7 @@
19 #ifndef GCC_AARCH64_LINUX_H
20 #define GCC_AARCH64_LINUX_H
21
22-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
23+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
24
25 #undef MUSL_DYNAMIC_LINKER
26 #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0022-aarch64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc-10.1/0022-aarch64-Add-support-for-musl-ldso.patch
new file mode 100644
index 0000000000..c55b66d4ba
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0022-aarch64-Add-support-for-musl-ldso.patch
@@ -0,0 +1,25 @@
1From d63820a78d92f302410358293546f01c7ad17bd8 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] 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 ddc62895693..b301825313a 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}"
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta/recipes-devtools/gcc/gcc-10.1/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch
new file mode 100644
index 0000000000..80c4d2292c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch
@@ -0,0 +1,51 @@
1From 3474e16ad4ea8cf4e0e330568e3bc9039e723dce 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] 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 c005b0dad4a..ec31d35b7b9 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 7104b649026..2103c477468 100644
39--- a/libcc1/Makefile.in
40+++ b/libcc1/Makefile.in
41@@ -393,8 +393,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 \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0024-handle-sysroot-support-for-nativesdk-gcc.patch b/meta/recipes-devtools/gcc/gcc-10.1/0024-handle-sysroot-support-for-nativesdk-gcc.patch
new file mode 100644
index 0000000000..1a65ece7bf
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0024-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -0,0 +1,346 @@
1From bb1f359e34649516e61305e9748534cce7e0ee70 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] 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
28Added PREFIXVAR and EXEC_PREFIXVAR to support runtime relocation. Without
29these as part of the gccrelocprefix the system can't do runtime relocation
30if the executable is moved. (These paths were missed in the original
31implementation.)
32
33Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
34---
35 gcc/c-family/c-opts.c | 4 +--
36 gcc/cppdefault.c | 63 ++++++++++++++++++++++++++-----------------
37 gcc/cppdefault.h | 13 ++++-----
38 gcc/gcc.c | 20 +++++++++-----
39 gcc/incpath.c | 12 ++++-----
40 gcc/prefix.c | 6 +++--
41 6 files changed, 70 insertions(+), 48 deletions(-)
42
43diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
44index 58ba0948e79..806bbcfb7a5 100644
45--- a/gcc/c-family/c-opts.c
46+++ b/gcc/c-family/c-opts.c
47@@ -1409,8 +1409,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
48 size_t prefix_len, suffix_len;
49
50 suffix_len = strlen (suffix);
51- prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
52- prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
53+ prefix = iprefix ? iprefix : GCC_INCLUDE_DIRVAR;
54+ prefix_len = iprefix ? strlen (iprefix) : strlen(GCC_INCLUDE_DIRVAR) - 7;
55
56 path = (char *) xmalloc (prefix_len + suffix_len + 1);
57 memcpy (path, prefix, prefix_len);
58diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
59index 2f43b88a0c3..6b6be04686c 100644
60--- a/gcc/cppdefault.c
61+++ b/gcc/cppdefault.c
62@@ -35,6 +35,30 @@
63 # undef CROSS_INCLUDE_DIR
64 #endif
65
66+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
67+char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
68+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
69+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
70+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
71+#ifdef LOCAL_INCLUDE_DIR
72+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
73+#endif
74+#ifdef PREFIX_INCLUDE_DIR
75+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
76+#endif
77+#ifdef FIXED_INCLUDE_DIR
78+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
79+#endif
80+#ifdef CROSS_INCLUDE_DIR
81+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
82+#endif
83+#ifdef TOOL_INCLUDE_DIR
84+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
85+#endif
86+#ifdef NATIVE_SYSTEM_HEADER_DIR
87+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
88+#endif
89+
90 const struct default_include cpp_include_defaults[]
91 #ifdef INCLUDE_DEFAULTS
92 = INCLUDE_DEFAULTS;
93@@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[]
94 = {
95 #ifdef GPLUSPLUS_INCLUDE_DIR
96 /* Pick up GNU C++ generic include files. */
97- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
98+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
99 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
100 #endif
101 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
102 /* Pick up GNU C++ target-dependent include files. */
103- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
104+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
105 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
106 #endif
107 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
108 /* Pick up GNU C++ backward and deprecated include files. */
109- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
110+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
111 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
112 #endif
113 #ifdef GCC_INCLUDE_DIR
114 /* This is the dir for gcc's private headers. */
115- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
116+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
117 #endif
118 #ifdef GCC_INCLUDE_SUBDIR_TARGET
119 /* This is the dir for gcc's private headers under the specified sysroot. */
120- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
121+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
122 #endif
123 #ifdef LOCAL_INCLUDE_DIR
124 /* /usr/local/include comes before the fixincluded header files. */
125- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
126- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
127+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
128+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
129 #endif
130 #ifdef PREFIX_INCLUDE_DIR
131- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
132+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
133 #endif
134 #ifdef FIXED_INCLUDE_DIR
135 /* This is the dir for fixincludes. */
136- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
137+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
138 /* A multilib suffix needs adding if different multilibs use
139 different headers. */
140 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
141@@ -85,33 +109,24 @@ const struct default_include cpp_include_defaults[]
142 #endif
143 #ifdef CROSS_INCLUDE_DIR
144 /* One place the target system's headers might be. */
145- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
146+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
147 #endif
148 #ifdef TOOL_INCLUDE_DIR
149 /* Another place the target system's headers might be. */
150- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
151+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
152 #endif
153 #ifdef NATIVE_SYSTEM_HEADER_DIR
154 /* /usr/include comes dead last. */
155- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
156- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
157+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
158+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
159 #endif
160 { 0, 0, 0, 0, 0, 0 }
161 };
162 #endif /* no INCLUDE_DEFAULTS */
163
164-#ifdef GCC_INCLUDE_DIR
165-const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
166-const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
167-#else
168-const char cpp_GCC_INCLUDE_DIR[] = "";
169-const size_t cpp_GCC_INCLUDE_DIR_len = 0;
170-#endif
171-
172 /* The configured prefix. */
173-const char cpp_PREFIX[] = PREFIX;
174-const size_t cpp_PREFIX_len = sizeof PREFIX - 1;
175-const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX;
176+char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
177+char EXEC_PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
178
179 /* This value is set by cpp_relocated at runtime */
180 const char *gcc_exec_prefix;
181diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
182index a681264f75e..5e10a2fa140 100644
183--- a/gcc/cppdefault.h
184+++ b/gcc/cppdefault.h
185@@ -33,7 +33,8 @@
186
187 struct default_include
188 {
189- const char *const fname; /* The name of the directory. */
190+ const char *fname; /* The name of the directory. */
191+
192 const char *const component; /* The component containing the directory
193 (see update_path in prefix.c) */
194 const char cplusplus; /* Only look here if we're compiling C++. */
195@@ -50,17 +51,13 @@ struct default_include
196 };
197
198 extern const struct default_include cpp_include_defaults[];
199-extern const char cpp_GCC_INCLUDE_DIR[];
200-extern const size_t cpp_GCC_INCLUDE_DIR_len;
201+extern char GCC_INCLUDE_DIRVAR[] __attribute__ ((section (".gccrelocprefix")));
202
203 /* The configure-time prefix, i.e., the value supplied as the argument
204 to --prefix=. */
205-extern const char cpp_PREFIX[];
206+extern char PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
207 /* The length of the configure-time prefix. */
208-extern const size_t cpp_PREFIX_len;
209-/* The configure-time execution prefix. This is typically the lib/gcc
210- subdirectory of cpp_PREFIX. */
211-extern const char cpp_EXEC_PREFIX[];
212+extern char EXEC_PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
213 /* The run-time execution prefix. This is typically the lib/gcc
214 subdirectory of the actual installation. */
215 extern const char *gcc_exec_prefix;
216diff --git a/gcc/gcc.c b/gcc/gcc.c
217index c87f603955f..535d5c3bb65 100644
218--- a/gcc/gcc.c
219+++ b/gcc/gcc.c
220@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL;
221 #endif
222 static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
223
224+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
225+
226 /* Nonzero means pass the updated target_system_root to the compiler. */
227
228 static int target_system_root_changed;
229@@ -526,6 +528,7 @@ or with constant text in a single argument.
230 %G process LIBGCC_SPEC as a spec.
231 %R Output the concatenation of target_system_root and
232 target_sysroot_suffix.
233+ %r Output the base path target_relocatable_prefix
234 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
235 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
236 %C process CPP_SPEC as a spec.
237@@ -1499,10 +1502,10 @@ static const char *gcc_libexec_prefix;
238 gcc_exec_prefix is set because, in that case, we know where the
239 compiler has been installed, and use paths relative to that
240 location instead. */
241-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
242-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
243-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
244-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
245+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
246+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
247+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
248+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
249
250 /* For native compilers, these are well-known paths containing
251 components that may be provided by the system. For cross
252@@ -1510,9 +1513,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
253 static const char *md_exec_prefix = MD_EXEC_PREFIX;
254 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
255 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
256-static const char *const standard_startfile_prefix_1
257+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
258 = STANDARD_STARTFILE_PREFIX_1;
259-static const char *const standard_startfile_prefix_2
260+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
261 = STANDARD_STARTFILE_PREFIX_2;
262
263 /* A relative path to be used in finding the location of tools
264@@ -5952,6 +5955,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
265 }
266 break;
267
268+ case 'r':
269+ obstack_grow (&obstack, target_relocatable_prefix,
270+ strlen (target_relocatable_prefix));
271+ break;
272+
273 case 'S':
274 value = do_spec_1 (startfile_spec, 0, NULL);
275 if (value != 0)
276diff --git a/gcc/incpath.c b/gcc/incpath.c
277index 9098ab044ab..bfad4ebe382 100644
278--- a/gcc/incpath.c
279+++ b/gcc/incpath.c
280@@ -131,7 +131,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
281 int relocated = cpp_relocated ();
282 size_t len;
283
284- if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
285+ if (iprefix && (len = strlen(GCC_INCLUDE_DIRVAR) - 7) != 0)
286 {
287 /* Look for directories that start with the standard prefix.
288 "Translate" them, i.e. replace /usr/local/lib/gcc... with
289@@ -145,7 +145,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
290 now. */
291 if (sysroot && p->add_sysroot)
292 continue;
293- if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
294+ if (!filename_ncmp (p->fname, GCC_INCLUDE_DIRVAR, len))
295 {
296 char *str = concat (iprefix, p->fname + len, NULL);
297 if (p->multilib == 1 && imultilib)
298@@ -185,7 +185,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
299 free (sysroot_no_trailing_dir_separator);
300 }
301 else if (!p->add_sysroot && relocated
302- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
303+ && !filename_ncmp (p->fname, PREFIXVAR, strlen(PREFIXVAR)))
304 {
305 static const char *relocated_prefix;
306 char *ostr;
307@@ -202,12 +202,12 @@ add_standard_paths (const char *sysroot, const char *iprefix,
308 dummy = concat (gcc_exec_prefix, "dummy", NULL);
309 relocated_prefix
310 = make_relative_prefix (dummy,
311- cpp_EXEC_PREFIX,
312- cpp_PREFIX);
313+ EXEC_PREFIXVAR,
314+ PREFIXVAR);
315 free (dummy);
316 }
317 ostr = concat (relocated_prefix,
318- p->fname + cpp_PREFIX_len,
319+ p->fname + strlen(PREFIXVAR),
320 NULL);
321 str = update_path (ostr, p->component);
322 free (ostr);
323diff --git a/gcc/prefix.c b/gcc/prefix.c
324index 1a403e535bd..3257ed3cd3e 100644
325--- a/gcc/prefix.c
326+++ b/gcc/prefix.c
327@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see
328 #include "prefix.h"
329 #include "common/common-target.h"
330
331-static const char *std_prefix = PREFIX;
332+static const char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
333+
334+static const char *std_prefix = PREFIXVAR;
335
336 static const char *get_key_value (char *);
337 static char *translate_name (char *);
338@@ -212,7 +214,7 @@ translate_name (char *name)
339 prefix = getenv (key);
340
341 if (prefix == 0)
342- prefix = PREFIX;
343+ prefix = PREFIXVAR;
344
345 /* We used to strip trailing DIR_SEPARATORs here, but that can
346 sometimes yield a result with no separator when one was coded
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch
new file mode 100644
index 0000000000..abf1f8491f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch
@@ -0,0 +1,99 @@
1From 9c0c73ee48dbee2aad57f4dcdad1b7b74e77b944 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] 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 535d5c3bb65..04647ae812d 100644
55--- a/gcc/gcc.c
56+++ b/gcc/gcc.c
57@@ -2616,7 +2616,7 @@ for_each_path (const struct path_prefix *paths,
58 if (path == NULL)
59 {
60 len = paths->max_len + extra_space + 1;
61- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
62+ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
63 path = XNEWVEC (char, len);
64 }
65
66@@ -2628,6 +2628,33 @@ for_each_path (const struct path_prefix *paths,
67 /* Look first in MACHINE/VERSION subdirectory. */
68 if (!skip_multi_dir)
69 {
70+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
71+ {
72+ const char *this_multi;
73+ size_t this_multi_len;
74+
75+ if (pl->os_multilib)
76+ {
77+ this_multi = multi_os_dir;
78+ this_multi_len = multi_os_dir_len;
79+ }
80+ else
81+ {
82+ this_multi = multi_dir;
83+ this_multi_len = multi_dir_len;
84+ }
85+
86+ /* Look in multilib MACHINE/VERSION subdirectory first */
87+ if (this_multi_len)
88+ {
89+ memcpy (path + len, this_multi, this_multi_len + 1);
90+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
91+ ret = callback (path, callback_info);
92+ if (ret)
93+ break;
94+ }
95+ }
96+
97 memcpy (path + len, multi_suffix, suffix_len + 1);
98 ret = callback (path, callback_info);
99 if (ret)
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0026-Fix-various-_FOR_BUILD-and-related-variables.patch b/meta/recipes-devtools/gcc/gcc-10.1/0026-Fix-various-_FOR_BUILD-and-related-variables.patch
new file mode 100644
index 0000000000..97bf2f3a73
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0026-Fix-various-_FOR_BUILD-and-related-variables.patch
@@ -0,0 +1,134 @@
1From 3a003af8804dda90fdf4862eca5f66cb12faaf02 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] 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 c717903bb13..5abc649868d 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@@ -171,6 +172,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@@ -188,6 +192,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@@ -776,6 +781,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 efed1511750..778beb705b4 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@@ -173,6 +174,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@@ -190,6 +194,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 011c7ac2db6..2f1165f7b5e 100644
98--- a/gcc/Makefile.in
99+++ b/gcc/Makefile.in
100@@ -805,7 +805,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 825a9652329..ff46cf58960 100755
111--- a/gcc/configure
112+++ b/gcc/configure
113@@ -12314,7 +12314,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 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
122diff --git a/gcc/configure.ac b/gcc/configure.ac
123index 6099eb3251f..b3c345b61dc 100644
124--- a/gcc/configure.ac
125+++ b/gcc/configure.ac
126@@ -1898,7 +1898,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 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc-10.1/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
new file mode 100644
index 0000000000..3cd75b7183
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
@@ -0,0 +1,25 @@
1From 4e53d0ae70af85af0e112a48a3e4dfe4c39f4a8d 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] 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 4bdcdcca1f0..e7943a9d640 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 \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta/recipes-devtools/gcc/gcc-10.1/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
new file mode 100644
index 0000000000..2a6769a82e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -0,0 +1,84 @@
1From 5db0404eb770ac477fd99d444226bcf021067584 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] 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 0c1a8118a26..bdc2a2d0659 100644
27--- a/gcc/config/linux.h
28+++ b/gcc/config/linux.h
29@@ -195,6 +195,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 b7026fcbee7..dd54d6c393e 100644
45--- a/gcc/config/rs6000/linux.h
46+++ b/gcc/config/rs6000/linux.h
47@@ -94,6 +94,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 967c1c43c63..dc5e4d97975 100644
66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h
68@@ -452,6 +452,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} \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch b/meta/recipes-devtools/gcc/gcc-10.1/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
new file mode 100644
index 0000000000..767cba0380
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
@@ -0,0 +1,26 @@
1From fbc926dbf6a47fa623b9c94cd9b09a0e90448fdc 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] 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 c997553447c..330352c2c81 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) && \
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0030-sync-gcc-stddef.h-with-musl.patch b/meta/recipes-devtools/gcc/gcc-10.1/0030-sync-gcc-stddef.h-with-musl.patch
new file mode 100644
index 0000000000..4f18907a1d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0030-sync-gcc-stddef.h-with-musl.patch
@@ -0,0 +1,88 @@
1From 24dc04dc8d69e3bf61322615b3ef18e02ccd311e 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] 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 9d67eac4947..6cb5edbedb4 100644
18--- a/gcc/ginclude/stddef.h
19+++ b/gcc/ginclude/stddef.h
20@@ -128,6 +128,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@@ -137,10 +138,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@@ -178,6 +181,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@@ -194,6 +198,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__) \
55 || defined(__DragonFly__) \
56 || defined(__FreeBSD_kernel__) \
57@@ -228,6 +233,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@@ -257,6 +263,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@@ -272,6 +279,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@@ -337,6 +345,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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0031-fix-segmentation-fault-in-precompiled-header-generat.patch b/meta/recipes-devtools/gcc/gcc-10.1/0031-fix-segmentation-fault-in-precompiled-header-generat.patch
new file mode 100644
index 0000000000..702279af0e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0031-fix-segmentation-fault-in-precompiled-header-generat.patch
@@ -0,0 +1,57 @@
1From 27b8ba5555ada2dab076988529bfb84d00a4b901 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] 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 56ac3a1dd73..73a951148b3 100644
23--- a/libcpp/lex.c
24+++ b/libcpp/lex.c
25@@ -3311,11 +3311,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;
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0032-Fix-for-testsuite-failure.patch b/meta/recipes-devtools/gcc/gcc-10.1/0032-Fix-for-testsuite-failure.patch
new file mode 100644
index 0000000000..0a0767b441
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0032-Fix-for-testsuite-failure.patch
@@ -0,0 +1,255 @@
1From 2512aacf023c679d86d8f40caff4f6ff412b32ff 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] 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 8561a3c26d6..6377f814645 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 28d85d37712..c93266bd4bc 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
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0033-Re-introduce-spe-commandline-options.patch b/meta/recipes-devtools/gcc/gcc-10.1/0033-Re-introduce-spe-commandline-options.patch
new file mode 100644
index 0000000000..ba7c2b8fd5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0033-Re-introduce-spe-commandline-options.patch
@@ -0,0 +1,38 @@
1From 3fc06241ce37e2e4b3ed21ace28d347eb511448d 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] 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 f95b8279270..0e52d51409d 100644
18--- a/gcc/config/rs6000/rs6000.opt
19+++ b/gcc/config/rs6000/rs6000.opt
20@@ -344,6 +344,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.
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta/recipes-devtools/gcc/gcc-10.1/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
new file mode 100644
index 0000000000..4ce9dc6def
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -0,0 +1,83 @@
1From b42ff59c3fe2967d37815c8db72a47b9b7f585b4 Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
5 symver
6
7Adapter from
8
9https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
10
11This fix was debated but hasnt been applied gcc upstream since
12they expect musl to support '@' in symbol versioning which is
13a sun/gnu versioning extention. This patch however avoids the
14need for the '@' symbols at all
15
16libgcc/Changelog:
17
182015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
19
20 * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
21 (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
22
23 * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
24
25gcc/Changelog:
26
272015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
28
29 * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
30 call __cpu_indicator_init_local instead of __cpu_indicator_init.
31
32Upstream-Status: Pending
33
34Signed-off-by: Khem Raj <raj.khem@gmail.com>
35---
36 gcc/config/i386/i386-expand.c | 4 ++--
37 libgcc/config/i386/cpuinfo.c | 6 +++---
38 libgcc/config/i386/t-linux | 2 +-
39 3 files changed, 6 insertions(+), 6 deletions(-)
40
41diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
42index 48f00c5fcfc..468f5f71fac 100644
43--- a/gcc/config/i386/i386-expand.c
44+++ b/gcc/config/i386/i386-expand.c
45@@ -10941,10 +10941,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
46 {
47 case IX86_BUILTIN_CPU_INIT:
48 {
49- /* Make it call __cpu_indicator_init in libgcc. */
50+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
51 tree call_expr, fndecl, type;
52 type = build_function_type_list (integer_type_node, NULL_TREE);
53- fndecl = build_fn_decl ("__cpu_indicator_init", type);
54+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
55 call_expr = build_call_expr (fndecl, 0);
56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
57 }
58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
59index 00322c58622..f42bbb8af98 100644
60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -508,7 +508,7 @@ __cpu_indicator_init (void)
63 return 0;
64 }
65
66-#if defined SHARED && defined USE_ELF_SYMVER
67-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
68-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
69+#ifndef SHARED
70+int __cpu_indicator_init_local (void)
71+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
72 #endif
73diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
74index 8506a635790..564296f788e 100644
75--- a/libgcc/config/i386/t-linux
76+++ b/libgcc/config/i386/t-linux
77@@ -3,5 +3,5 @@
78 # t-slibgcc-elf-ver and t-linux
79 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
80
81-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
82+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
83 CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/meta/recipes-devtools/gcc/gcc-10.1/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
new file mode 100644
index 0000000000..dd1bf6dedc
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
@@ -0,0 +1,182 @@
1From 0395060a7dcf98c5f5a65103f6aaa71d6b862259 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Tue, 10 Mar 2020 08:26:53 -0700
4Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining
5 reproducibility
6
7Inserting line numbers into generated code means its not always reproducible wth
8differing versions of host gcc. Void the issue by not adding these.
9
10Upstream-Status: Inappropriate [OE Reproducibility specific]
11
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 gcc/gengtype.c | 6 +++---
16 gcc/genmodes.c | 32 ++++++++++++++++----------------
17 2 files changed, 19 insertions(+), 19 deletions(-)
18
19diff --git a/gcc/gengtype.c b/gcc/gengtype.c
20index 981577481af..d5700fff401 100644
21--- a/gcc/gengtype.c
22+++ b/gcc/gengtype.c
23@@ -991,7 +991,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt,
24 /* Create a fake field with the given type and name. NEXT is the next
25 field in the chain. */
26 #define create_field(next,type,name) \
27- create_field_all (next,type,name, 0, this_file, __LINE__)
28+ create_field_all (next,type,name, 0, this_file, 0)
29
30 /* Like create_field, but the field is only valid when condition COND
31 is true. */
32@@ -1024,7 +1024,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name,
33 }
34
35 #define create_optional_field(next,type,name,cond) \
36- create_optional_field_(next,type,name,cond,__LINE__)
37+ create_optional_field_(next,type,name,cond,0)
38
39 /* Reverse a linked list of 'struct pair's in place. */
40 pair_p
41@@ -5187,7 +5187,7 @@ main (int argc, char **argv)
42 /* These types are set up with #define or else outside of where
43 we can see them. We should initialize them before calling
44 read_input_list. */
45-#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \
46+#define POS_HERE(Call) do { pos.file = this_file; pos.line = 0; \
47 Call;} while (0)
48 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
49 POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
50diff --git a/gcc/genmodes.c b/gcc/genmodes.c
51index bd78310ea24..dbd02c51a4c 100644
52--- a/gcc/genmodes.c
53+++ b/gcc/genmodes.c
54@@ -430,7 +430,7 @@ complete_all_modes (void)
55 }
56
57 /* For each mode in class CLASS, construct a corresponding complex mode. */
58-#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, __LINE__)
59+#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, 0)
60 static void
61 make_complex_modes (enum mode_class cl,
62 const char *file, unsigned int line)
63@@ -489,7 +489,7 @@ make_complex_modes (enum mode_class cl,
64 having as many components as necessary. ORDER is the sorting order
65 of the mode, with smaller numbers indicating a higher priority. */
66 #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \
67- make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, __LINE__)
68+ make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, 0)
69 #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0)
70 static void ATTRIBUTE_UNUSED
71 make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
72@@ -541,7 +541,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
73 /* Create a vector of booleans called NAME with COUNT elements and
74 BYTESIZE bytes in total. */
75 #define VECTOR_BOOL_MODE(NAME, COUNT, BYTESIZE) \
76- make_vector_bool_mode (#NAME, COUNT, BYTESIZE, __FILE__, __LINE__)
77+ make_vector_bool_mode (#NAME, COUNT, BYTESIZE, __FILE__, 0)
78 static void ATTRIBUTE_UNUSED
79 make_vector_bool_mode (const char *name, unsigned int count,
80 unsigned int bytesize, const char *file,
81@@ -563,7 +563,7 @@ make_vector_bool_mode (const char *name, unsigned int count,
82 /* Input. */
83
84 #define _SPECIAL_MODE(C, N) \
85- make_special_mode (MODE_##C, #N, __FILE__, __LINE__)
86+ make_special_mode (MODE_##C, #N, __FILE__, 0)
87 #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N)
88 #define CC_MODE(N) _SPECIAL_MODE (CC, N)
89
90@@ -576,7 +576,7 @@ make_special_mode (enum mode_class cl, const char *name,
91
92 #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y)
93 #define FRACTIONAL_INT_MODE(N, B, Y) \
94- make_int_mode (#N, B, Y, __FILE__, __LINE__)
95+ make_int_mode (#N, B, Y, __FILE__, 0)
96
97 static void
98 make_int_mode (const char *name,
99@@ -589,16 +589,16 @@ make_int_mode (const char *name,
100 }
101
102 #define FRACT_MODE(N, Y, F) \
103- make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, __LINE__)
104+ make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, 0)
105
106 #define UFRACT_MODE(N, Y, F) \
107- make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, __LINE__)
108+ make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, 0)
109
110 #define ACCUM_MODE(N, Y, I, F) \
111- make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, __LINE__)
112+ make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, 0)
113
114 #define UACCUM_MODE(N, Y, I, F) \
115- make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, __LINE__)
116+ make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, 0)
117
118 /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT,
119 FILE, and LINE. */
120@@ -619,7 +619,7 @@ make_fixed_point_mode (enum mode_class cl,
121
122 #define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
123 #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \
124- make_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
125+ make_float_mode (#N, B, Y, #F, __FILE__, 0)
126
127 static void
128 make_float_mode (const char *name,
129@@ -636,7 +636,7 @@ make_float_mode (const char *name,
130 #define DECIMAL_FLOAT_MODE(N, Y, F) \
131 FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F)
132 #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \
133- make_decimal_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
134+ make_decimal_float_mode (#N, B, Y, #F, __FILE__, 0)
135
136 static void
137 make_decimal_float_mode (const char *name,
138@@ -651,7 +651,7 @@ make_decimal_float_mode (const char *name,
139 }
140
141 #define RESET_FLOAT_FORMAT(N, F) \
142- reset_float_format (#N, #F, __FILE__, __LINE__)
143+ reset_float_format (#N, #F, __FILE__, 0)
144 static void ATTRIBUTE_UNUSED
145 reset_float_format (const char *name, const char *format,
146 const char *file, unsigned int line)
147@@ -672,7 +672,7 @@ reset_float_format (const char *name, const char *format,
148
149 /* __intN support. */
150 #define INT_N(M,PREC) \
151- make_int_n (#M, PREC, __FILE__, __LINE__)
152+ make_int_n (#M, PREC, __FILE__, 0)
153 static void ATTRIBUTE_UNUSED
154 make_int_n (const char *m, int bitsize,
155 const char *file, unsigned int line)
156@@ -701,7 +701,7 @@ make_int_n (const char *m, int bitsize,
157 /* Partial integer modes are specified by relation to a full integer
158 mode. */
159 #define PARTIAL_INT_MODE(M,PREC,NAME) \
160- make_partial_integer_mode (#M, #NAME, PREC, __FILE__, __LINE__)
161+ make_partial_integer_mode (#M, #NAME, PREC, __FILE__, 0)
162 static void ATTRIBUTE_UNUSED
163 make_partial_integer_mode (const char *base, const char *name,
164 unsigned int precision,
165@@ -728,7 +728,7 @@ make_partial_integer_mode (const char *base, const char *name,
166 /* A single vector mode can be specified by naming its component
167 mode and the number of components. */
168 #define VECTOR_MODE(C, M, N) \
169- make_vector_mode (MODE_##C, #M, N, __FILE__, __LINE__);
170+ make_vector_mode (MODE_##C, #M, N, __FILE__, 0);
171 static void ATTRIBUTE_UNUSED
172 make_vector_mode (enum mode_class bclass,
173 const char *base,
174@@ -771,7 +771,7 @@ make_vector_mode (enum mode_class bclass,
175
176 /* Adjustability. */
177 #define _ADD_ADJUST(A, M, X, C1, C2) \
178- new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, __LINE__)
179+ new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, 0)
180
181 #define ADJUST_NUNITS(M, X) _ADD_ADJUST (nunits, M, X, RANDOM, RANDOM)
182 #define ADJUST_BYTESIZE(M, X) _ADD_ADJUST (bytesize, M, X, RANDOM, RANDOM)
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0036-Enable-CET-in-cross-compiler-if-possible.patch b/meta/recipes-devtools/gcc/gcc-10.1/0036-Enable-CET-in-cross-compiler-if-possible.patch
new file mode 100644
index 0000000000..af80642829
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0036-Enable-CET-in-cross-compiler-if-possible.patch
@@ -0,0 +1,150 @@
1From 87a5ace658f2294b025e0420ef03ade1f45d926c Mon Sep 17 00:00:00 2001
2From: "H.J. Lu" <hjl.tools@gmail.com>
3Date: Fri, 8 May 2020 06:11:05 -0700
4Subject: [PATCH] Enable CET in cross compiler if possible
5
6Don't perform CET run-time check for host when cross compiling. Instead,
7enable CET in cross compiler if possible so that it will run on both CET
8and non-CET hosts.
9
10config/
11
12 PR bootstrap/94998
13 * cet.m4 (GCC_CET_HOST_FLAGS): Enable CET in cross compiler if
14 possible.
15
16libiberty/
17
18 PR bootstrap/94998
19 * configure: Regenerated.
20
21lto-plugin/
22
23 PR bootstrap/94998
24 * configure: Regenerated.
25
26Upstream-Status: Submitted [https://patchwork.ozlabs.org/project/gcc/patch/20200508131105.170077-1-hjl.tools@gmail.com/]
27Signed-off-by: Khem Raj <raj.khem@gmail.com>
28---
29 config/cet.m4 | 18 ++++++++++++------
30 libiberty/configure | 12 +++++++++---
31 lto-plugin/configure | 16 +++++++++++-----
32 3 files changed, 32 insertions(+), 14 deletions(-)
33
34diff --git a/config/cet.m4 b/config/cet.m4
35index ea616b728a9..d9608699cd5 100644
36--- a/config/cet.m4
37+++ b/config/cet.m4
38@@ -111,7 +111,8 @@ if test x$may_have_cet = xyes; then
39 fi
40
41 if test x$may_have_cet = xyes; then
42- AC_TRY_RUN([
43+ if test x$cross_compiling = xno; then
44+ AC_TRY_RUN([
45 static void
46 foo (void)
47 {
48@@ -137,12 +138,17 @@ main ()
49 bar ();
50 return 0;
51 }
52- ],
53- [have_cet=no],
54- [have_cet=yes])
55- if test x$enable_cet = xno -a x$have_cet = xyes; then
56- AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host])
57+ ],
58+ [have_cet=no],
59+ [have_cet=yes])
60+ if test x$enable_cet = xno -a x$have_cet = xyes; then
61+ AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host])
62+ fi
63 fi
64+else
65+ # Enable CET in cross compiler if possible so that it will run on both
66+ # CET and non-CET hosts.
67+ have_cet=yes
68 fi
69 if test x$enable_cet = xyes; then
70 $1="-fcf-protection"
71diff --git a/libiberty/configure b/libiberty/configure
72index bb76cf1b823..3f82c5bb865 100755
73--- a/libiberty/configure
74+++ b/libiberty/configure
75@@ -5375,7 +5375,8 @@ rm -f core conftest.err conftest.$ac_objext \
76 fi
77
78 if test x$may_have_cet = xyes; then
79- if test "$cross_compiling" = yes; then :
80+ if test x$cross_compiling = xno; then
81+ if test "$cross_compiling" = yes; then :
82 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
83 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
84 as_fn_error $? "cannot run test program while cross compiling
85@@ -5420,9 +5421,14 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
86 conftest.$ac_objext conftest.beam conftest.$ac_ext
87 fi
88
89- if test x$enable_cet = xno -a x$have_cet = xyes; then
90- as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5
91+ if test x$enable_cet = xno -a x$have_cet = xyes; then
92+ as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5
93+ fi
94 fi
95+else
96+ # Enable CET in cross compiler if possible so that it will run on both
97+ # CET and non-CET hosts.
98+ have_cet=yes
99 fi
100 if test x$enable_cet = xyes; then
101 CET_HOST_FLAGS="-fcf-protection"
102diff --git a/lto-plugin/configure b/lto-plugin/configure
103index 1baf6cc70b8..36c6ecc5875 100755
104--- a/lto-plugin/configure
105+++ b/lto-plugin/configure
106@@ -5768,7 +5768,8 @@ rm -f core conftest.err conftest.$ac_objext \
107 fi
108
109 if test x$may_have_cet = xyes; then
110- if test "$cross_compiling" = yes; then :
111+ if test x$cross_compiling = xno; then
112+ if test "$cross_compiling" = yes; then :
113 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
114 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
115 as_fn_error $? "cannot run test program while cross compiling
116@@ -5813,9 +5814,14 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
117 conftest.$ac_objext conftest.beam conftest.$ac_ext
118 fi
119
120- if test x$enable_cet = xno -a x$have_cet = xyes; then
121- as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5
122+ if test x$enable_cet = xno -a x$have_cet = xyes; then
123+ as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5
124+ fi
125 fi
126+else
127+ # Enable CET in cross compiler if possible so that it will run on both
128+ # CET and non-CET hosts.
129+ have_cet=yes
130 fi
131 if test x$enable_cet = xyes; then
132 CET_HOST_FLAGS="-fcf-protection"
133@@ -11941,7 +11947,7 @@ else
134 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
135 lt_status=$lt_dlunknown
136 cat > conftest.$ac_ext <<_LT_EOF
137-#line 11944 "configure"
138+#line 11950 "configure"
139 #include "confdefs.h"
140
141 #if HAVE_DLFCN_H
142@@ -12047,7 +12053,7 @@ else
143 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
144 lt_status=$lt_dlunknown
145 cat > conftest.$ac_ext <<_LT_EOF
146-#line 12050 "configure"
147+#line 12056 "configure"
148 #include "confdefs.h"
149
150 #if HAVE_DLFCN_H
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/0037-mingw32-Enable-operation_not_supported.patch b/meta/recipes-devtools/gcc/gcc-10.1/0037-mingw32-Enable-operation_not_supported.patch
new file mode 100644
index 0000000000..de82a3a539
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/0037-mingw32-Enable-operation_not_supported.patch
@@ -0,0 +1,26 @@
1From 6f87a095f0e696bec07a50df789c9db8bdbca43d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 12 May 2020 10:39:09 -0700
4Subject: [PATCH] mingw32: Enable operation_not_supported
5
6Fixes nativesdk build errors on mingw32 gcc-runtime
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 libstdc++-v3/config/os/mingw32/error_constants.h | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/libstdc++-v3/config/os/mingw32/error_constants.h b/libstdc++-v3/config/os/mingw32/error_constants.h
15index 68ac72a78fb..71cd5815b81 100644
16--- a/libstdc++-v3/config/os/mingw32/error_constants.h
17+++ b/libstdc++-v3/config/os/mingw32/error_constants.h
18@@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
19 #ifdef _GLIBCXX_HAVE_EPERM
20 operation_not_permitted = EPERM,
21 #endif
22-// operation_not_supported = EOPNOTSUPP,
23+ operation_not_supported = EOPNOTSUPP,
24 #ifdef _GLIBCXX_HAVE_EWOULDBLOCK
25 operation_would_block = EWOULDBLOCK,
26 #endif