summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-7.3
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-23 17:03:26 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-27 13:15:28 +0000
commitc391593402109944bacc6f75693a6d21adb0b071 (patch)
treea7a04369eeb6e90610041ff4559199cf4b01cc9f /meta/recipes-devtools/gcc/gcc-7.3
parentfa2fcaee9785f7eeadad890c40fd075fb85aaa78 (diff)
downloadpoky-c391593402109944bacc6f75693a6d21adb0b071.tar.gz
gcc: Upgrade 7.2 -> 7.3
The static PIE patch was updated by Juro Bystricky <juro.bystricky@intel.com> to work with gcc 7.3. This update from the stable gcc 7 branch includes the retpoline functionality which is useful to assist with recent security issues. Two backported patches were dropped as they're included in 7.3. (From OE-Core rev: a4c1ede6876ad6b84ab2b3bece14bf0afdc9d6b7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-7.3')
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0008-c99-snprintf.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0009-gcc-poison-system-directories.patch192
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0010-gcc-poison-dir-extend.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0011-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0012-64-bit-multilib-hack.patch85
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0013-optional-libstdc.patch125
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0014-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch59
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0015-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0016-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch96
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0017-fortran-cross-compile-hack.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0018-cpp-honor-sysroot.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0019-MIPS64-Default-to-N64-ABI.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0020-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch234
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0021-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0022-Disable-sdt.patch113
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0023-libtool.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0024-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0025-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0026-Avoid-using-libdir-from-.la-which-usually-points-to-.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0027-export-CPP.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0028-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch56
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0029-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch98
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0031-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0032-Don-t-search-host-directory-during-relink-if-inst_pr.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0033-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0034-aarch64-Add-support-for-musl-ldso.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0035-libcc1-fix-libcc1-s-install-path-and-rpath.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0036-handle-sysroot-support-for-nativesdk-gcc.patch213
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0037-Search-target-sysroot-gcc-version-specific-dirs-with.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0038-Fix-various-_FOR_BUILD-and-related-variables.patch137
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0039-nios2-Define-MUSL_DYNAMIC_LINKER.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch87
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0041-gcc-libcpp-support-ffile-prefix-map-old-new.patch284
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0042-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0043-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch124
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0045-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0046-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch85
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0047-sync-gcc-stddef.h-with-musl.patch91
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0048-gcc-Enable-static-PIE.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch49
44 files changed, 3414 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-7.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..1af1c74e61
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,42 @@
1From 2fcf1e23ef4b2a5c93526f12212aa892595261f6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH 01/47] 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 32a38633ad8..b4760952085 100755
16--- a/configure
17+++ b/configure
18@@ -7472,7 +7472,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 12377499295..176ebb921ed 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -3065,7 +3065,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34
35-FLAGS_FOR_TARGET=
36+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
37 case " $target_configdirs " in
38 *" newlib "*)
39 case " $target_configargs " in
40--
412.12.2
42
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0008-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-7.3/0008-c99-snprintf.patch
new file mode 100644
index 0000000000..ebd562b63f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0008-c99-snprintf.patch
@@ -0,0 +1,28 @@
1From 732f10eead61830a8aee1bf38cce892da25c35b1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:03 +0400
4Subject: [PATCH 08/47] c99-snprintf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/c_std/cstdio | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
14index 43969892aa2..12148457909 100644
15--- a/libstdc++-v3/include/c_std/cstdio
16+++ b/libstdc++-v3/include/c_std/cstdio
17@@ -144,7 +144,7 @@ namespace std
18 using ::vsprintf;
19 } // namespace std
20
21-#if _GLIBCXX_USE_C99_STDIO
22+#if _GLIBCXX_USE_C99_STDIO || defined(__UCLIBC__)
23
24 #undef snprintf
25 #undef vfscanf
26--
272.12.2
28
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0009-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-7.3/0009-gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..fe13ed6e2d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0009-gcc-poison-system-directories.patch
@@ -0,0 +1,192 @@
1From 4791a0a0f4595d0a18974f4e85a759a0789943db 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 09/47] gcc: poison-system-directories
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [distribution: codesourcery]
9---
10 gcc/common.opt | 4 ++++
11 gcc/config.in | 6 ++++++
12 gcc/configure | 16 ++++++++++++++++
13 gcc/configure.ac | 10 ++++++++++
14 gcc/doc/invoke.texi | 9 +++++++++
15 gcc/gcc.c | 2 ++
16 gcc/incpath.c | 19 +++++++++++++++++++
17 7 files changed, 66 insertions(+)
18
19diff --git a/gcc/common.opt b/gcc/common.opt
20index a5c3aeaa336..f02fe66367e 100644
21--- a/gcc/common.opt
22+++ b/gcc/common.opt
23@@ -662,6 +662,10 @@ Wreturn-local-addr
24 Common Var(warn_return_local_addr) Init(1) Warning
25 Warn about returning a pointer/reference to a local or temporary variable.
26
27+Wpoison-system-directories
28+Common Var(flag_poison_system_directories) Init(1) Warning
29+Warn for -I and -L options using system directories if cross compiling
30+
31 Wshadow
32 Common Var(warn_shadow) Warning
33 Warn when one variable shadows another. Same as -Wshadow=global.
34diff --git a/gcc/config.in b/gcc/config.in
35index bf2aa7b2e7d..b1203987e15 100644
36--- a/gcc/config.in
37+++ b/gcc/config.in
38@@ -194,6 +194,12 @@
39 #endif
40
41
42+/* Define to warn for use of native system header directories */
43+#ifndef USED_FOR_TARGET
44+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
45+#endif
46+
47+
48 /* Define if you want all operations on RTL (the basic data structure of the
49 optimizer and back end) to be checked for dynamic type safety at runtime.
50 This is quite expensive. */
51diff --git a/gcc/configure b/gcc/configure
52index c823ffe6290..4898f04fa6b 100755
53--- a/gcc/configure
54+++ b/gcc/configure
55@@ -949,6 +949,7 @@ with_system_zlib
56 enable_maintainer_mode
57 enable_link_mutex
58 enable_version_specific_runtime_libs
59+enable_poison_system_directories
60 enable_plugin
61 enable_host_shared
62 enable_libquadmath_support
63@@ -1691,6 +1692,8 @@ Optional Features:
64 --enable-version-specific-runtime-libs
65 specify that runtime libraries should be installed
66 in a compiler-specific directory
67+ --enable-poison-system-directories
68+ warn for use of native system header directories
69 --enable-plugin enable plugin support
70 --enable-host-shared build host code as shared libraries
71 --disable-libquadmath-support
72@@ -29347,6 +29350,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
73 fi
74
75
76+# Check whether --enable-poison-system-directories was given.
77+if test "${enable_poison_system_directories+set}" = set; then :
78+ enableval=$enable_poison_system_directories;
79+else
80+ enable_poison_system_directories=no
81+fi
82+
83+if test "x${enable_poison_system_directories}" = "xyes"; then
84+
85+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
86+
87+fi
88+
89 # Substitute configuration variables
90
91
92diff --git a/gcc/configure.ac b/gcc/configure.ac
93index acfe9797389..9dc1dc7fc96 100644
94--- a/gcc/configure.ac
95+++ b/gcc/configure.ac
96@@ -6101,6 +6101,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
97 [specify that runtime libraries should be
98 installed in a compiler-specific directory])])
99
100+AC_ARG_ENABLE([poison-system-directories],
101+ AS_HELP_STRING([--enable-poison-system-directories],
102+ [warn for use of native system header directories]),,
103+ [enable_poison_system_directories=no])
104+if test "x${enable_poison_system_directories}" = "xyes"; then
105+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
106+ [1],
107+ [Define to warn for use of native system header directories])
108+fi
109+
110 # Substitute configuration variables
111 AC_SUBST(subdirs)
112 AC_SUBST(srcdir)
113diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
114index 68a558e9992..060cd7169c6 100644
115--- a/gcc/doc/invoke.texi
116+++ b/gcc/doc/invoke.texi
117@@ -298,6 +298,7 @@ Objective-C and Objective-C++ Dialects}.
118 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
119 -Wparentheses -Wno-pedantic-ms-format @gol
120 -Wplacement-new -Wplacement-new=@var{n} @gol
121+-Wno-poison-system-directories @gol
122 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
123 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
124 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
125@@ -5395,6 +5396,14 @@ made up of data only and thus requires no special treatment. But, for
126 most targets, it is made up of code and thus requires the stack to be
127 made executable in order for the program to work properly.
128
129+@item -Wno-poison-system-directories
130+@opindex Wno-poison-system-directories
131+Do not warn for @option{-I} or @option{-L} options using system
132+directories such as @file{/usr/include} when cross compiling. This
133+option is intended for use in chroot environments when such
134+directories contain the correct headers and libraries for the target
135+system rather than the host.
136+
137 @item -Wfloat-equal
138 @opindex Wfloat-equal
139 @opindex Wno-float-equal
140diff --git a/gcc/gcc.c b/gcc/gcc.c
141index c48178f..f63d53d 100644
142--- a/gcc/gcc.c
143+++ b/gcc/gcc.c
144@@ -1029,6 +1029,8 @@ proper position among the other output files. */
145 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
146 "%X %{o*} %{e*} %{N} %{n} %{r}\
147 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
148+ %{Wno-poison-system-directories:--no-poison-system-directories} \
149+ %{Werror=poison-system-directories:--error-poison-system-directories} \
150 %{static|no-pie:} %{L*} %(mfwrap) %(link_libgcc) " \
151 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \
152 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
153diff --git a/gcc/incpath.c b/gcc/incpath.c
154index 98fe5ec9ab3..f90e74dbd73 100644
155--- a/gcc/incpath.c
156+++ b/gcc/incpath.c
157@@ -26,6 +26,7 @@
158 #include "intl.h"
159 #include "incpath.h"
160 #include "cppdefault.h"
161+#include "diagnostic-core.h"
162
163 /* Microsoft Windows does not natively support inodes.
164 VMS has non-numeric inodes. */
165@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
166 }
167 fprintf (stderr, _("End of search list.\n"));
168 }
169+
170+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
171+ if (flag_poison_system_directories)
172+ {
173+ struct cpp_dir *p;
174+
175+ for (p = heads[QUOTE]; p; p = p->next)
176+ {
177+ if ((!strncmp (p->name, "/usr/include", 12))
178+ || (!strncmp (p->name, "/usr/local/include", 18))
179+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
180+ warning (OPT_Wpoison_system_directories,
181+ "include location \"%s\" is unsafe for "
182+ "cross-compilation",
183+ p->name);
184+ }
185+ }
186+#endif
187 }
188
189 /* Use given -I paths for #include "..." but not #include <...>, and
190--
1912.12.2
192
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0010-gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-7.3/0010-gcc-poison-dir-extend.patch
new file mode 100644
index 0000000000..4e06aa2f6a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0010-gcc-poison-dir-extend.patch
@@ -0,0 +1,39 @@
1From e74ef84ad609b3b6a5c37d207ffc3c6e70d1f025 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:00:34 +0400
4Subject: [PATCH 10/47] gcc-poison-dir-extend
5
6Add /sw/include and /opt/include based on the original
7zecke-no-host-includes.patch patch. The original patch checked for
8/usr/include, /sw/include and /opt/include and then triggered a failure and
9aborted.
10
11Instead, we add the two missing items to the current scan. If the user
12wants this to be a failure, they can add "-Werror=poison-system-directories".
13
14Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Pending
18---
19 gcc/incpath.c | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/incpath.c b/gcc/incpath.c
23index f90e74dbd73..c583ee5061d 100644
24--- a/gcc/incpath.c
25+++ b/gcc/incpath.c
26@@ -393,7 +393,9 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
27 {
28 if ((!strncmp (p->name, "/usr/include", 12))
29 || (!strncmp (p->name, "/usr/local/include", 18))
30- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
31+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
32+ || (!strncmp (p->name, "/sw/include", 11))
33+ || (!strncmp (p->name, "/opt/include", 12)))
34 warning (OPT_Wpoison_system_directories,
35 "include location \"%s\" is unsafe for "
36 "cross-compilation",
37--
382.12.2
39
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0011-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-7.3/0011-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..b39ff1ec22
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0011-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,73 @@
1From a41d3a53a4e313c20802330d6b5c75358a4ed882 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 11/47] 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 b4760952085..72a8ba94c4e 100755
30--- a/configure
31+++ b/configure
32@@ -6736,6 +6736,38 @@ fi
33
34
35
36+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
37+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
38+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
39+# We want to ensure that TARGET libraries (which we know are built with
40+# gcc) are built with "-O2 -g", so include those options when setting
41+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
42+if test "x$CFLAGS_FOR_TARGET" = x; then
43+ CFLAGS_FOR_TARGET=$CFLAGS
44+ case " $CFLAGS " in
45+ *" -O2 "*) ;;
46+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
47+ esac
48+ case " $CFLAGS " in
49+ *" -g "* | *" -g3 "*) ;;
50+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
51+ esac
52+fi
53+
54+
55+if test "x$CXXFLAGS_FOR_TARGET" = x; then
56+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
57+ case " $CXXFLAGS " in
58+ *" -O2 "*) ;;
59+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
60+ esac
61+ case " $CXXFLAGS " in
62+ *" -g "* | *" -g3 "*) ;;
63+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
64+ esac
65+fi
66+
67+
68 # Handle --with-headers=XXX. If the value is not "yes", the contents of
69 # the named directory are copied to $(tooldir)/sys-include.
70 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
71--
722.12.2
73
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0012-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc-7.3/0012-64-bit-multilib-hack.patch
new file mode 100644
index 0000000000..f3b39120b7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0012-64-bit-multilib-hack.patch
@@ -0,0 +1,85 @@
1From 3af9fbbd14e83242ac2acb54bbb4bb726845fd34 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 12/47] 64-bit multilib hack.
5
6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22RP 15/8/11
23
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
26
27Upstream-Status: Pending
28---
29 gcc/config/i386/t-linux64 | 6 ++----
30 gcc/config/mips/t-linux64 | 10 +++-------
31 gcc/config/rs6000/t-linux64 | 5 ++---
32 3 files changed, 7 insertions(+), 14 deletions(-)
33
34diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
35index e422c442dae..cc885e24457 100644
36--- a/gcc/config/i386/t-linux64
37+++ b/gcc/config/i386/t-linux64
38@@ -32,7 +32,5 @@
39 #
40 comma=,
41 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
42-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
43-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
44-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
45-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
46+MULTILIB_DIRNAMES = . .
47+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
48diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
49index 100f9da5e14..601cdf08d05 100644
50--- a/gcc/config/mips/t-linux64
51+++ b/gcc/config/mips/t-linux64
52@@ -17,10 +17,6 @@
53 # <http://www.gnu.org/licenses/>.
54
55 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
56-MULTILIB_DIRNAMES = n32 32 64
57-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
58-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
59-MULTILIB_OSDIRNAMES = \
60- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
61- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
62- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
63+MULTILIB_DIRNAMES = . . .
64+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
65+
66diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
67index 2830ed0d861..d057facd2fd 100644
68--- a/gcc/config/rs6000/t-linux64
69+++ b/gcc/config/rs6000/t-linux64
70@@ -26,10 +26,9 @@
71 # MULTILIB_OSDIRNAMES according to what is found on the target.
72
73 MULTILIB_OPTIONS := m64/m32
74-MULTILIB_DIRNAMES := 64 32
75+MULTILIB_DIRNAMES := . .
76 MULTILIB_EXTRA_OPTS :=
77-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
78-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
79+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
80
81 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
82 $(COMPILE) $<
83--
842.12.2
85
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0013-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc-7.3/0013-optional-libstdc.patch
new file mode 100644
index 0000000000..3439bf67d0
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0013-optional-libstdc.patch
@@ -0,0 +1,125 @@
1From 26a58d05844274915d011edbf9330c6151687b22 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 13/47] 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 9ad2f6e1fcc..c4ef7796282 100644
29--- a/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt
31@@ -1848,6 +1848,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 ffcc87c79c9..28d8a9cf530 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 060cd7169c6..8e2adc25644 100644
56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi
58@@ -211,6 +211,9 @@ in the following sections.
59 -fno-weak -nostdinc++ @gol
60 -fvisibility-inlines-hidden @gol
61 -fvisibility-ms-compat @gol
62+-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
63+-fvtv-counts -fvtv-debug @gol
64+-nostdlib++ @gol
65 -fext-numeric-literals @gol
66 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
67 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
68@@ -496,7 +499,7 @@ Objective-C and Objective-C++ Dialects}.
69 -s -static -static-libgcc -static-libstdc++ @gol
70 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
71 -static-libmpx -static-libmpxwrappers @gol
72--shared -shared-libgcc -symbolic @gol
73+-shared -shared-libgcc -symbolic -nostdlib++ @gol
74 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
75 -u @var{symbol} -z @var{keyword}}
76
77@@ -11606,6 +11609,33 @@ library subroutines.
78 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
79 GNU Compiler Collection (GCC) Internals}.)
80
81+@item -nostdlib++
82+@opindex nostdlib++
83+Do not use the standard system C++ runtime libraries when linking.
84+Only the libraries you specify will be passed to the linker.
85+
86+@cindex @option{-lgcc}, use with @option{-nostdlib}
87+@cindex @option{-nostdlib} and unresolved references
88+@cindex unresolved references and @option{-nostdlib}
89+@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
90+@cindex @option{-nodefaultlibs} and unresolved references
91+@cindex unresolved references and @option{-nodefaultlibs}
92+One of the standard libraries bypassed by @option{-nostdlib} and
93+@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
94+which GCC uses to overcome shortcomings of particular machines, or special
95+needs for some languages.
96+(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
97+Collection (GCC) Internals},
98+for more discussion of @file{libgcc.a}.)
99+In most cases, you need @file{libgcc.a} even when you want to avoid
100+other standard libraries. In other words, when you specify @option{-nostdlib}
101+or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
102+This ensures that you have no unresolved references to internal GCC
103+library subroutines.
104+(An example of such an internal subroutine is @code{__main}, used to ensure C++
105+constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
106+GNU Compiler Collection (GCC) Internals}.)
107+
108 @item -pie
109 @opindex pie
110 Produce a position independent executable on targets that support it.
111diff --git a/gcc/gcc.c b/gcc/gcc.c
112index 6315aa0dd16..a5fafbe5107 100644
113--- a/gcc/gcc.c
114+++ b/gcc/gcc.c
115@@ -1046,6 +1046,7 @@ proper position among the other output files. */
116 %(mflib) " STACK_SPLIT_SPEC "\
117 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
118 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
119+ %{!nostdlib++:}\
120 %{!nostdlib:%{!nostartfiles:%E}} %{T*} \n%(post_link) }}}}}}"
121 #endif
122
123--
1242.12.2
125
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0014-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/meta/recipes-devtools/gcc/gcc-7.3/0014-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
new file mode 100644
index 0000000000..f92b5fbaaf
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0014-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
@@ -0,0 +1,59 @@
1From 716de5db6859fd1ea21078c94a41fac7a885b7e9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:14:20 +0400
4Subject: [PATCH 14/47] gcc: disable MASK_RELAX_PIC_CALLS bit
5
6The new feature added after 4.3.3
7"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
8will cause cc1plus eat up all the system memory when build webkit-gtk.
9The function mips_get_pic_call_symbol keeps on recursively calling itself.
10Disable this feature to walk aside the bug.
11
12Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Inappropriate [configuration]
16---
17 gcc/configure | 7 -------
18 gcc/configure.ac | 7 -------
19 2 files changed, 14 deletions(-)
20
21diff --git a/gcc/configure b/gcc/configure
22index 4898f04fa6b..640e4643805 100755
23--- a/gcc/configure
24+++ b/gcc/configure
25@@ -27303,13 +27303,6 @@ $as_echo_n "checking assembler and linker for explicit JALR relocation... " >&6;
26 rm -f conftest.*
27 fi
28 fi
29- if test $gcc_cv_as_ld_jalr_reloc = yes; then
30- if test x$target_cpu_default = x; then
31- target_cpu_default=MASK_RELAX_PIC_CALLS
32- else
33- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
34- fi
35- fi
36 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
37 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
38
39diff --git a/gcc/configure.ac b/gcc/configure.ac
40index 9dc1dc7fc96..9a2dae55ba2 100644
41--- a/gcc/configure.ac
42+++ b/gcc/configure.ac
43@@ -4641,13 +4641,6 @@ x:
44 rm -f conftest.*
45 fi
46 fi
47- if test $gcc_cv_as_ld_jalr_reloc = yes; then
48- if test x$target_cpu_default = x; then
49- target_cpu_default=MASK_RELAX_PIC_CALLS
50- else
51- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
52- fi
53- fi
54 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
55
56 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
57--
582.12.2
59
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0015-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-7.3/0015-COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000000..6e62945e55
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0015-COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,38 @@
1From 04a7a672301bb07caea6a7cad8378f63f1fe3200 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 15/47] 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 a5fafbe5107..05896e19926 100644
18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c
20@@ -4654,6 +4654,15 @@ set_collect_gcc_options (void)
21 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
22
23 first_time = TRUE;
24+#ifdef HAVE_LD_SYSROOT
25+ if (target_system_root_changed && target_system_root)
26+ {
27+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
28+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
29+ obstack_grow (&collect_obstack, "'", 1);
30+ first_time = FALSE;
31+ }
32+#endif
33 for (i = 0; (int) i < n_switches; i++)
34 {
35 const char *const *args;
36--
372.12.2
38
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0016-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-7.3/0016-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
new file mode 100644
index 0000000000..1991251c27
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0016-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,96 @@
1From 47071cbd4f13ff5a4974f71f359a04afcfb125da 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 16/47] Use the defaults.h in ${B} instead of ${S}, and t-oe in
5 ${B}
6
7Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
8the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14
15While compiling gcc-crosssdk-initial-x86_64 on some host, there is
16occasionally failure that test the existance of default.h doesn't
17work, the reason is tm_include_list='** defaults.h' rather than
18tm_include_list='** ./defaults.h'
19
20So we add the test condition for this situation.
21Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
22---
23 gcc/Makefile.in | 2 +-
24 gcc/configure | 4 ++--
25 gcc/configure.ac | 4 ++--
26 gcc/mkconfig.sh | 4 ++--
27 4 files changed, 7 insertions(+), 7 deletions(-)
28
29diff --git a/gcc/Makefile.in b/gcc/Makefile.in
30index 2411671cea3..7b590c9bbd3 100644
31--- a/gcc/Makefile.in
32+++ b/gcc/Makefile.in
33@@ -532,7 +532,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
34 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
35
36 xmake_file=@xmake_file@
37-tmake_file=@tmake_file@
38+tmake_file=@tmake_file@ ./t-oe
39 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
40 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
41 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
42diff --git a/gcc/configure b/gcc/configure
43index 640e4643805..b5ac1552541 100755
44--- a/gcc/configure
45+++ b/gcc/configure
46@@ -12150,8 +12150,8 @@ for f in $tm_file; do
47 tm_include_list="${tm_include_list} $f"
48 ;;
49 defaults.h )
50- tm_file_list="${tm_file_list} \$(srcdir)/$f"
51- tm_include_list="${tm_include_list} $f"
52+ tm_file_list="${tm_file_list} ./$f"
53+ tm_include_list="${tm_include_list} ./$f"
54 ;;
55 * )
56 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
57diff --git a/gcc/configure.ac b/gcc/configure.ac
58index 9a2dae55ba2..cb1479d1ef4 100644
59--- a/gcc/configure.ac
60+++ b/gcc/configure.ac
61@@ -1922,8 +1922,8 @@ for f in $tm_file; do
62 tm_include_list="${tm_include_list} $f"
63 ;;
64 defaults.h )
65- tm_file_list="${tm_file_list} \$(srcdir)/$f"
66- tm_include_list="${tm_include_list} $f"
67+ tm_file_list="${tm_file_list} ./$f"
68+ tm_include_list="${tm_include_list} ./$f"
69 ;;
70 * )
71 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
72diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
73index 9fc7b5ca734..04abecfe648 100644
74--- a/gcc/mkconfig.sh
75+++ b/gcc/mkconfig.sh
76@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
77 if [ $# -ge 1 ]; then
78 echo '#ifdef IN_GCC' >> ${output}T
79 for file in "$@"; do
80- if test x"$file" = x"defaults.h"; then
81+ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
82 postpone_defaults_h="yes"
83 else
84 echo "# include \"$file\"" >> ${output}T
85@@ -109,7 +109,7 @@ esac
86
87 # If we postponed including defaults.h, add the #include now.
88 if test x"$postpone_defaults_h" = x"yes"; then
89- echo "# include \"defaults.h\"" >> ${output}T
90+ echo "# include \"./defaults.h\"" >> ${output}T
91 fi
92
93 # Add multiple inclusion protection guard, part two.
94--
952.12.2
96
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0017-fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-7.3/0017-fortran-cross-compile-hack.patch
new file mode 100644
index 0000000000..e2830c59d0
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0017-fortran-cross-compile-hack.patch
@@ -0,0 +1,46 @@
1From 4fc35a2bb7666a7de35568eb5d47f0ce6acebe62 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 17/47] 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 81238fcb79c..7ded7abd456 100755
20--- a/libgfortran/configure
21+++ b/libgfortran/configure
22@@ -12792,7 +12792,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 37b12d2998f..63a4166ef62 100644
33--- a/libgfortran/configure.ac
34+++ b/libgfortran/configure.ac
35@@ -243,7 +243,7 @@ AC_SUBST(enable_static)
36
37 # We need gfortran to compile parts of the library
38 #AC_PROG_FC(gfortran)
39-FC="$GFORTRAN"
40+#FC="$GFORTRAN"
41 AC_PROG_FC(gfortran)
42
43 # extra LD Flags which are required for targets
44--
452.12.2
46
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0018-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-7.3/0018-cpp-honor-sysroot.patch
new file mode 100644
index 0000000000..555907417a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0018-cpp-honor-sysroot.patch
@@ -0,0 +1,54 @@
1From 1c8a332469ca4bfefb10df70720e0dc83ff9a756 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 18/47] 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 6b383e1d86d..c7c7d6a56ec 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -64,5 +64,5 @@ along with GCC; see the file COPYING3. If not see
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!M:%{!MM:%{!E:\
36- cc1plus -fpreprocessed %i %(cc1_options) %2\
37+ cc1plus -fpreprocessed %i %I %(cc1_options) %2\
38 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
39diff --git a/gcc/gcc.c b/gcc/gcc.c
40index 05896e19926..c73d4023987 100644
41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c
43@@ -1351,7 +1351,7 @@ static const struct compiler default_compilers[] =
44 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
45 {".i", "@cpp-output", 0, 0, 0},
46 {"@cpp-output",
47- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
48+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
49 {".s", "@assembler", 0, 0, 0},
50 {"@assembler",
51 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
52--
532.12.2
54
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0019-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc-7.3/0019-MIPS64-Default-to-N64-ABI.patch
new file mode 100644
index 0000000000..742a4012a5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0019-MIPS64-Default-to-N64-ABI.patch
@@ -0,0 +1,57 @@
1From 0a3b3cc45ea7ba83b46df7464b41c377e3966d88 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 19/47] 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 b8bb4d65825..5e45f4b5199 100644
18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc
20@@ -2084,29 +2084,29 @@ mips*-*-linux*) # Linux MIPS, either endian.
21 default_mips_arch=mips32
22 ;;
23 mips64el-st-linux-gnu)
24- default_mips_abi=n32
25+ default_mips_abi=64
26 tm_file="${tm_file} mips/st.h"
27 tmake_file="${tmake_file} mips/t-st"
28 enable_mips_multilibs="yes"
29 ;;
30 mips64octeon*-*-linux*)
31- default_mips_abi=n32
32+ default_mips_abi=64
33 tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
34 target_cpu_default=MASK_SOFT_FLOAT_ABI
35 enable_mips_multilibs="yes"
36 ;;
37 mipsisa64r6*-*-linux*)
38- default_mips_abi=n32
39+ default_mips_abi=64
40 default_mips_arch=mips64r6
41 enable_mips_multilibs="yes"
42 ;;
43 mipsisa64r2*-*-linux*)
44- default_mips_abi=n32
45+ default_mips_abi=64
46 default_mips_arch=mips64r2
47 enable_mips_multilibs="yes"
48 ;;
49 mips64*-*-linux* | mipsisa64*-*-linux*)
50- default_mips_abi=n32
51+ default_mips_abi=64
52 enable_mips_multilibs="yes"
53 ;;
54 esac
55--
562.12.2
57
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0020-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc-7.3/0020-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
new file mode 100644
index 0000000000..de7b4df572
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0020-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,234 @@
1From d6c983b685ee03e9cf21189108d31ed9f760ff3f 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 20/47] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
5 relative to SYSTEMLIBS_DIR
6
7This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
8relative to SYSTEMLIBS_DIR which can be set in generated headers
9This breaks the assumption of hardcoded multilib in gcc
10Change is only for the supported architectures in OE including
11SH, sparc, alpha for possible future support (if any)
12
13Removes the do_headerfix task in metadata
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration]
18---
19 gcc/config/alpha/linux-elf.h | 4 ++--
20 gcc/config/arm/linux-eabi.h | 4 ++--
21 gcc/config/arm/linux-elf.h | 2 +-
22 gcc/config/i386/linux.h | 2 +-
23 gcc/config/i386/linux64.h | 6 +++---
24 gcc/config/linux.h | 8 ++++----
25 gcc/config/mips/linux.h | 12 ++++++------
26 gcc/config/rs6000/linux64.h | 16 ++++++----------
27 gcc/config/sh/linux.h | 2 +-
28 gcc/config/sparc/linux.h | 2 +-
29 gcc/config/sparc/linux64.h | 4 ++--
30 11 files changed, 29 insertions(+), 33 deletions(-)
31
32diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
33index 2c39fbe601c..6d88e21abe2 100644
34--- a/gcc/config/alpha/linux-elf.h
35+++ b/gcc/config/alpha/linux-elf.h
36@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
37 #define EXTRA_SPECS \
38 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
39
40-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
41-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
42+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
43+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
44 #if DEFAULT_LIBC == LIBC_UCLIBC
45 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
46 #elif DEFAULT_LIBC == LIBC_GLIBC
47diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
48index a08cfb34377..fbac9a9d994 100644
49--- a/gcc/config/arm/linux-eabi.h
50+++ b/gcc/config/arm/linux-eabi.h
51@@ -62,8 +62,8 @@
52 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
53
54 #undef GLIBC_DYNAMIC_LINKER
55-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
56-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
57+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
58+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
59 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
60
61 #define GLIBC_DYNAMIC_LINKER \
62diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
63index 3d62367ae68..e8a16191849 100644
64--- a/gcc/config/arm/linux-elf.h
65+++ b/gcc/config/arm/linux-elf.h
66@@ -60,7 +60,7 @@
67
68 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
69
70-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
71+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
72
73 #define LINUX_TARGET_LINK_SPEC "%{h*} \
74 %{static:-Bstatic} \
75diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
76index 59132124d6b..336d158629c 100644
77--- a/gcc/config/i386/linux.h
78+++ b/gcc/config/i386/linux.h
79@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
80 <http://www.gnu.org/licenses/>. */
81
82 #define GNU_USER_LINK_EMULATION "elf_i386"
83-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
84+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
85
86 #undef MUSL_DYNAMIC_LINKER
87 #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
88diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
89index e65c404ff91..c34ded98481 100644
90--- a/gcc/config/i386/linux64.h
91+++ b/gcc/config/i386/linux64.h
92@@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
93 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
94 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
95
96-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
97-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
98-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
99+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
100+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
101+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
102
103 #undef MUSL_DYNAMIC_LINKER32
104 #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
105diff --git a/gcc/config/linux.h b/gcc/config/linux.h
106index b3a9e85e77f..2e683d0c430 100644
107--- a/gcc/config/linux.h
108+++ b/gcc/config/linux.h
109@@ -81,10 +81,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
110 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
111 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
112 supporting both 32-bit and 64-bit compilation. */
113-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
114-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
115-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
116-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
117+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
118+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
119+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
120+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
121 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
122 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
123 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
124diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
125index 44132b8e44d..80505ad9f48 100644
126--- a/gcc/config/mips/linux.h
127+++ b/gcc/config/mips/linux.h
128@@ -22,20 +22,20 @@ along with GCC; see the file COPYING3. If not see
129 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
130
131 #define GLIBC_DYNAMIC_LINKER32 \
132- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
133+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
134 #define GLIBC_DYNAMIC_LINKER64 \
135- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
136+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
137 #define GLIBC_DYNAMIC_LINKERN32 \
138- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
139+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
140
141 #undef UCLIBC_DYNAMIC_LINKER32
142 #define UCLIBC_DYNAMIC_LINKER32 \
143- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
144+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
145 #undef UCLIBC_DYNAMIC_LINKER64
146 #define UCLIBC_DYNAMIC_LINKER64 \
147- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
148+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
149 #define UCLIBC_DYNAMIC_LINKERN32 \
150- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
151+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
152
153 #undef MUSL_DYNAMIC_LINKER32
154 #define MUSL_DYNAMIC_LINKER32 \
155diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
156index 71e35b709ad..3b00ec0fcf0 100644
157--- a/gcc/config/rs6000/linux64.h
158+++ b/gcc/config/rs6000/linux64.h
159@@ -412,16 +412,11 @@ extern int dot_symbols;
160 #undef LINK_OS_DEFAULT_SPEC
161 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
162
163-#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
164-
165+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
166 #ifdef LINUX64_DEFAULT_ABI_ELFv2
167-#define GLIBC_DYNAMIC_LINKER64 \
168-"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
169-":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
170+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
171 #else
172-#define GLIBC_DYNAMIC_LINKER64 \
173-"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
174-":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
175+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
176 #endif
177
178 #define MUSL_DYNAMIC_LINKER32 \
179@@ -429,8 +424,9 @@ extern int dot_symbols;
180 #define MUSL_DYNAMIC_LINKER64 \
181 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
182
183-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
184-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
185+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
186+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
187+
188 #if DEFAULT_LIBC == LIBC_UCLIBC
189 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
190 "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
191diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
192index c30083423f2..196b82725f8 100644
193--- a/gcc/config/sh/linux.h
194+++ b/gcc/config/sh/linux.h
195@@ -64,7 +64,7 @@ along with GCC; see the file COPYING3. If not see
196 "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
197 "%{mfdpic:-fdpic}.so.1"
198
199-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
200+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
201
202 #undef SUBTARGET_LINK_EMUL_SUFFIX
203 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
204diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
205index ce084656fca..bed6300cb2a 100644
206--- a/gcc/config/sparc/linux.h
207+++ b/gcc/config/sparc/linux.h
208@@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
209 When the -shared link option is used a final link is not being
210 done. */
211
212-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
213+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
214
215 #undef LINK_SPEC
216 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
217diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
218index 573ce8a9a4c..6749f6b5d9c 100644
219--- a/gcc/config/sparc/linux64.h
220+++ b/gcc/config/sparc/linux64.h
221@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. If not see
222 When the -shared link option is used a final link is not being
223 done. */
224
225-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
226-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
227+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
228+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
229
230 #ifdef SPARC_BI_ARCH
231
232--
2332.12.2
234
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0021-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc-7.3/0021-gcc-Fix-argument-list-too-long-error.patch
new file mode 100644
index 0000000000..4e562144e3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0021-gcc-Fix-argument-list-too-long-error.patch
@@ -0,0 +1,40 @@
1From 80c24247fed52c1269791088090bc0fa85280983 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 21/47] 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 7b590c9bbd3..23cca7f0d5a 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -3459,7 +3459,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
30 # We keep the directory structure for files in config or c-family and .def
31 # files. All other files are flattened to a single directory.
32 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
33- headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
34+ headers="$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def))"; \
35 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
36 for file in $$headers; do \
37 if [ -f $$file ] ; then \
38--
392.12.2
40
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0022-Disable-sdt.patch b/meta/recipes-devtools/gcc/gcc-7.3/0022-Disable-sdt.patch
new file mode 100644
index 0000000000..871f195c94
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0022-Disable-sdt.patch
@@ -0,0 +1,113 @@
1From 3021fec485f44478a3d5fffb4adac13d831fcdc1 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 22/47] 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 b5ac1552541..08b2f63c7fa 100755
29--- a/gcc/configure
30+++ b/gcc/configure
31@@ -28967,12 +28967,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 cb1479d1ef4..0581fe963dc 100644
52--- a/gcc/configure.ac
53+++ b/gcc/configure.ac
54@@ -5754,15 +5754,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 fb7e126c0b0..a18057feb88 100755
81--- a/libstdc++-v3/configure
82+++ b/libstdc++-v3/configure
83@@ -21856,11 +21856,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 8e973503be0..a46d25e740d 100644
100--- a/libstdc++-v3/configure.ac
101+++ b/libstdc++-v3/configure.ac
102@@ -230,7 +230,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
103 GLIBCXX_CHECK_SC_NPROC_ONLN
104 GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
105 GLIBCXX_CHECK_SYSCTL_HW_NCPU
106-GLIBCXX_CHECK_SDT_H
107+#GLIBCXX_CHECK_SDT_H
108
109 # Check for available headers.
110 AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
111--
1122.12.2
113
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0023-libtool.patch b/meta/recipes-devtools/gcc/gcc-7.3/0023-libtool.patch
new file mode 100644
index 0000000000..27dfb1fdd1
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0023-libtool.patch
@@ -0,0 +1,42 @@
1From e79a4f8169e836c8deabca5a45884cfe11d07847 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 23/47] libtool
5
6libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
7when running on am x86_64 build host.
8
9This patch stops this speading to libdir in the libstdc++.la file within libtool.
10Arguably, it shouldn't be passing this into libtool in the first place but
11for now this resolves the nastiest problems this causes.
12
13func_normal_abspath would resolve an empty path to `pwd` so we need
14to filter the zero case.
15
16RP 2012/8/24
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/ltmain.sh b/ltmain.sh
26index 9503ec85d70..0121fba707f 100644
27--- a/ltmain.sh
28+++ b/ltmain.sh
29@@ -6359,6 +6359,10 @@ func_mode_link ()
30 func_warning "ignoring multiple \`-rpath's for a libtool library"
31
32 install_libdir="$1"
33+ if test -n "$install_libdir"; then
34+ func_normal_abspath "$install_libdir"
35+ install_libdir=$func_normal_abspath_result
36+ fi
37
38 oldlibs=
39 if test -z "$rpath"; then
40--
412.12.2
42
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0024-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta/recipes-devtools/gcc/gcc-7.3/0024-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
new file mode 100644
index 0000000000..aa1e1bb8b1
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0024-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,43 @@
1From 74d8dc48cb185e304c60067b4d8b50447ec328ec 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 24/47] 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 fbac9a9d994..5a51a8a7095 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -88,10 +88,14 @@
26 #define MUSL_DYNAMIC_LINKER \
27 "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
28
29+/* For armv4 we pass --fix-v4bx to linker to support EABI */
30+#undef TARGET_FIX_V4BX_SPEC
31+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
32+
33 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
34 use the GNU/Linux version, not the generic BPABI version. */
35 #undef LINK_SPEC
36-#define LINK_SPEC EABI_LINK_SPEC \
37+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
41--
422.12.2
43
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0025-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta/recipes-devtools/gcc/gcc-7.3/0025-Use-the-multilib-config-files-from-B-instead-of-usin.patch
new file mode 100644
index 0000000000..b234132317
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0025-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,102 @@
1From ac50dc3010a66220ad483c09efe270bb3f4c9424 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 25/47] Use the multilib config files from ${B} instead of
5 using the ones from ${S}
6
7Use the multilib config files from ${B} instead of using the ones from ${S}
8so that the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
13
14Upstream-Status: Inappropriate [configuration]
15---
16 gcc/configure | 22 ++++++++++++++++++----
17 gcc/configure.ac | 22 ++++++++++++++++++----
18 2 files changed, 36 insertions(+), 8 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index 08b2f63c7fa..6ba391ed068 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -12130,10 +12130,20 @@ done
25 tmake_file_=
26 for f in ${tmake_file}
27 do
28- if test -f ${srcdir}/config/$f
29- then
30- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31- fi
32+ case $f in
33+ */t-linux64 )
34+ if test -f ./config/$f
35+ then
36+ tmake_file_="${tmake_file_} ./config/$f"
37+ fi
38+ ;;
39+ * )
40+ if test -f ${srcdir}/config/$f
41+ then
42+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
43+ fi
44+ ;;
45+ esac
46 done
47 tmake_file="${tmake_file_}"
48
49@@ -12144,6 +12154,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 0581fe963dc..8551a412df3 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -1902,10 +1902,20 @@ done
65 tmake_file_=
66 for f in ${tmake_file}
67 do
68- if test -f ${srcdir}/config/$f
69- then
70- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71- fi
72+ case $f in
73+ */t-linux64 )
74+ if test -f ./config/$f
75+ then
76+ tmake_file_="${tmake_file_} ./config/$f"
77+ fi
78+ ;;
79+ * )
80+ if test -f ${srcdir}/config/$f
81+ then
82+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
83+ fi
84+ ;;
85+ esac
86 done
87 tmake_file="${tmake_file_}"
88
89@@ -1916,6 +1926,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do
92 case $f in
93+ */linux64.h )
94+ tm_file_list="${tm_file_list} ./config/$f"
95+ tm_include_list="${tm_include_list} ./config/$f"
96+ ;;
97 ./* )
98 f=`echo $f | sed 's/^..//'`
99 tm_file_list="${tm_file_list} $f"
100--
1012.12.2
102
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0026-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta/recipes-devtools/gcc/gcc-7.3/0026-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
new file mode 100644
index 0000000000..fe24713474
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0026-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -0,0 +1,31 @@
1From 9fab47d8662986ad887d9eddc39fcbe25e576383 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 26/47] Avoid using libdir from .la which usually points to a
5 host path
6
7Upstream-Status: Inappropriate [embedded specific]
8
9Signed-off-by: Jonathan Liu <net147@gmail.com>
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 ltmain.sh | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/ltmain.sh b/ltmain.sh
16index 0121fba707f..52bdbdb5f9c 100644
17--- a/ltmain.sh
18+++ b/ltmain.sh
19@@ -5628,6 +5628,9 @@ func_mode_link ()
20 absdir="$abs_ladir"
21 libdir="$abs_ladir"
22 else
23+ # Instead of using libdir from .la which usually points to a host path,
24+ # use the path the .la is contained in.
25+ libdir="$abs_ladir"
26 dir="$libdir"
27 absdir="$libdir"
28 fi
29--
302.12.2
31
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0027-export-CPP.patch b/meta/recipes-devtools/gcc/gcc-7.3/0027-export-CPP.patch
new file mode 100644
index 0000000000..4f9e1f0b2e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0027-export-CPP.patch
@@ -0,0 +1,53 @@
1From fa6a46fdf73de7eacd289c084bbde6643b23f73b 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 27/47] 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 b824e0a0ca1..e34e9555388 100644
41--- a/Makefile.in
42+++ b/Makefile.in
43@@ -149,6 +149,7 @@ BUILD_EXPORTS = \
44 AR="$(AR_FOR_BUILD)"; export AR; \
45 AS="$(AS_FOR_BUILD)"; export AS; \
46 CC="$(CC_FOR_BUILD)"; export CC; \
47+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
48 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
49 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
50 CXX="$(CXX_FOR_BUILD)"; export CXX; \
51--
522.12.2
53
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0028-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/meta/recipes-devtools/gcc/gcc-7.3/0028-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
new file mode 100644
index 0000000000..b903349d5d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0028-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
@@ -0,0 +1,56 @@
1From 2c05b4072f982df8002d61327837e18a724e934f Mon Sep 17 00:00:00 2001
2From: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
3Date: Wed, 5 Feb 2014 16:52:31 +0200
4Subject: [PATCH 28/47] Enable SPE & AltiVec generation on powepc*linux target
5
6When is configured with --target=powerpc-linux, the resulting GCC will
7not be able to generate code for SPE targets (e500v1/v2).
8GCC configured with --target=powerpc-linuxspe will not be able to
9generate AltiVec instructions (for e6500).
10This patch modifies the configured file such that SPE or AltiVec code
11can be generated when gcc is configured with --target=powerpc-linux.
12The ABI and speciffic instructions can be selected through the
13"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
14
15Upstream-Status: Inappropriate [configuration]
16
17Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
18---
19 gcc/config.gcc | 9 ++++++++-
20 gcc/config/rs6000/linuxspe.h | 3 ---
21 2 files changed, 8 insertions(+), 4 deletions(-)
22
23diff --git a/gcc/config.gcc b/gcc/config.gcc
24index 5e45f4b5199..9b381dfd9af 100644
25--- a/gcc/config.gcc
26+++ b/gcc/config.gcc
27@@ -2415,7 +2415,14 @@ powerpc-*-rtems*)
28 tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
29 ;;
30 powerpc*-*-linux*)
31- tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
32+ case ${target} in
33+ powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
34+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
35+ ;;
36+ *)
37+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h"
38+ ;;
39+ esac
40 extra_options="${extra_options} rs6000/sysv4.opt"
41 tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm"
42 extra_objs="$extra_objs rs6000-linux.o"
43diff --git a/gcc/config/rs6000/linuxspe.h b/gcc/config/rs6000/linuxspe.h
44index 92efabfe664..6d486451a7e 100644
45--- a/gcc/config/rs6000/linuxspe.h
46+++ b/gcc/config/rs6000/linuxspe.h
47@@ -27,6 +27,3 @@
48 #undef TARGET_DEFAULT
49 #define TARGET_DEFAULT MASK_STRICT_ALIGN
50 #endif
51-
52-#undef ASM_DEFAULT_SPEC
53-#define ASM_DEFAULT_SPEC "-mppc -mspe -me500"
54--
552.12.2
56
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0029-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch b/meta/recipes-devtools/gcc/gcc-7.3/0029-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
new file mode 100644
index 0000000000..7306a282b5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0029-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
@@ -0,0 +1,42 @@
1From ec0f843b86c0f76bc5ebb20fafbc4aae1be4db61 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:21:55 +0000
4Subject: [PATCH 29/47] Disable the MULTILIB_OSDIRNAMES and other multilib
5 options.
6
7Hard coding the MULTILIB_OSDIRNAMES with ../lib64 is causing problems on
8systems where the libdir is NOT set to /lib64. This is allowed by the
9ABI, as
10long as the dynamic loader is present in /lib.
11
12We simply want to use the default rules in gcc to find and configure the
13normal libdir.
14
15Upstream-Status: Inappropriate[OE-Specific]
16
17Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/config/aarch64/t-aarch64-linux | 8 ++++----
21 1 file changed, 4 insertions(+), 4 deletions(-)
22
23diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
24index ab064ab6f22..f4b1f98b216 100644
25--- a/gcc/config/aarch64/t-aarch64-linux
26+++ b/gcc/config/aarch64/t-aarch64-linux
27@@ -21,8 +21,8 @@
28 LIB1ASMSRC = aarch64/lib1funcs.asm
29 LIB1ASMFUNCS = _aarch64_sync_cache_range
30
31-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
32-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
33-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
34+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
35+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
36+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
37
38-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
39+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
40--
412.12.2
42
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch b/meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch
new file mode 100644
index 0000000000..568ba95ea6
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch
@@ -0,0 +1,98 @@
1From bf5836989e0ffc1c1df1369df06877e96c08df41 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 30/47] Ensure target gcc headers can be included
5
6There are a few headers installed as part of the OpenEmbedded
7gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
8built for the target architecture, these are within the target
9sysroot and not cross/nativesdk; thus they weren't able to be
10found by gcc with the existing search paths. Add support for
11picking up these headers under the sysroot supplied on the gcc
12command line in order to resolve this.
13
14Upstream-Status: Pending
15
16Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 gcc/Makefile.in | 2 ++
20 gcc/cppdefault.c | 4 ++++
21 gcc/defaults.h | 9 +++++++++
22 gcc/gcc.c | 7 -------
23 4 files changed, 15 insertions(+), 7 deletions(-)
24
25diff --git a/gcc/Makefile.in b/gcc/Makefile.in
26index 23cca7f0d5a..95d21effad3 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -608,6 +608,7 @@ libexecdir = @libexecdir@
30
31 # Directory in which the compiler finds libraries etc.
32 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
33+libsubdir_target = gcc/$(target_noncanonical)/$(version)
34 # Directory in which the compiler finds executables
35 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
36 # Directory in which all plugin resources are installed
37@@ -2791,6 +2792,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
38
39 PREPROCESSOR_DEFINES = \
40 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
41+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
42 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
43 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
44 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
45diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
46index 10b96eca0a7..c8da0884872 100644
47--- a/gcc/cppdefault.c
48+++ b/gcc/cppdefault.c
49@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[]
50 /* This is the dir for gcc's private headers. */
51 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
52 #endif
53+#ifdef GCC_INCLUDE_SUBDIR_TARGET
54+ /* This is the dir for gcc's private headers under the specified sysroot. */
55+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
56+#endif
57 #ifdef LOCAL_INCLUDE_DIR
58 /* /usr/local/include comes before the fixincluded header files. */
59 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
60diff --git a/gcc/defaults.h b/gcc/defaults.h
61index 7ad92d920f8..39848cc9c0e 100644
62--- a/gcc/defaults.h
63+++ b/gcc/defaults.h
64@@ -1475,4 +1475,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
65 #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
66 #endif
67
68+/* Default prefixes to attach to command names. */
69+
70+#ifndef STANDARD_STARTFILE_PREFIX_1
71+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
72+#endif
73+#ifndef STANDARD_STARTFILE_PREFIX_2
74+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
75+#endif
76+
77 #endif /* ! GCC_DEFAULTS_H */
78diff --git a/gcc/gcc.c b/gcc/gcc.c
79index c73d4023987..b27245dbf77 100644
80--- a/gcc/gcc.c
81+++ b/gcc/gcc.c
82@@ -1472,13 +1472,6 @@ static const char *gcc_libexec_prefix;
83
84 /* Default prefixes to attach to command names. */
85
86-#ifndef STANDARD_STARTFILE_PREFIX_1
87-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
88-#endif
89-#ifndef STANDARD_STARTFILE_PREFIX_2
90-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
91-#endif
92-
93 #ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
94 #undef MD_EXEC_PREFIX
95 #undef MD_STARTFILE_PREFIX
96--
972.12.2
98
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0031-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch b/meta/recipes-devtools/gcc/gcc-7.3/0031-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
new file mode 100644
index 0000000000..0184010f04
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0031-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
@@ -0,0 +1,54 @@
1From c7b4d957edda955fbe405fd5295846614529f517 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 11:17:19 +0000
4Subject: [PATCH 31/47] gcc 4.8+ won't build with --disable-dependency-tracking
5
6since the *.Ppo files don't get created unless --enable-dependency-tracking is true.
7
8This patch ensures we only use those compiler options when its enabled.
9
10Upstream-Status: Submitted
11
12(Problem was already reported upstream, attached this patch there
13http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
14
15RP
162012/09/22
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 libatomic/Makefile.am | 3 ++-
21 libatomic/Makefile.in | 3 ++-
22 2 files changed, 4 insertions(+), 2 deletions(-)
23
24diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
25index d731406fdbd..2fafc72d2e7 100644
26--- a/libatomic/Makefile.am
27+++ b/libatomic/Makefile.am
28@@ -101,7 +101,8 @@ PAT_S = $(word 3,$(PAT_SPLIT))
29 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
30 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
31
32-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
33+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
34+@AMDEP_FALSE@M_DEPS =
35 M_SIZE = -DN=$(PAT_N)
36 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
37 M_FILE = $(PAT_BASE)_n.c
38diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
39index f6eeab312ea..3f06a894058 100644
40--- a/libatomic/Makefile.in
41+++ b/libatomic/Makefile.in
42@@ -331,7 +331,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
43 PAT_S = $(word 3,$(PAT_SPLIT))
44 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
45 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
46-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
47+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
48+@AMDEP_FALSE@M_DEPS =
49 M_SIZE = -DN=$(PAT_N)
50 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
51 M_FILE = $(PAT_BASE)_n.c
52--
532.12.2
54
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0032-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta/recipes-devtools/gcc/gcc-7.3/0032-Don-t-search-host-directory-during-relink-if-inst_pr.patch
new file mode 100644
index 0000000000..e8905f5255
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0032-Don-t-search-host-directory-during-relink-if-inst_pr.patch
@@ -0,0 +1,38 @@
1From 3be6b766a5881b0b187c3c3c68250a9e4f7c0fa3 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 32/47] Don't search host directory during "relink" if
5 $inst_prefix is provided
6
7http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html
8
9Upstream-Status: Submitted
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 ltmain.sh | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/ltmain.sh b/ltmain.sh
17index 52bdbdb5f9c..82bcec39f05 100644
18--- a/ltmain.sh
19+++ b/ltmain.sh
20@@ -6004,12 +6004,13 @@ func_mode_link ()
21 fi
22 else
23 # We cannot seem to hardcode it, guess we'll fake it.
24+ # Default if $libdir is not relative to the prefix:
25 add_dir="-L$libdir"
26- # Try looking first in the location we're being installed to.
27+
28 if test -n "$inst_prefix_dir"; then
29 case $libdir in
30 [\\/]*)
31- add_dir="$add_dir -L$inst_prefix_dir$libdir"
32+ add_dir="-L$inst_prefix_dir$libdir"
33 ;;
34 esac
35 fi
36--
372.12.2
38
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0033-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/meta/recipes-devtools/gcc/gcc-7.3/0033-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
new file mode 100644
index 0000000000..c0b8df3e71
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0033-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
@@ -0,0 +1,29 @@
1From 6edcab9046b862cbb9b46892fc390ce69976539c 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 33/47] Use SYSTEMLIBS_DIR replacement instead of hardcoding
5 base_libdir
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9Upstream-Status: Inappropriate [OE-Specific]
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 c45fc1d35d1..a7afe197266 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"
27--
282.12.2
29
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0034-aarch64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc-7.3/0034-aarch64-Add-support-for-musl-ldso.patch
new file mode 100644
index 0000000000..7d866d9064
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0034-aarch64-Add-support-for-musl-ldso.patch
@@ -0,0 +1,28 @@
1From b140d6839cfba9cac892bc736d984540552d6a56 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 34/47] aarch64: Add support for musl ldso
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Inappropriate [OE-Specific]
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 a7afe197266..580c2c7ea15 100644
15--- a/gcc/config/aarch64/aarch64-linux.h
16+++ b/gcc/config/aarch64/aarch64-linux.h
17@@ -24,7 +24,7 @@
18 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
19
20 #undef MUSL_DYNAMIC_LINKER
21-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
22+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
23
24 #undef ASAN_CC1_SPEC
25 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
26--
272.12.2
28
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0035-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta/recipes-devtools/gcc/gcc-7.3/0035-libcc1-fix-libcc1-s-install-path-and-rpath.patch
new file mode 100644
index 0000000000..e2c1956d1d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0035-libcc1-fix-libcc1-s-install-path-and-rpath.patch
@@ -0,0 +1,54 @@
1From 63617f2da153db10fa2fe938cce31bee01d47fe8 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 35/47] 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 5e61a92a26b..e8b627f9cec 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 54babb02a49..e51d87ffdce 100644
39--- a/libcc1/Makefile.in
40+++ b/libcc1/Makefile.in
41@@ -303,8 +303,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
42 $(Wc)$(libiberty_normal)))
43
44 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
45-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
46-cc1libdir = $(libdir)/$(libsuffix)
47+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
48+plugindir = $(cc1libdir)
49 @ENABLE_PLUGIN_TRUE@plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
50 @ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la
51 BUILT_SOURCES = c-compiler-name.h cp-compiler-name.h
52--
532.12.2
54
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0036-handle-sysroot-support-for-nativesdk-gcc.patch b/meta/recipes-devtools/gcc/gcc-7.3/0036-handle-sysroot-support-for-nativesdk-gcc.patch
new file mode 100644
index 0000000000..aa0b108275
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0036-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -0,0 +1,213 @@
1From ca14820ae834a62ef2b80b283e8f900714636272 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 36/47] handle sysroot support for nativesdk-gcc
5
6Being able to build a nativesdk gcc is useful, particularly in cases
7where the host compiler may be of an incompatible version (or a 32
8bit compiler is needed).
9
10Sadly, building nativesdk-gcc is not straight forward. We install
11nativesdk-gcc into a relocatable location and this means that its
12library locations can change. "Normal" sysroot support doesn't help
13in this case since the values of paths like "libdir" change, not just
14base root directory of the system.
15
16In order to handle this we do two things:
17
18a) Add %r into spec file markup which can be used for injected paths
19 such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
20b) Add other paths which need relocation into a .gccrelocprefix section
21 which the relocation code will notice and adjust automatically.
22
23Upstream-Status: Inappropriate
24RP 2015/7/28
25
26Signed-off-by: Khem Raj <raj.khem@gmail.com>
27---
28 gcc/cppdefault.c | 50 +++++++++++++++++++++++++++++++++++++-------------
29 gcc/cppdefault.h | 3 ++-
30 gcc/gcc.c | 20 ++++++++++++++------
31 3 files changed, 53 insertions(+), 20 deletions(-)
32
33diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
34index c8da0884872..43dc597a0c3 100644
35--- a/gcc/cppdefault.c
36+++ b/gcc/cppdefault.c
37@@ -35,6 +35,30 @@
38 # undef CROSS_INCLUDE_DIR
39 #endif
40
41+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
42+static char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
43+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
44+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
45+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
46+#ifdef LOCAL_INCLUDE_DIR
47+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
48+#endif
49+#ifdef PREFIX_INCLUDE_DIR
50+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
51+#endif
52+#ifdef FIXED_INCLUDE_DIR
53+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
54+#endif
55+#ifdef CROSS_INCLUDE_DIR
56+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
57+#endif
58+#ifdef TOOL_INCLUDE_DIR
59+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
60+#endif
61+#ifdef NATIVE_SYSTEM_HEADER_DIR
62+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
63+#endif
64+
65 const struct default_include cpp_include_defaults[]
66 #ifdef INCLUDE_DEFAULTS
67 = INCLUDE_DEFAULTS;
68@@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[]
69 = {
70 #ifdef GPLUSPLUS_INCLUDE_DIR
71 /* Pick up GNU C++ generic include files. */
72- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
73+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
74 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
75 #endif
76 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
77 /* Pick up GNU C++ target-dependent include files. */
78- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
79+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
80 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
81 #endif
82 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
83 /* Pick up GNU C++ backward and deprecated include files. */
84- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
85+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
86 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
87 #endif
88 #ifdef GCC_INCLUDE_DIR
89 /* This is the dir for gcc's private headers. */
90- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
91+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
92 #endif
93 #ifdef GCC_INCLUDE_SUBDIR_TARGET
94 /* This is the dir for gcc's private headers under the specified sysroot. */
95- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
96+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
97 #endif
98 #ifdef LOCAL_INCLUDE_DIR
99 /* /usr/local/include comes before the fixincluded header files. */
100- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
101- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
102+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
103+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
104 #endif
105 #ifdef PREFIX_INCLUDE_DIR
106- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
107+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
108 #endif
109 #ifdef FIXED_INCLUDE_DIR
110 /* This is the dir for fixincludes. */
111- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
112+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
113 /* A multilib suffix needs adding if different multilibs use
114 different headers. */
115 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
116@@ -85,16 +109,16 @@ const struct default_include cpp_include_defaults[]
117 #endif
118 #ifdef CROSS_INCLUDE_DIR
119 /* One place the target system's headers might be. */
120- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
121+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
122 #endif
123 #ifdef TOOL_INCLUDE_DIR
124 /* Another place the target system's headers might be. */
125- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
126+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
127 #endif
128 #ifdef NATIVE_SYSTEM_HEADER_DIR
129 /* /usr/include comes dead last. */
130- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
131- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
132+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
133+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
134 #endif
135 { 0, 0, 0, 0, 0, 0 }
136 };
137diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
138index 17bbb0eaef7..a937ec1d187 100644
139--- a/gcc/cppdefault.h
140+++ b/gcc/cppdefault.h
141@@ -33,7 +33,8 @@
142
143 struct default_include
144 {
145- const char *const fname; /* The name of the directory. */
146+ const char *fname; /* The name of the directory. */
147+
148 const char *const component; /* The component containing the directory
149 (see update_path in prefix.c) */
150 const char cplusplus; /* Only look here if we're compiling C++. */
151diff --git a/gcc/gcc.c b/gcc/gcc.c
152index b27245dbf77..e015c77f15f 100644
153--- a/gcc/gcc.c
154+++ b/gcc/gcc.c
155@@ -247,6 +247,8 @@ FILE *report_times_to_file = NULL;
156 #endif
157 static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
158
159+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
160+
161 /* Nonzero means pass the updated target_system_root to the compiler. */
162
163 static int target_system_root_changed;
164@@ -518,6 +520,7 @@ or with constant text in a single argument.
165 %G process LIBGCC_SPEC as a spec.
166 %R Output the concatenation of target_system_root and
167 target_sysroot_suffix.
168+ %r Output the base path target_relocatable_prefix
169 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
170 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
171 %C process CPP_SPEC as a spec.
172@@ -1495,10 +1498,10 @@ static const char *gcc_libexec_prefix;
173 gcc_exec_prefix is set because, in that case, we know where the
174 compiler has been installed, and use paths relative to that
175 location instead. */
176-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
177-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
178-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
179-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
180+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
181+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
182+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
183+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
184
185 /* For native compilers, these are well-known paths containing
186 components that may be provided by the system. For cross
187@@ -1506,9 +1509,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
188 static const char *md_exec_prefix = MD_EXEC_PREFIX;
189 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
190 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
191-static const char *const standard_startfile_prefix_1
192+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
193 = STANDARD_STARTFILE_PREFIX_1;
194-static const char *const standard_startfile_prefix_2
195+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
196 = STANDARD_STARTFILE_PREFIX_2;
197
198 /* A relative path to be used in finding the location of tools
199@@ -5826,6 +5829,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
200 }
201 break;
202
203+ case 'r':
204+ obstack_grow (&obstack, target_relocatable_prefix,
205+ strlen (target_relocatable_prefix));
206+ break;
207+
208 case 'S':
209 value = do_spec_1 (startfile_spec, 0, NULL);
210 if (value != 0)
211--
2122.12.2
213
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0037-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta/recipes-devtools/gcc/gcc-7.3/0037-Search-target-sysroot-gcc-version-specific-dirs-with.patch
new file mode 100644
index 0000000000..6c85a03f44
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0037-Search-target-sysroot-gcc-version-specific-dirs-with.patch
@@ -0,0 +1,102 @@
1From 16a326bcd126b395b29019072905bae7a5d47500 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 37/47] 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 e015c77f15f..84af5d5a2e1 100644
55--- a/gcc/gcc.c
56+++ b/gcc/gcc.c
57@@ -2533,7 +2533,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@@ -2545,6 +2545,33 @@ for_each_path (const struct path_prefix *paths,
67 /* Look first in MACHINE/VERSION subdirectory. */
68 if (!skip_multi_dir)
69 {
70+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
71+ {
72+ const char *this_multi;
73+ size_t this_multi_len;
74+
75+ if (pl->os_multilib)
76+ {
77+ this_multi = multi_os_dir;
78+ this_multi_len = multi_os_dir_len;
79+ }
80+ else
81+ {
82+ this_multi = multi_dir;
83+ this_multi_len = multi_dir_len;
84+ }
85+
86+ /* Look in multilib MACHINE/VERSION subdirectory first */
87+ if (this_multi_len)
88+ {
89+ memcpy (path + len, this_multi, this_multi_len + 1);
90+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
91+ ret = callback (path, callback_info);
92+ if (ret)
93+ break;
94+ }
95+ }
96+
97 memcpy (path + len, multi_suffix, suffix_len + 1);
98 ret = callback (path, callback_info);
99 if (ret)
100--
1012.12.2
102
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0038-Fix-various-_FOR_BUILD-and-related-variables.patch b/meta/recipes-devtools/gcc/gcc-7.3/0038-Fix-various-_FOR_BUILD-and-related-variables.patch
new file mode 100644
index 0000000000..a226d10d06
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0038-Fix-various-_FOR_BUILD-and-related-variables.patch
@@ -0,0 +1,137 @@
1From 6e7f526e71a76aac3d49ba8f1742fe1b359c1060 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 38/47] 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 e34e9555388..a03740f3f9d 100644
30--- a/Makefile.in
31+++ b/Makefile.in
32@@ -152,6 +152,7 @@ BUILD_EXPORTS = \
33 CPP="$(CC_FOR_BUILD) -E"; export CPP; \
34 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
35 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
36+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
37 CXX="$(CXX_FOR_BUILD)"; export CXX; \
38 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
39 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
40@@ -169,6 +170,9 @@ BUILD_EXPORTS = \
41 # built for the build system to override those in BASE_FLAGS_TO_PASS.
42 EXTRA_BUILD_FLAGS = \
43 CFLAGS="$(CFLAGS_FOR_BUILD)" \
44+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
45+ CPP="$(CC_FOR_BUILD) -E" \
46+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
47 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
48
49 # This is the list of directories to built for the host system.
50@@ -186,6 +190,7 @@ HOST_SUBDIR = @host_subdir@
51 HOST_EXPORTS = \
52 $(BASE_EXPORTS) \
53 CC="$(CC)"; export CC; \
54+ CPP="$(CC) -E"; export CPP; \
55 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
56 CFLAGS="$(CFLAGS)"; export CFLAGS; \
57 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
58@@ -734,6 +739,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 d0fa07005be..953376c658d 100644
68--- a/Makefile.tpl
69+++ b/Makefile.tpl
70@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
71 CC="$(CC_FOR_BUILD)"; export CC; \
72 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
73 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
74+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
75 CXX="$(CXX_FOR_BUILD)"; export CXX; \
76 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
77 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
78@@ -171,6 +172,9 @@ BUILD_EXPORTS = \
79 # built for the build system to override those in BASE_FLAGS_TO_PASS.
80 EXTRA_BUILD_FLAGS = \
81 CFLAGS="$(CFLAGS_FOR_BUILD)" \
82+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
83+ CPP="$(CC_FOR_BUILD) -E" \
84+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
85 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
86
87 # This is the list of directories to built for the host system.
88@@ -188,6 +192,7 @@ HOST_SUBDIR = @host_subdir@
89 HOST_EXPORTS = \
90 $(BASE_EXPORTS) \
91 CC="$(CC)"; export CC; \
92+ CPP="$(CC) -E"; export CPP; \
93 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
94 CFLAGS="$(CFLAGS)"; export CFLAGS; \
95 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
96diff --git a/gcc/Makefile.in b/gcc/Makefile.in
97index 95d21effad3..dbe2bacde50 100644
98--- a/gcc/Makefile.in
99+++ b/gcc/Makefile.in
100@@ -795,7 +795,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 6ba391ed068..72ca6e5c535 100755
111--- a/gcc/configure
112+++ b/gcc/configure
113@@ -11789,7 +11789,7 @@ else
114 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
115 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
116 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
117- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
118+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
119 ${realsrcdir}/configure \
120 --enable-languages=${enable_languages-all} \
121 --target=$target_alias --host=$build_alias --build=$build_alias
122diff --git a/gcc/configure.ac b/gcc/configure.ac
123index 8551a412df3..6eefb61dc2b 100644
124--- a/gcc/configure.ac
125+++ b/gcc/configure.ac
126@@ -1708,7 +1708,7 @@ else
127 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
128 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
129 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
130- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
131+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
132 ${realsrcdir}/configure \
133 --enable-languages=${enable_languages-all} \
134 --target=$target_alias --host=$build_alias --build=$build_alias
135--
1362.12.2
137
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0039-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc-7.3/0039-nios2-Define-MUSL_DYNAMIC_LINKER.patch
new file mode 100644
index 0000000000..a7aeccdf03
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0039-nios2-Define-MUSL_DYNAMIC_LINKER.patch
@@ -0,0 +1,28 @@
1From 6d03ddfb7a092942be6b58b1830f6986d012d5e3 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 39/47] nios2: Define MUSL_DYNAMIC_LINKER
5
6Signed-off-by: Marek Vasut <marex@denx.de>
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9Upstream-Status: Inappropriate [OE-Specific]
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 5177fa641a4..1b8accda6ee 100644
16--- a/gcc/config/nios2/linux.h
17+++ b/gcc/config/nios2/linux.h
18@@ -30,6 +30,7 @@
19 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
20
21 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
22+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1"
23
24 #undef LINK_SPEC
25 #define LINK_SPEC LINK_SPEC_ENDIAN \
26--
272.12.2
28
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta/recipes-devtools/gcc/gcc-7.3/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
new file mode 100644
index 0000000000..29b7ce72d2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -0,0 +1,87 @@
1From 210f6b3b82084cc756e02b8bc12f909a43b14ee8 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 40/49] 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 2e683d0c430..1b4df798671 100644
27--- a/gcc/config/linux.h
28+++ b/gcc/config/linux.h
29@@ -182,6 +182,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
30 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
31 { 0, 0, 0, 0, 0, 0 } \
32 }
33+#ifdef TARGET_LIBC_PROVIDES_SSP
34+#undef LINK_SSP_SPEC
35+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
36+ "|fstack-protector-strong|fstack-protector-explicit" \
37+ ":-lssp_nonshared}"
38+#endif
39+
40 #endif
41
42 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
43diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
44index 684afd6c190..22cfa391b89 100644
45--- a/gcc/config/rs6000/linux.h
46+++ b/gcc/config/rs6000/linux.h
47@@ -91,6 +91,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 %{rdynamic:-export-dynamic} \
64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
65index 3b00ec0fcf0..8371f8d7b6b 100644
66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h
68@@ -465,6 +465,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 %{rdynamic:-export-dynamic} \
84 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
85--
862.13.2
87
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0041-gcc-libcpp-support-ffile-prefix-map-old-new.patch b/meta/recipes-devtools/gcc/gcc-7.3/0041-gcc-libcpp-support-ffile-prefix-map-old-new.patch
new file mode 100644
index 0000000000..5260e363d2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0041-gcc-libcpp-support-ffile-prefix-map-old-new.patch
@@ -0,0 +1,284 @@
1From 4eadc99bdd0974761bf48f0fd32994dd9a3ffcfe Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 16 Mar 2016 02:27:43 -0400
4Subject: [PATCH 41/47] gcc/libcpp: support -ffile-prefix-map=<old>=<new>
5
6Similar -fdebug-prefix-map, add option -ffile-prefix-map to map one
7directory name (old) to another (new) in __FILE__, __BASE_FILE__ and
8__builtin_FILE ().
9
10https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268
11
12Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 gcc/c-family/c-opts.c | 13 +++++++
16 gcc/c-family/c.opt | 4 +++
17 gcc/dwarf2out.c | 1 +
18 gcc/gimplify.c | 2 ++
19 libcpp/Makefile.in | 10 +++---
20 libcpp/file-map.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++
21 libcpp/include/file-map.h | 30 ++++++++++++++++
22 libcpp/macro.c | 2 ++
23 8 files changed, 149 insertions(+), 5 deletions(-)
24 create mode 100644 libcpp/file-map.c
25 create mode 100644 libcpp/include/file-map.h
26
27diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
28index ea0e01b101c..a741c75a78f 100644
29--- a/gcc/c-family/c-opts.c
30+++ b/gcc/c-family/c-opts.c
31@@ -39,6 +39,14 @@ along with GCC; see the file COPYING3. If not see
32 #include "opts.h"
33 #include "plugin.h" /* For PLUGIN_INCLUDE_FILE event. */
34 #include "mkdeps.h"
35+#include "file-map.h"
36+#include "c-target.h"
37+#include "tm.h" /* For BYTES_BIG_ENDIAN,
38+ DOLLARS_IN_IDENTIFIERS,
39+ STDC_0_IN_SYSTEM_HEADERS,
40+ TARGET_FLT_EVAL_METHOD_NON_DEFAULT and
41+ TARGET_OPTF. */
42+#include "tm_p.h" /* For C_COMMON_OVERRIDE_OPTIONS. */
43 #include "dumpfile.h"
44
45 #ifndef DOLLARS_IN_IDENTIFIERS
46@@ -517,6 +525,11 @@ c_common_handle_option (size_t scode, const char *arg, int value,
47 cpp_opts->narrow_charset = arg;
48 break;
49
50+ case OPT_ffile_prefix_map_:
51+ if (add_file_prefix_map (arg) < 0)
52+ error ("invalid argument %qs to -ffile-prefix-map", arg);
53+ break;
54+
55 case OPT_fwide_exec_charset_:
56 cpp_opts->wide_charset = arg;
57 break;
58diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
59index c4ef7796282..73333dfd57c 100644
60--- a/gcc/c-family/c.opt
61+++ b/gcc/c-family/c.opt
62@@ -1372,6 +1372,10 @@ fexec-charset=
63 C ObjC C++ ObjC++ Joined RejectNegative
64 -fexec-charset=<cset> Convert all strings and character constants to character set <cset>.
65
66+ffile-prefix-map=
67+C ObjC C++ ObjC++ Joined RejectNegative
68+-ffile-prefix-map=<old=new> Map one directory name to another in __FILE__, __BASE_FILE__ and __builtin_FILE ()
69+
70 fextended-identifiers
71 C ObjC C++ ObjC++
72 Permit universal character names (\\u and \\U) in identifiers.
73diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
74index 98c51576ec2..762f69ae88e 100644
75--- a/gcc/dwarf2out.c
76+++ b/gcc/dwarf2out.c
77@@ -23421,6 +23421,7 @@ gen_producer_string (void)
78 case OPT_fltrans_output_list_:
79 case OPT_fresolution_:
80 case OPT_fdebug_prefix_map_:
81+ case OPT_ffile_prefix_map_:
82 /* Ignore these. */
83 continue;
84 default:
85diff --git a/gcc/gimplify.c b/gcc/gimplify.c
86index fd27eb1523f..5542b379f28 100644
87--- a/gcc/gimplify.c
88+++ b/gcc/gimplify.c
89@@ -58,6 +58,8 @@ along with GCC; see the file COPYING3. If not see
90 #include "gomp-constants.h"
91 #include "tree-dump.h"
92 #include "gimple-walk.h"
93+#include "file-map.h"
94+
95 #include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name */
96 #include "builtins.h"
97 #include "asan.h"
98diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
99index 0bd3787c25e..d3b52956b52 100644
100--- a/libcpp/Makefile.in
101+++ b/libcpp/Makefile.in
102@@ -84,12 +84,12 @@ DEPMODE = $(CXXDEPMODE)
103
104
105 libcpp_a_OBJS = charset.o directives.o directives-only.o errors.o \
106- expr.o files.o identifiers.o init.o lex.o line-map.o macro.o \
107- mkdeps.o pch.o symtab.o traditional.o
108+ expr.o file-map.o files.o identifiers.o init.o lex.o line-map.o \
109+ macro.o mkdeps.o pch.o symtab.o traditional.o
110
111 libcpp_a_SOURCES = charset.c directives.c directives-only.c errors.c \
112- expr.c files.c identifiers.c init.c lex.c line-map.c macro.c \
113- mkdeps.c pch.c symtab.c traditional.c
114+ expr.c file-map.c files.c identifiers.c init.c lex.c line-map.c \
115+ macro.c mkdeps.c pch.c symtab.c traditional.c
116
117 all: libcpp.a $(USED_CATALOGS)
118
119@@ -263,7 +263,7 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
120
121 TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h ucnid.h \
122 include/line-map.h include/symtab.h include/cpp-id-data.h \
123- include/cpplib.h include/mkdeps.h system.h
124+ include/cpplib.h include/mkdeps.h system.h include/file-map.h
125
126 TAGS: $(TAGS_SOURCES)
127 cd $(srcdir) && etags $(TAGS_SOURCES)
128diff --git a/libcpp/file-map.c b/libcpp/file-map.c
129new file mode 100644
130index 00000000000..18035ef6a72
131--- /dev/null
132+++ b/libcpp/file-map.c
133@@ -0,0 +1,92 @@
134+/* Map one directory name to another in __FILE__, __BASE_FILE__
135+ and __builtin_FILE ().
136+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
137+
138+This program is free software; you can redistribute it and/or modify it
139+under the terms of the GNU General Public License as published by the
140+Free Software Foundation; either version 3, or (at your option) any
141+later version.
142+
143+This program is distributed in the hope that it will be useful,
144+but WITHOUT ANY WARRANTY; without even the implied warranty of
145+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146+GNU General Public License for more details.
147+
148+You should have received a copy of the GNU General Public License
149+along with this program; see the file COPYING3. If not see
150+<http://www.gnu.org/licenses/>.
151+
152+ In other words, you are welcome to use, share and improve this program.
153+ You are forbidden to forbid anyone else to use, share and improve
154+ what you give them. Help stamp out software-hoarding! */
155+
156+#include "config.h"
157+#include "system.h"
158+#include "file-map.h"
159+
160+/* Structure recording the mapping from source file and directory
161+ names at compile time to __FILE__ */
162+typedef struct file_prefix_map
163+{
164+ const char *old_prefix;
165+ const char *new_prefix;
166+ size_t old_len;
167+ size_t new_len;
168+ struct file_prefix_map *next;
169+} file_prefix_map;
170+
171+/* Linked list of such structures. */
172+static file_prefix_map *file_prefix_maps;
173+
174+/* Record prefix mapping of __FILE__. ARG is the argument to
175+ -ffile-prefix-map and must be of the form OLD=NEW. */
176+int
177+add_file_prefix_map (const char *arg)
178+{
179+ file_prefix_map *map;
180+ const char *p;
181+
182+ p = strchr (arg, '=');
183+ if (!p)
184+ {
185+ fprintf(stderr, "invalid argument %qs to -ffile-prefix-map", arg);
186+ return -1;
187+ }
188+ map = XNEW (file_prefix_map);
189+ map->old_prefix = xstrndup (arg, p - arg);
190+ map->old_len = p - arg;
191+ p++;
192+ map->new_prefix = xstrdup (p);
193+ map->new_len = strlen (p);
194+ map->next = file_prefix_maps;
195+ file_prefix_maps = map;
196+
197+ return 0;
198+}
199+
200+/* Perform user-specified mapping of __FILE__ prefixes. Return
201+ the new name corresponding to filename. */
202+
203+const char *
204+remap_file_filename (const char *filename)
205+{
206+ file_prefix_map *map;
207+ char *s;
208+ const char *name;
209+ size_t name_len;
210+
211+ for (map = file_prefix_maps; map; map = map->next)
212+ if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
213+ break;
214+ if (!map)
215+ return filename;
216+ name = filename + map->old_len;
217+ name_len = strlen (name) + 1;
218+ s = (char *) alloca (name_len + map->new_len);
219+ memcpy (s, map->new_prefix, map->new_len);
220+ memcpy (s + map->new_len, name, name_len);
221+
222+ return xstrdup (s);
223+}
224+
225+
226diff --git a/libcpp/include/file-map.h b/libcpp/include/file-map.h
227new file mode 100644
228index 00000000000..87503152d27
229--- /dev/null
230+++ b/libcpp/include/file-map.h
231@@ -0,0 +1,30 @@
232+/* Map one directory name to another in __FILE__, __BASE_FILE__
233+ and __builtin_FILE ().
234+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
235+
236+This program is free software; you can redistribute it and/or modify it
237+under the terms of the GNU General Public License as published by the
238+Free Software Foundation; either version 3, or (at your option) any
239+later version.
240+
241+This program is distributed in the hope that it will be useful,
242+but WITHOUT ANY WARRANTY; without even the implied warranty of
243+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
244+GNU General Public License for more details.
245+
246+You should have received a copy of the GNU General Public License
247+along with this program; see the file COPYING3. If not see
248+<http://www.gnu.org/licenses/>.
249+
250+ In other words, you are welcome to use, share and improve this program.
251+ You are forbidden to forbid anyone else to use, share and improve
252+ what you give them. Help stamp out software-hoarding! */
253+
254+#ifndef LIBCPP_FILE_MAP_H
255+#define LIBCPP_FILE_MAP_H
256+
257+const char * remap_file_filename (const char *filename);
258+
259+int add_file_prefix_map (const char *arg);
260+
261+#endif /* !LIBCPP_FILE_MAP_H */
262diff --git a/libcpp/macro.c b/libcpp/macro.c
263index de18c2210cf..2748c70d520 100644
264--- a/libcpp/macro.c
265+++ b/libcpp/macro.c
266@@ -26,6 +26,7 @@ along with this program; see the file COPYING3. If not see
267 #include "system.h"
268 #include "cpplib.h"
269 #include "internal.h"
270+#include "file-map.h"
271
272 typedef struct macro_arg macro_arg;
273 /* This structure represents the tokens of a macro argument. These
274@@ -301,6 +302,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node,
275 if (!name)
276 abort ();
277 }
278+ name = remap_file_filename (name);
279 len = strlen (name);
280 buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
281 result = buf;
282--
2832.12.2
284
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0042-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch b/meta/recipes-devtools/gcc/gcc-7.3/0042-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
new file mode 100644
index 0000000000..524716790f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0042-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
@@ -0,0 +1,43 @@
1From ddddc7335539fb8a6d30beba21781762df159186 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 16 Mar 2016 05:39:59 -0400
4Subject: [PATCH 42/47] Reuse -fdebug-prefix-map to replace -ffile-prefix-map
5
6The oe-core may use external toolchain to compile,
7which may not support -ffile-prefix-map.
8
9Since we use -fdebug-prefix-map to do the same thing,
10so we could reuse it to replace -ffile-prefix-map.
11
12Upstream-Status: Inappropriate[oe-core specific]
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 gcc/opts-global.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/gcc/opts-global.c b/gcc/opts-global.c
20index 50bad77c347..32b1d286721 100644
21--- a/gcc/opts-global.c
22+++ b/gcc/opts-global.c
23@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
24 #include "langhooks.h"
25 #include "dbgcnt.h"
26 #include "debug.h"
27+#include "file-map.h"
28 #include "output.h"
29 #include "plugin.h"
30 #include "toplev.h"
31@@ -357,6 +358,9 @@ handle_common_deferred_options (void)
32
33 case OPT_fdebug_prefix_map_:
34 add_debug_prefix_map (opt->arg);
35+
36+ /* Reuse -fdebug-prefix-map to replace -ffile-prefix-map */
37+ add_file_prefix_map (opt->arg);
38 break;
39
40 case OPT_fdump_:
41--
422.12.2
43
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0043-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch b/meta/recipes-devtools/gcc/gcc-7.3/0043-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch
new file mode 100644
index 0000000000..74a5c86446
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0043-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch
@@ -0,0 +1,54 @@
1From 5bc97be388485a5f8dd85db34372a1299bffd263 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 24 Mar 2016 11:23:14 -0400
4Subject: [PATCH 43/47] gcc/final.c: -fdebug-prefix-map support to remap
5 sources with relative path
6
7PR other/70428
8* final.c (remap_debug_filename): Use lrealpath to translate
9relative path before remapping
10
11https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428
12Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 gcc/final.c | 15 ++++++++++++---
17 1 file changed, 12 insertions(+), 3 deletions(-)
18
19diff --git a/gcc/final.c b/gcc/final.c
20index 820162b2d28..d74cb901abd 100644
21--- a/gcc/final.c
22+++ b/gcc/final.c
23@@ -1559,16 +1559,25 @@ remap_debug_filename (const char *filename)
24 const char *name;
25 size_t name_len;
26
27+ /* Support to remap filename with relative path */
28+ char *realpath = lrealpath (filename);
29+ if (realpath == NULL)
30+ return filename;
31+
32 for (map = debug_prefix_maps; map; map = map->next)
33- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
34+ if (filename_ncmp (realpath, map->old_prefix, map->old_len) == 0)
35 break;
36 if (!map)
37- return filename;
38- name = filename + map->old_len;
39+ {
40+ free (realpath);
41+ return filename;
42+ }
43+ name = realpath + map->old_len;
44 name_len = strlen (name) + 1;
45 s = (char *) alloca (name_len + map->new_len);
46 memcpy (s, map->new_prefix, map->new_len);
47 memcpy (s + map->new_len, name, name_len);
48+ free (realpath);
49 return ggc_strdup (s);
50 }
51
52--
532.12.2
54
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
new file mode 100644
index 0000000000..e39af9b1aa
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
@@ -0,0 +1,124 @@
1From 847aec764540636ec654fd7a012e271afa8d4e0f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Apr 2016 20:03:28 +0000
4Subject: [PATCH 44/47] libgcc: Add knob to use ldbl-128 on ppc
5
6musl does not support ldbl 128 so we can not assume
7that linux as a whole supports ldbl-128 bits, instead
8act upon configure option passed to gcc and assume no
9on musl and yes otherwise if no option is passed since
10default behaviour is to assume ldbl128 it does not
11change the defaults
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14Upstream-Status: Pending
15---
16 libgcc/Makefile.in | 1 +
17 libgcc/config/rs6000/t-linux | 5 ++++-
18 libgcc/configure | 18 ++++++++++++++++++
19 libgcc/configure.ac | 12 ++++++++++++
20 4 files changed, 35 insertions(+), 1 deletion(-)
21 mode change 100644 => 100755 libgcc/configure
22
23diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
24index a1a392de88d..2fe6889a342 100644
25--- a/libgcc/Makefile.in
26+++ b/libgcc/Makefile.in
27@@ -48,6 +48,7 @@ unwind_header = @unwind_header@
28 md_unwind_header = @md_unwind_header@
29 sfp_machine_header = @sfp_machine_header@
30 thread_header = @thread_header@
31+with_ldbl128 = @with_ldbl128@
32
33 host_noncanonical = @host_noncanonical@
34 real_host_noncanonical = @real_host_noncanonical@
35diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
36index 4f6d4c4a4d2..c50dd94a2da 100644
37--- a/libgcc/config/rs6000/t-linux
38+++ b/libgcc/config/rs6000/t-linux
39@@ -1,3 +1,6 @@
40 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
41
42-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
43+ifeq ($(with_ldbl128),yes)
44+HOST_LIBGCC2_CFLAGS += -mlong-double-128
45+endif
46+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
47diff --git a/libgcc/configure b/libgcc/configure
48old mode 100644
49new mode 100755
50index 45c459788c3..e2d19b144b8
51--- a/libgcc/configure
52+++ b/libgcc/configure
53@@ -618,6 +618,7 @@ build_vendor
54 build_cpu
55 build
56 with_aix_soname
57+with_ldbl128
58 enable_vtable_verify
59 enable_shared
60 libgcc_topdir
61@@ -667,6 +668,7 @@ with_cross_host
62 with_ld
63 enable_shared
64 enable_vtable_verify
65+with_long_double_128
66 with_aix_soname
67 enable_version_specific_runtime_libs
68 with_slibdir
69@@ -1324,6 +1326,7 @@ Optional Packages:
70 --with-target-subdir=SUBDIR Configuring in a subdirectory for target
71 --with-cross-host=HOST Configuring with a cross compiler
72 --with-ld arrange to use the specified ld (full pathname)
73+ --with-long-double-128 use 128-bit long double by default
74 --with-aix-soname=aix|svr4|both
75 shared library versioning (aka "SONAME") variant to
76 provide on AIX
77@@ -2208,6 +2211,21 @@ fi
78
79
80
81+# Check whether --with-long-double-128 was given.
82+if test "${with_long_double_128+set}" = set; then :
83+ withval=$with_long_double_128; with_ldbl128="$with_long_double_128"
84+else
85+ case "${host}" in
86+ power*-*-musl*)
87+ with_ldbl128="no";;
88+ *) with_ldbl128="yes";;
89+ esac
90+
91+fi
92+
93+
94+
95+
96 # Check whether --with-aix-soname was given.
97 if test "${with_aix_soname+set}" = set; then :
98 withval=$with_aix_soname; case "${host}:${enable_shared}" in
99diff --git a/libgcc/configure.ac b/libgcc/configure.ac
100index af151473709..dada52416da 100644
101--- a/libgcc/configure.ac
102+++ b/libgcc/configure.ac
103@@ -77,6 +77,18 @@ AC_ARG_ENABLE(vtable-verify,
104 [enable_vtable_verify=no])
105 AC_SUBST(enable_vtable_verify)
106
107+AC_ARG_WITH(long-double-128,
108+[AS_HELP_STRING([--with-long-double-128],
109+ [use 128-bit long double by default])],
110+ with_ldbl128="$with_long_double_128",
111+[case "${host}" in
112+ power*-*-musl*)
113+ with_ldbl128="no";;
114+ *) with_ldbl128="yes";;
115+ esac
116+])
117+AC_SUBST(with_ldbl128)
118+
119 AC_ARG_WITH(aix-soname,
120 [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
121 [shared library versioning (aka "SONAME") variant to provide on AIX])],
122--
1232.12.2
124
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0045-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch b/meta/recipes-devtools/gcc/gcc-7.3/0045-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
new file mode 100644
index 0000000000..3aa038c913
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0045-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
@@ -0,0 +1,29 @@
1From 92beb883ab57a23a35ba76c496bc1f4cabb1690e 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 45/47] 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 76be7710960..a1ee2ee26ed 100644
16--- a/libgcc/config/t-slibgcc
17+++ b/libgcc/config/t-slibgcc
18@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
19 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
20
21 SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
22- $(SHLIB_LDFLAGS) \
23+ $(LDFLAGS) $(SHLIB_LDFLAGS) \
24 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
25 $(SHLIB_OBJS) $(SHLIB_LC) && \
26 rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
27--
282.12.2
29
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0046-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta/recipes-devtools/gcc/gcc-7.3/0046-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
new file mode 100644
index 0000000000..f6b2829364
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0046-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -0,0 +1,85 @@
1From c7bce03a625fe2215a13f520850604178103ddd7 Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH 46/47] 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.c (ix86_expand_builtin): Make __builtin_cpu_init
30 call __cpu_indicator_init_local instead of __cpu_indicator_init.
31
32Signed-off-by: Khem Raj <raj.khem@gmail.com>
33---
34Upstream-Status: Pending
35
36 gcc/config/i386/i386.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.c b/gcc/config/i386/i386.c
42index dec3aee0048..0452dcfcb8d 100644
43--- a/gcc/config/i386/i386.c
44+++ b/gcc/config/i386/i386.c
45@@ -36918,10 +36918,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 a1dc011525f..dac5e889abf 100644
60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -391,7 +391,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 11bb46e0ee4..4f47f7bfa59 100644
75--- a/libgcc/config/i386/t-linux
76+++ b/libgcc/config/i386/t-linux
77@@ -3,4 +3,4 @@
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
82+HOST_LIBGCC2_CFLAGS += -mlong-double-80
83--
842.12.2
85
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0047-sync-gcc-stddef.h-with-musl.patch b/meta/recipes-devtools/gcc/gcc-7.3/0047-sync-gcc-stddef.h-with-musl.patch
new file mode 100644
index 0000000000..65d22f169c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0047-sync-gcc-stddef.h-with-musl.patch
@@ -0,0 +1,91 @@
1From 9b951c8f6b0aaff7c16dc4db72b5e56ec73810bb 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 47/47] 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
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11Upstream-Status: Inappropriate [OE-Specific]
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 872f451cac9..7e90938387c 100644
18--- a/gcc/ginclude/stddef.h
19+++ b/gcc/ginclude/stddef.h
20@@ -134,6 +134,7 @@ _TYPE_wchar_t;
21 #ifndef ___int_ptrdiff_t_h
22 #ifndef _GCC_PTRDIFF_T
23 #ifndef _PTRDIFF_T_DECLARED /* DragonFly */
24+#ifndef __DEFINED_ptrdiff_t /* musl */
25 #define _PTRDIFF_T
26 #define _T_PTRDIFF_
27 #define _T_PTRDIFF
28@@ -143,10 +144,12 @@ _TYPE_wchar_t;
29 #define ___int_ptrdiff_t_h
30 #define _GCC_PTRDIFF_T
31 #define _PTRDIFF_T_DECLARED
32+#define __DEFINED_ptrdiff_t /* musl */
33 #ifndef __PTRDIFF_TYPE__
34 #define __PTRDIFF_TYPE__ long int
35 #endif
36 typedef __PTRDIFF_TYPE__ ptrdiff_t;
37+#endif /* __DEFINED_ptrdiff_t */
38 #endif /* _PTRDIFF_T_DECLARED */
39 #endif /* _GCC_PTRDIFF_T */
40 #endif /* ___int_ptrdiff_t_h */
41@@ -184,6 +187,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
42 #ifndef _GCC_SIZE_T
43 #ifndef _SIZET_
44 #ifndef __size_t
45+#ifndef __DEFINED_size_t /* musl */
46 #define __size_t__ /* BeOS */
47 #define __SIZE_T__ /* Cray Unicos/Mk */
48 #define _SIZE_T
49@@ -200,6 +204,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
50 #define ___int_size_t_h
51 #define _GCC_SIZE_T
52 #define _SIZET_
53+#define __DEFINED_size_t /* musl */
54 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
55 || defined(__DragonFly__) \
56 || defined(__FreeBSD_kernel__)
57@@ -235,6 +240,7 @@ typedef long ssize_t;
58 #endif /* _SIZE_T */
59 #endif /* __SIZE_T__ */
60 #endif /* __size_t__ */
61+#endif /* __DEFINED_size_t */
62 #undef __need_size_t
63 #endif /* _STDDEF_H or __need_size_t. */
64
65@@ -264,6 +270,7 @@ typedef long ssize_t;
66 #ifndef ___int_wchar_t_h
67 #ifndef __INT_WCHAR_T_H
68 #ifndef _GCC_WCHAR_T
69+#ifndef __DEFINED_wchar_t /* musl */
70 #define __wchar_t__ /* BeOS */
71 #define __WCHAR_T__ /* Cray Unicos/Mk */
72 #define _WCHAR_T
73@@ -279,6 +286,7 @@ typedef long ssize_t;
74 #define __INT_WCHAR_T_H
75 #define _GCC_WCHAR_T
76 #define _WCHAR_T_DECLARED
77+#define __DEFINED_wchar_t /* musl */
78
79 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
80 instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
81@@ -344,6 +352,7 @@ typedef __WCHAR_TYPE__ wchar_t;
82 #endif
83 #endif /* __WCHAR_T__ */
84 #endif /* __wchar_t__ */
85+#endif /* __DEFINED_wchar_t musl */
86 #undef __need_wchar_t
87 #endif /* _STDDEF_H or __need_wchar_t. */
88
89--
902.12.2
91
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0048-gcc-Enable-static-PIE.patch b/meta/recipes-devtools/gcc/gcc-7.3/0048-gcc-Enable-static-PIE.patch
new file mode 100644
index 0000000000..a96e91339b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0048-gcc-Enable-static-PIE.patch
@@ -0,0 +1,46 @@
1From 44ef80688b56beea85c0070840dea1e2a4e34aed Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 13 Jun 2017 12:12:52 -0700
4Subject: [PATCH 49/49] gcc: Enable static PIE
5
6Static PIE support in GCC
7see
8https://gcc.gnu.org/ml/gcc/2015-06/msg00008.html
9
10startfiles before patch:
11 -static -> crt1.o crti.o crtbeginT.o
12 -static -PIE -> crt1.o crti.o crtbeginT.o
13
14after patch:
15 -static -> crt1.o crti.o crtbeginT.o
16 -static -PIE -> rcrt1.o crti.o crtbeginS.o
17
18Upstream-Status: Pending
19
20Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
21
22---
23 gcc/config/gnu-user.h | 6 +++---
24 1 file changed, 3 insertions(+), 3 deletions(-)
25
26diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
27index de605b0..b035bbe 100644
28--- a/gcc/config/gnu-user.h
29+++ b/gcc/config/gnu-user.h
30@@ -52,11 +52,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
31 #define GNU_USER_TARGET_STARTFILE_SPEC \
32 "%{shared:; \
33 pg|p|profile:gcrt1.o%s; \
34- static:crt1.o%s; \
35+ static: %{" PIE_SPEC ": rcrt1.o%s; :crt1.o%s}; \
36 " PIE_SPEC ":Scrt1.o%s; \
37 :crt1.o%s} \
38 crti.o%s \
39- %{static:crtbeginT.o%s; \
40+ %{static: %{" PIE_SPEC ": crtbeginS.o%s; :crtbeginT.o%s}; \
41 shared|" PIE_SPEC ":crtbeginS.o%s; \
42 :crtbegin.o%s} \
43 %{fvtable-verify=none:%s; \
44
452.13.1
46
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch b/meta/recipes-devtools/gcc/gcc-7.3/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch
new file mode 100644
index 0000000000..5a14d04b6f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch
@@ -0,0 +1,51 @@
1From 16210e6270e200cd4892a90ecef608906be3a130 Mon Sep 17 00:00:00 2001
2From: Kito Cheng <kito.cheng@gmail.com>
3Date: Thu, 4 May 2017 02:11:13 +0800
4Subject: [PATCH] RISC-V: Handle non-legitimate address in
5 riscv_legitimize_move
6
7GCC may generate non-legitimate address due to we allow some
8load/store with non-legitimate address in pic.md.
9
10 2017-05-12 Kito Cheng <kito.cheng@gmail.com>
11
12 * config/riscv/riscv.c (riscv_legitimize_move): Handle
13 non-legitimate address.
14---
15Upstream-Status: Backport
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17
18 gcc/ChangeLog | 5 +++++
19 gcc/config/riscv/riscv.c | 16 ++++++++++++++++
20 2 files changed, 21 insertions(+)
21
22diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
23index f7fec4bfcf8..d519be1659a 100644
24--- a/gcc/config/riscv/riscv.c
25+++ b/gcc/config/riscv/riscv.c
26@@ -1385,6 +1385,22 @@ riscv_legitimize_move (enum machine_mode mode, rtx dest, rtx src)
27 return true;
28 }
29
30+ /* RISC-V GCC may generate non-legitimate address due to we provide some
31+ pattern for optimize access PIC local symbol and it's make GCC generate
32+ unrecognizable instruction during optmizing. */
33+
34+ if (MEM_P (dest) && !riscv_legitimate_address_p (mode, XEXP (dest, 0),
35+ reload_completed))
36+ {
37+ XEXP (dest, 0) = riscv_force_address (XEXP (dest, 0), mode);
38+ }
39+
40+ if (MEM_P (src) && !riscv_legitimate_address_p (mode, XEXP (src, 0),
41+ reload_completed))
42+ {
43+ XEXP (src, 0) = riscv_force_address (XEXP (src, 0), mode);
44+ }
45+
46 return false;
47 }
48
49--
502.14.2
51
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch b/meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch
new file mode 100644
index 0000000000..c0adef6f2f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch
@@ -0,0 +1,49 @@
1
2Prevent a segmentation fault which occurs when using incorrect
3structure trying to access name of some named operators, such as
4CPP_NOT, CPP_AND etc. "token->val.node.spelling" cannot be used in
5those cases, as is may not be initialized at all.
6
7
8[YOCTO #11738]
9
10Upstream-Status: Pending
11
12Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
13
14diff --git a/libcpp/lex.c b/libcpp/lex.c
15--- a/libcpp/lex.c
16+++ b/libcpp/lex.c
17@@ -3229,11 +3229,27 @@
18 spell_ident:
19 case SPELL_IDENT:
20 if (forstring)
21- {
22- memcpy (buffer, NODE_NAME (token->val.node.spelling),
23- NODE_LEN (token->val.node.spelling));
24- buffer += NODE_LEN (token->val.node.spelling);
25- }
26+ {
27+ if (token->type == CPP_NAME)
28+ {
29+ memcpy (buffer, NODE_NAME (token->val.node.spelling),
30+ NODE_LEN (token->val.node.spelling));
31+ buffer += NODE_LEN (token->val.node.spelling);
32+ break;
33+ }
34+ /* NAMED_OP, cannot use node.spelling */
35+ if (token->flags & NAMED_OP)
36+ {
37+ const char *str = cpp_named_operator2name (token->type);
38+ if (str)
39+ {
40+ size_t len = strlen(str);
41+ memcpy(buffer, str, len);
42+ buffer += len;
43+ }
44+ break;
45+ }
46+ }
47 else
48 buffer = _cpp_spell_ident_ucns (buffer, token->val.node.node);
49 break;