summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-11.2.inc2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch120
-rw-r--r--meta/recipes-devtools/gcc/gcc/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch61
-rw-r--r--meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch56
-rw-r--r--meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch225
-rw-r--r--meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch134
-rw-r--r--meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch28
8 files changed, 374 insertions, 295 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc
index 23dfea2319..8c54fe43df 100644
--- a/meta/recipes-devtools/gcc/gcc-11.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-11.2.inc
@@ -51,7 +51,6 @@ SRC_URI = "\
51 file://0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch \ 51 file://0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
52 file://0024-handle-sysroot-support-for-nativesdk-gcc.patch \ 52 file://0024-handle-sysroot-support-for-nativesdk-gcc.patch \
53 file://0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch \ 53 file://0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
54 file://0026-Fix-various-_FOR_BUILD-and-related-variables.patch \
55 file://0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch \ 54 file://0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
56 file://0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \ 55 file://0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
57 file://0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \ 56 file://0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
@@ -64,6 +63,7 @@ SRC_URI = "\
64 file://0036-mingw32-Enable-operation_not_supported.patch \ 63 file://0036-mingw32-Enable-operation_not_supported.patch \
65 file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \ 64 file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \
66 file://0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch \ 65 file://0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch \
66 file://0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch \
67" 67"
68SRC_URI[sha256sum] = "d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b" 68SRC_URI[sha256sum] = "d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b"
69 69
diff --git a/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
index c921ac3340..b856c5dea3 100644
--- a/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
+++ b/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
@@ -1,34 +1,54 @@
1From 57e2c5e35732988c0b287289eb0997b4e9769371 Mon Sep 17 00:00:00 2001 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2From: Khem Raj <raj.khem@gmail.com> 2Subject: [PATCH 3/5] gcc: Add --nostdlib++ option
3Date: Fri, 29 Mar 2013 09:12:56 +0400
4Subject: [PATCH] optional libstdc
5 3
6gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++ 4[gcc-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++ 5will 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++ 6which shouldn't exist yet. We need an option to disable -lstdc++
9option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc 7option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
10driver. This patch adds such an option which only disables the -lstdc++. 8driver. This patch adds such an option which only disables the -lstdc++.]
11 9
12A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to 10[A "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. 11do this officially, the likely answer is don't build libstdc++ separately.]
14 12
15RP 29/6/10 13OpenEmbedded/Yocto Project builds libgcc and the other gcc runtime libraries
14separately from the compiler and slightly differently to the standard gcc build.
16 15
17Signed-off-by: Khem Raj <raj.khem@gmail.com> 16In general this works well but in trying to build them separately we run into
17an issue since we're using our gcc, not xgcc and there is no way to tell configure
18to use libgcc but not look for libstdc++.
18 19
19Upstream-Status: Inappropriate [embedded specific] 20This adds such an option allowing such configurations to work.
21
222021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org>
23
24gcc/c-family/ChangeLog:
25
26 * c.opt: Add --nostdlib++ option
27
28gcc/cp/ChangeLog:
29
30 * g++spec.c (lang_specific_driver): Add --nostdlib++ option
31
32gcc/ChangeLog:
33
34 * doc/invoke.texi: Document --nostdlib++ option
35 * gcc.c: Add --nostdlib++ option
36
37Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
38
39Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582724.html]
20--- 40---
21 gcc/c-family/c.opt | 4 ++++ 41 gcc/c-family/c.opt | 4 ++++
22 gcc/cp/g++spec.c | 1 + 42 gcc/cp/g++spec.c | 1 +
23 gcc/doc/invoke.texi | 32 +++++++++++++++++++++++++++++++- 43 gcc/doc/invoke.texi | 8 +++++++-
24 gcc/gcc.c | 1 + 44 gcc/gcc.c | 1 +
25 4 files changed, 37 insertions(+), 1 deletion(-) 45 4 files changed, 13 insertions(+), 1 deletion(-)
26 46
27diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt 47Index: gcc-11.2.0/gcc/c-family/c.opt
28index 64e46e7573e..1824380f27a 100644 48===================================================================
29--- a/gcc/c-family/c.opt 49--- gcc-11.2.0.orig/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt 50+++ gcc-11.2.0/gcc/c-family/c.opt
31@@ -2166,6 +2166,10 @@ nostdinc++ 51@@ -2153,6 +2153,10 @@ nostdinc++
32 C++ ObjC++ 52 C++ ObjC++
33 Do not search standard system include directories for C++. 53 Do not search standard system include directories for C++.
34 54
@@ -39,11 +59,11 @@ index 64e46e7573e..1824380f27a 100644
39 o 59 o
40 C ObjC C++ ObjC++ Joined Separate 60 C ObjC C++ ObjC++ Joined Separate
41 ; Documented in common.opt 61 ; Documented in common.opt
42diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c 62Index: gcc-11.2.0/gcc/cp/g++spec.c
43index 3c9bd1490b4..818beb61cee 100644 63===================================================================
44--- a/gcc/cp/g++spec.c 64--- gcc-11.2.0.orig/gcc/cp/g++spec.c
45+++ b/gcc/cp/g++spec.c 65+++ gcc-11.2.0/gcc/cp/g++spec.c
46@@ -159,6 +159,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, 66@@ -159,6 +159,7 @@ lang_specific_driver (struct cl_decoded_
47 switch (decoded_options[i].opt_index) 67 switch (decoded_options[i].opt_index)
48 { 68 {
49 case OPT_nostdlib: 69 case OPT_nostdlib:
@@ -51,21 +71,19 @@ index 3c9bd1490b4..818beb61cee 100644
51 case OPT_nodefaultlibs: 71 case OPT_nodefaultlibs:
52 library = -1; 72 library = -1;
53 break; 73 break;
54diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi 74Index: gcc-11.2.0/gcc/doc/invoke.texi
55index 6659a903bf0..9ee63dbe52f 100644 75===================================================================
56--- a/gcc/doc/invoke.texi 76--- gcc-11.2.0.orig/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi 77+++ gcc-11.2.0/gcc/doc/invoke.texi
58@@ -239,6 +239,9 @@ in the following sections. 78@@ -239,6 +239,7 @@ in the following sections.
59 -fno-weak -nostdinc++ @gol 79 -fno-weak -nostdinc++ @gol
60 -fvisibility-inlines-hidden @gol 80 -fvisibility-inlines-hidden @gol
61 -fvisibility-ms-compat @gol 81 -fvisibility-ms-compat @gol
62+-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
63+-fvtv-counts -fvtv-debug @gol
64+-nostdlib++ @gol 82+-nostdlib++ @gol
65 -fext-numeric-literals @gol 83 -fext-numeric-literals @gol
66 -flang-info-include-translate@r{[}=@var{header}@r{]} @gol 84 -flang-info-include-translate@r{[}=@var{header}@r{]} @gol
67 -flang-info-include-translate-not @gol 85 -flang-info-include-translate-not @gol
68@@ -632,7 +635,7 @@ Objective-C and Objective-C++ Dialects}. 86@@ -632,7 +633,7 @@ Objective-C and Objective-C++ Dialects}.
69 -pie -pthread -r -rdynamic @gol 87 -pie -pthread -r -rdynamic @gol
70 -s -static -static-pie -static-libgcc -static-libstdc++ @gol 88 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
71 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 89 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
@@ -74,7 +92,7 @@ index 6659a903bf0..9ee63dbe52f 100644
74 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 92 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
75 -u @var{symbol} -z @var{keyword}} 93 -u @var{symbol} -z @var{keyword}}
76 94
77@@ -15708,6 +15711,33 @@ Specify that the program entry point is @var{entry}. The argument is 95@@ -15721,6 +15722,11 @@ Specify that the program entry point is
78 interpreted by the linker; the GNU linker accepts either a symbol name 96 interpreted by the linker; the GNU linker accepts either a symbol name
79 or an address. 97 or an address.
80 98
@@ -83,36 +101,14 @@ index 6659a903bf0..9ee63dbe52f 100644
83+Do not use the standard system C++ runtime libraries when linking. 101+Do not use the standard system C++ runtime libraries when linking.
84+Only the libraries you specify will be passed to the linker. 102+Only the libraries you specify will be passed to the linker.
85+ 103+
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 104 @item -pie
109 @opindex pie 105 @opindex pie
110 Produce a dynamically linked position independent executable on targets 106 Produce a dynamically linked position independent executable on targets
111diff --git a/gcc/gcc.c b/gcc/gcc.c 107Index: gcc-11.2.0/gcc/gcc.c
112index 19c75b6e20d..be7630ffd8c 100644 108===================================================================
113--- a/gcc/gcc.c 109--- gcc-11.2.0.orig/gcc/gcc.c
114+++ b/gcc/gcc.c 110+++ gcc-11.2.0/gcc/gcc.c
115@@ -1162,6 +1162,7 @@ proper position among the other output files. */ 111@@ -1162,6 +1162,7 @@ proper position among the other output f
116 %(mflib) " STACK_SPLIT_SPEC "\ 112 %(mflib) " STACK_SPLIT_SPEC "\
117 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ 113 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
118 %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\ 114 %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\
diff --git a/meta/recipes-devtools/gcc/gcc/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch b/meta/recipes-devtools/gcc/gcc/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch
new file mode 100644
index 0000000000..6b1833ee79
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch
@@ -0,0 +1,61 @@
1From e700190743fa29ddaebd6ee075298a24b1688773 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 28 Oct 2021 11:33:40 +0100
4Subject: [PATCH 6/6] If CXXFLAGS contains something unsupported by the build
5 CXX, we see build failures (e.g. using -fmacro-prefix-map for the target).
6
7Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these errors.
8
92021-10-28 Richard Purdie <richard.purdie@linuxfoundation.org>
10
11ChangeLog:
12
13 * Makefile.in: Regenerate.
14 * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides
15
16Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
17---
18 Makefile.in | 2 ++
19 Makefile.tpl | 2 ++
20 2 files changed, 4 insertions(+)
21
22Index: gcc-11.2.0/Makefile.in
23===================================================================
24--- gcc-11.2.0.orig/Makefile.in
25+++ gcc-11.2.0/Makefile.in
26@@ -172,6 +172,7 @@ BUILD_EXPORTS = \
27 # built for the build system to override those in BASE_FLAGS_TO_PASS.
28 EXTRA_BUILD_FLAGS = \
29 CFLAGS="$(CFLAGS_FOR_BUILD)" \
30+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
31 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
32
33 # This is the list of directories to built for the host system.
34@@ -203,6 +204,7 @@ HOST_EXPORTS = \
35 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
36 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
37 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
38+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
39 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
40 LD="$(LD)"; export LD; \
41 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
42Index: gcc-11.2.0/Makefile.tpl
43===================================================================
44--- gcc-11.2.0.orig/Makefile.tpl
45+++ gcc-11.2.0/Makefile.tpl
46@@ -175,6 +175,7 @@ BUILD_EXPORTS = \
47 # built for the build system to override those in BASE_FLAGS_TO_PASS.
48 EXTRA_BUILD_FLAGS = \
49 CFLAGS="$(CFLAGS_FOR_BUILD)" \
50+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
51 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
52
53 # This is the list of directories to built for the host system.
54@@ -206,6 +207,7 @@ HOST_EXPORTS = \
55 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
56 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
57 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
58+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
59 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
60 LD="$(LD)"; export LD; \
61 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
diff --git a/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch
index c720defa35..37f26f0728 100644
--- a/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch
+++ b/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch
@@ -1,35 +1,41 @@
1From 33a7a55d39c040ba09af2d69f7fa9cf8e6f84c91 Mon Sep 17 00:00:00 2001 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2From: Khem Raj <raj.khem@gmail.com> 2Subject: [PATCH 5/5] gcc: Pass sysroot options to cpp for preprocessed source
3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH] cpp: honor sysroot.
5 3
6Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile 4OpenEmbedded/Yocto Project extensively uses the --sysroot support within gcc.
7preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location 5We discovered that when compiling preprocessed source (.i or .ii files), the
8rather than the --sysroot option specified on the commandline. If access to that directory is 6compiler will try and access the builtin sysroot location rather than the
9permission denied (unreadable), gcc will error. 7--sysroot option specified on the commandline. If access to that directory is
8permission denied (unreadable), gcc will error. This is particularly problematic
9when ccache is involved.
10 10
11This happens when ccache is in use due to the fact it uses preprocessed source files. 11This patch adds %I to the cpp-output spec macro so the default substitutions for
12-iprefix, -isystem, -isysroot happen and the correct sysroot is used.
12 13
13The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix, 142021-10-27 Richard Purdie <richard.purdie@linuxfoundation.org>
14-isystem, -isysroot happen and the correct sysroot is used.
15 15
16[YOCTO #2074] 16gcc/cp/ChangeLog:
17
18 * lang-specs.h: Pass sysroot options to cpp for preprocessed source
19
20gcc/ChangeLog:
17 21
18RP 2012/04/13 22 * gcc.c: Pass sysroot options to cpp for preprocessed source
19 23
20Signed-off-by: Khem Raj <raj.khem@gmail.com> 24Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
25
26[YOCTO #2074]
21 27
22Upstream-Status: Pending 28Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582725.html]
23--- 29---
24 gcc/cp/lang-specs.h | 2 +- 30 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.c | 2 +- 31 gcc/gcc.c | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-) 32 2 files changed, 2 insertions(+), 2 deletions(-)
27 33
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h 34Index: gcc-11.2.0/gcc/cp/lang-specs.h
29index 8902ae1d2ed..e99e2fcd6ad 100644 35===================================================================
30--- a/gcc/cp/lang-specs.h 36--- gcc-11.2.0.orig/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h 37+++ gcc-11.2.0/gcc/cp/lang-specs.h
32@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. If not see 38@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3.
33 {".ii", "@c++-cpp-output", 0, 0, 0}, 39 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output", 40 {"@c++-cpp-output",
35 "%{!E:%{!M:%{!MM:" 41 "%{!E:%{!M:%{!MM:"
@@ -38,11 +44,11 @@ index 8902ae1d2ed..e99e2fcd6ad 100644
38 " %{!fsyntax-only:" 44 " %{!fsyntax-only:"
39 " %{fmodule-only:%{!S:-o %g.s%V}}" 45 " %{fmodule-only:%{!S:-o %g.s%V}}"
40 " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}" 46 " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
41diff --git a/gcc/gcc.c b/gcc/gcc.c 47Index: gcc-11.2.0/gcc/gcc.c
42index 1bc45285384..8737bae5353 100644 48===================================================================
43--- a/gcc/gcc.c 49--- gcc-11.2.0.orig/gcc/gcc.c
44+++ b/gcc/gcc.c 50+++ gcc-11.2.0/gcc/gcc.c
45@@ -1470,7 +1470,7 @@ static const struct compiler default_compilers[] = 51@@ -1470,7 +1470,7 @@ static const struct compiler default_com
46 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, 52 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
47 {".i", "@cpp-output", 0, 0, 0}, 53 {".i", "@cpp-output", 0, 0, 0},
48 {"@cpp-output", 54 {"@cpp-output",
diff --git a/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch
index 814ce18b98..6b6925735d 100644
--- a/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch
+++ b/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch
@@ -1,37 +1,32 @@
1From 12646c0899dec1b127ce71ebacf2571c1c7360f4 Mon Sep 17 00:00:00 2001 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2From: Khem Raj <raj.khem@gmail.com> 2Subject: [PATCH 2/5] gcc: Fix "argument list too long" from install-plugins
3Date: Fri, 29 Mar 2013 09:26:37 +0400
4Subject: [PATCH] gcc: Fix argument list too long error.
5 3
6There would be an "Argument list too long" error when the 4When building in longer build paths (200+ characters), the
7build directory is longer than 200, this is caused by: 5"echo $(PLUGIN_HEADERS)" from the install-plugins target would cause an
6"argument list too long error" on some systems.
8 7
9headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u` 8Avoid this by calling make's sort function on the list which removes
9duplicates and stops the overflow from reaching the echo command.
10The original sort is left to handle the the .h and .def files.
10 11
11The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle 122021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org>
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 13
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com> 14gcc/ChangeLog:
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 15
20RP: gcc then added *.h and *.def additions to this list, breaking the original 16 * Makefile.in: Fix "argument list too long" from install-plugins
21fix. Add the sort to the original gcc code, leaving the tr+sort to fix the original
22issue but include the new files too as reported by Zhuang <qiuguang.zqg@alibaba-inc.com>
23 17
24Upstream-Status: Pending 18Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
25Signed-off-by: Khem Raj <raj.khem@gmail.com> 19
20Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582722.html]
26--- 21---
27 gcc/Makefile.in | 2 +- 22 gcc/Makefile.in | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-) 23 1 file changed, 1 insertion(+), 1 deletion(-)
29 24
30diff --git a/gcc/Makefile.in b/gcc/Makefile.in 25Index: gcc-11.2.0/gcc/Makefile.in
31index 7da6f439fff..59c45c81393 100644 26===================================================================
32--- a/gcc/Makefile.in 27--- gcc-11.2.0.orig/gcc/Makefile.in
33+++ b/gcc/Makefile.in 28+++ gcc-11.2.0/gcc/Makefile.in
34@@ -3678,7 +3678,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype 29@@ -3678,7 +3678,7 @@ install-plugin: installdirs lang.install
35 # We keep the directory structure for files in config, common/config or 30 # We keep the directory structure for files in config, common/config or
36 # c-family and .def files. All other files are flattened to a single directory. 31 # c-family and .def files. All other files are flattened to a single directory.
37 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir) 32 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
diff --git a/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch b/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch
index e6596da5c7..86ab6574c7 100644
--- a/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch
+++ b/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch
@@ -1,50 +1,199 @@
1From b6e229a13aebfbb3fe38c216fd51b68bf71cfa9c Mon Sep 17 00:00:00 2001 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2From: Khem Raj <raj.khem@gmail.com> 2Subject: [PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS is used for build targets
3Date: Fri, 20 Feb 2015 09:40:59 +0000 3
4Subject: [PATCH] export CPP 4During cross compiling, CPP is being set to the target compiler even for
5 5build targets. As an example, when building a cross compiler targetting
6The OE environment sets and exports CPP as being the target gcc. When 6mingw, the config.log for libiberty in
7building gcc-cross-canadian for a mingw targetted sdk, the following can be found 7build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log
8in build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log: 8shows:
9 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 10configure: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 11configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/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 12configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
17configure:3876: $? = 0 13configure:3876: $? = 0
18 14
19Note this is a *build* target (in build-x86_64-linux) so it should be 15This is libiberty being built for the build environment, not the target one
20using the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32 16(i.e. in build-x86_64-linux). As such it should be using the build environment's
21headers are very different, using the wrong cpp is a real problem. It is leaking 17gcc and not the target one. In the mingw case the system headers are quite
22into configure through the CPP variable. Ultimately this leads to build 18different leading to build failures related to not being able to include a
23failures related to not being able to include a process.h file for pem-unix.c. 19process.h file for pem-unix.c.
20
21Further analysis shows the same issue occuring for CPPFLAGS too.
22
23Fix this by adding support for CPP_FOR_BUILD and CPPFLAGS_FOR_BUILD which
24for example, avoids mixing the mingw headers for host binaries on linux
25systems.
26
272021-10-27 Richard Purdie <richard.purdie@linuxfoundation.org>
28
29ChangeLog:
24 30
25The fix is to ensure we export a sane CPP value into the build 31 * Makefile.tpl: Add CPP_FOR_BUILD and CPPFLAGS_FOR_BUILD support
26environment when using build targets. We could define a CPP_FOR_BUILD value which may be 32 * Makefile.in: Regenerate.
27the version which needs to be upstreamed but for now, this fix is good enough to 33 * configure: Regenerate.
28avoid the problem. 34 * configure.ac: Add CPP_FOR_BUILD and CPPFLAGS_FOR_BUILD support
29 35
30RP 22/08/2013 36gcc/ChangeLog:
31 37
32Upstream-Status: Pending 38 * configure: Regenerate.
39 * configure.ac: Use CPPFLAGS_FOR_BUILD for GMPINC
33 40
34Signed-off-by: Khem Raj <raj.khem@gmail.com> 41Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
42
43Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582727.html]
44Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=84401ce5fb4ecab55decb472b168100e7593e01f]
35--- 45---
36 Makefile.in | 1 + 46 Makefile.in | 6 ++++++
37 1 file changed, 1 insertion(+) 47 Makefile.tpl | 6 ++++++
38 48 configure | 4 ++++
39diff --git a/Makefile.in b/Makefile.in 49 configure.ac | 4 ++++
40index 047be0255e2..af19589fa95 100644 50 gcc/configure | 2 +-
41--- a/Makefile.in 51 gcc/configure.ac | 2 +-
42+++ b/Makefile.in 52 6 files changed, 22 insertions(+), 2 deletions(-)
43@@ -149,6 +149,7 @@ BUILD_EXPORTS = \ 53
44 AR="$(AR_FOR_BUILD)"; export AR; \ 54Index: gcc-11.2.0/Makefile.in
45 AS="$(AS_FOR_BUILD)"; export AS; \ 55===================================================================
56--- gcc-11.2.0.orig/Makefile.in
57+++ gcc-11.2.0/Makefile.in
58@@ -151,6 +151,8 @@ BUILD_EXPORTS = \
59 CC="$(CC_FOR_BUILD)"; export CC; \
60 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
61 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
62+ CPP="$(CPP_FOR_BUILD)"; export CPP; \
63+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
64 CXX="$(CXX_FOR_BUILD)"; export CXX; \
65 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
66 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
67@@ -198,6 +200,8 @@ HOST_EXPORTS = \
68 AR="$(AR)"; export AR; \
69 AS="$(AS)"; export AS; \
70 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
71+ CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
72+ CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
73 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
74 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
75 LD="$(LD)"; export LD; \
76@@ -353,6 +357,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
77 AS_FOR_BUILD = @AS_FOR_BUILD@
78 CC_FOR_BUILD = @CC_FOR_BUILD@
79 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
80+CPP_FOR_BUILD = @CPP_FOR_BUILD@
81+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
82 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
83 CXX_FOR_BUILD = @CXX_FOR_BUILD@
84 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
85Index: gcc-11.2.0/Makefile.tpl
86===================================================================
87--- gcc-11.2.0.orig/Makefile.tpl
88+++ gcc-11.2.0/Makefile.tpl
89@@ -154,6 +154,8 @@ BUILD_EXPORTS = \
46 CC="$(CC_FOR_BUILD)"; export CC; \ 90 CC="$(CC_FOR_BUILD)"; export CC; \
47+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
48 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ 91 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
49 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ 92 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
93+ CPP="$(CPP_FOR_BUILD)"; export CPP; \
94+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
50 CXX="$(CXX_FOR_BUILD)"; export CXX; \ 95 CXX="$(CXX_FOR_BUILD)"; export CXX; \
96 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
97 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
98@@ -201,6 +203,8 @@ HOST_EXPORTS = \
99 AR="$(AR)"; export AR; \
100 AS="$(AS)"; export AS; \
101 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
102+ CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
103+ CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
104 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
105 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
106 LD="$(LD)"; export LD; \
107@@ -356,6 +360,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
108 AS_FOR_BUILD = @AS_FOR_BUILD@
109 CC_FOR_BUILD = @CC_FOR_BUILD@
110 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
111+CPP_FOR_BUILD = @CPP_FOR_BUILD@
112+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
113 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
114 CXX_FOR_BUILD = @CXX_FOR_BUILD@
115 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
116Index: gcc-11.2.0/configure
117===================================================================
118--- gcc-11.2.0.orig/configure
119+++ gcc-11.2.0/configure
120@@ -652,6 +652,8 @@ GFORTRAN_FOR_BUILD
121 DLLTOOL_FOR_BUILD
122 CXX_FOR_BUILD
123 CXXFLAGS_FOR_BUILD
124+CPPFLAGS_FOR_BUILD
125+CPP_FOR_BUILD
126 CFLAGS_FOR_BUILD
127 CC_FOR_BUILD
128 AS_FOR_BUILD
129@@ -4092,6 +4094,7 @@ if test "${build}" != "${host}" ; then
130 AR_FOR_BUILD=${AR_FOR_BUILD-ar}
131 AS_FOR_BUILD=${AS_FOR_BUILD-as}
132 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
133+ CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}"
134 CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
135 GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
136 GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
137@@ -9809,6 +9812,7 @@ esac
138 # our build compiler if desired.
139 if test x"${build}" = x"${host}" ; then
140 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
141+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
142 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
143 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
144 fi
145Index: gcc-11.2.0/configure.ac
146===================================================================
147--- gcc-11.2.0.orig/configure.ac
148+++ gcc-11.2.0/configure.ac
149@@ -1347,6 +1347,7 @@ if test "${build}" != "${host}" ; then
150 AR_FOR_BUILD=${AR_FOR_BUILD-ar}
151 AS_FOR_BUILD=${AS_FOR_BUILD-as}
152 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
153+ CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}"
154 CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
155 GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
156 GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
157@@ -3321,6 +3322,7 @@ esac
158 # our build compiler if desired.
159 if test x"${build}" = x"${host}" ; then
160 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
161+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
162 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
163 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
164 fi
165@@ -3387,6 +3389,8 @@ AC_SUBST(AR_FOR_BUILD)
166 AC_SUBST(AS_FOR_BUILD)
167 AC_SUBST(CC_FOR_BUILD)
168 AC_SUBST(CFLAGS_FOR_BUILD)
169+AC_SUBST(CPP_FOR_BUILD)
170+AC_SUBST(CPPFLAGS_FOR_BUILD)
171 AC_SUBST(CXXFLAGS_FOR_BUILD)
172 AC_SUBST(CXX_FOR_BUILD)
173 AC_SUBST(DLLTOOL_FOR_BUILD)
174Index: gcc-11.2.0/gcc/configure
175===================================================================
176--- gcc-11.2.0.orig/gcc/configure
177+++ gcc-11.2.0/gcc/configure
178@@ -12699,7 +12699,7 @@ else
179 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
180 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
181 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
182- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
183+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
184 ${realsrcdir}/configure \
185 --enable-languages=${enable_languages-all} \
186 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
187Index: gcc-11.2.0/gcc/configure.ac
188===================================================================
189--- gcc-11.2.0.orig/gcc/configure.ac
190+++ gcc-11.2.0/gcc/configure.ac
191@@ -2023,7 +2023,7 @@ else
192 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
193 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
194 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
195- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
196+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
197 ${realsrcdir}/configure \
198 --enable-languages=${enable_languages-all} \
199 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
diff --git a/meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch b/meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch
deleted file mode 100644
index c2698f9eeb..0000000000
--- a/meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch
+++ /dev/null
@@ -1,134 +0,0 @@
1From cd5db101e3c4e72248f988a67ce28be8e24f66d4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:42:45 +0000
4Subject: [PATCH] Fix various _FOR_BUILD and related variables
5
6When doing a FOR_BUILD thing, you have to override CFLAGS with
7CFLAGS_FOR_BUILD. And if you use C++, you also have to override
8CXXFLAGS with CXXFLAGS_FOR_BUILD.
9Without this, when building for mingw, you end up trying to use
10the mingw headers for a host build.
11
12The same goes for other variables as well, such as CPPFLAGS,
13CPP, and GMPINC.
14
15Upstream-Status: Pending
16
17Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
18Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 Makefile.in | 6 ++++++
22 Makefile.tpl | 5 +++++
23 gcc/Makefile.in | 2 +-
24 gcc/configure | 2 +-
25 gcc/configure.ac | 2 +-
26 5 files changed, 14 insertions(+), 3 deletions(-)
27
28diff --git a/Makefile.in b/Makefile.in
29index af19589fa95..d0116a23e1a 100644
30--- a/Makefile.in
31+++ b/Makefile.in
32@@ -152,6 +152,7 @@ BUILD_EXPORTS = \
33 CPP="$(CC_FOR_BUILD) -E"; export CPP; \
34 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
35 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
36+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
37 CXX="$(CXX_FOR_BUILD)"; export CXX; \
38 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
39 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
40@@ -171,6 +172,9 @@ BUILD_EXPORTS = \
41 # built for the build system to override those in BASE_FLAGS_TO_PASS.
42 EXTRA_BUILD_FLAGS = \
43 CFLAGS="$(CFLAGS_FOR_BUILD)" \
44+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
45+ CPP="$(CC_FOR_BUILD) -E" \
46+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
47 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
48
49 # This is the list of directories to built for the host system.
50@@ -188,6 +192,7 @@ HOST_SUBDIR = @host_subdir@
51 HOST_EXPORTS = \
52 $(BASE_EXPORTS) \
53 CC="$(CC)"; export CC; \
54+ CPP="$(CC) -E"; export CPP; \
55 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
56 CFLAGS="$(CFLAGS)"; export CFLAGS; \
57 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
58@@ -776,6 +781,7 @@ BASE_FLAGS_TO_PASS = \
59 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
60 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
61 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
62+ "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
63 "EXPECT=$(EXPECT)" \
64 "FLEX=$(FLEX)" \
65 "INSTALL=$(INSTALL)" \
66diff --git a/Makefile.tpl b/Makefile.tpl
67index 6e0337fb48f..4fcac93d3d8 100644
68--- a/Makefile.tpl
69+++ b/Makefile.tpl
70@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
71 CC="$(CC_FOR_BUILD)"; export CC; \
72 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
73 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
74+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
75 CXX="$(CXX_FOR_BUILD)"; export CXX; \
76 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
77 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
78@@ -173,6 +174,9 @@ BUILD_EXPORTS = \
79 # built for the build system to override those in BASE_FLAGS_TO_PASS.
80 EXTRA_BUILD_FLAGS = \
81 CFLAGS="$(CFLAGS_FOR_BUILD)" \
82+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
83+ CPP="$(CC_FOR_BUILD) -E" \
84+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
85 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
86
87 # This is the list of directories to built for the host system.
88@@ -190,6 +194,7 @@ HOST_SUBDIR = @host_subdir@
89 HOST_EXPORTS = \
90 $(BASE_EXPORTS) \
91 CC="$(CC)"; export CC; \
92+ CPP="$(CC) -E"; export CPP; \
93 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
94 CFLAGS="$(CFLAGS)"; export CFLAGS; \
95 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
96diff --git a/gcc/Makefile.in b/gcc/Makefile.in
97index 9b17d120aa1..3053d05903c 100644
98--- a/gcc/Makefile.in
99+++ b/gcc/Makefile.in
100@@ -820,7 +820,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 e663052cad2..b0906aa3e96 100755
111--- a/gcc/configure
112+++ b/gcc/configure
113@@ -12699,7 +12699,7 @@ else
114 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
115 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
116 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
117- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
118+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
119 ${realsrcdir}/configure \
120 --enable-languages=${enable_languages-all} \
121 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
122diff --git a/gcc/configure.ac b/gcc/configure.ac
123index 2b84875b028..bfbd8946e8a 100644
124--- a/gcc/configure.ac
125+++ b/gcc/configure.ac
126@@ -2023,7 +2023,7 @@ else
127 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
128 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
129 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
130- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
131+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
132 ${realsrcdir}/configure \
133 --enable-languages=${enable_languages-all} \
134 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
diff --git a/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
index 2e65740ec0..97c271373b 100644
--- a/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
+++ b/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
@@ -1,20 +1,26 @@
1From 9bbce1b5a10caf636eee137e5a229e5434a6c8f5 Mon Sep 17 00:00:00 2001 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2From: Khem Raj <raj.khem@gmail.com> 2Subject: [PATCH 4/5] gcc/nios2: Define the musl linker
3Date: Tue, 2 Feb 2016 10:26:10 -0800
4Subject: [PATCH] nios2: Define MUSL_DYNAMIC_LINKER
5 3
6Upstream-Status: Pending 4Add a definition of the musl linker used on the nios2 platform.
7 5
8Signed-off-by: Marek Vasut <marex@denx.de> 62021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org>
9Signed-off-by: Khem Raj <raj.khem@gmail.com> 7
8gcc/ChangeLog:
9
10 * config/nios2/linux.h (MUSL_DYNAMIC_LINKER): Add musl linker
11
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13
14Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582723.html]
15Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e5ddbbf992b909d8e38851bd3179d29389e6ac97]
10--- 16---
11 gcc/config/nios2/linux.h | 1 + 17 gcc/config/nios2/linux.h | 1 +
12 1 file changed, 1 insertion(+) 18 1 file changed, 1 insertion(+)
13 19
14diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h 20Index: gcc-11.2.0/gcc/config/nios2/linux.h
15index 08edf1521f6..15696d86241 100644 21===================================================================
16--- a/gcc/config/nios2/linux.h 22--- gcc-11.2.0.orig/gcc/config/nios2/linux.h
17+++ b/gcc/config/nios2/linux.h 23+++ gcc-11.2.0/gcc/config/nios2/linux.h
18@@ -30,6 +30,7 @@ 24@@ -30,6 +30,7 @@
19 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 25 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
20 26