summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-25 22:34:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-29 07:27:47 +0100
commit0729c13304aafdfe549c01db2722fa53f09fbb93 (patch)
tree9e10a0efded12b97658375bc6769049cfb2adaf2 /meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
parent9c6b31c27bea90225e63afb2838d353edfbc1f19 (diff)
downloadpoky-0729c13304aafdfe549c01db2722fa53f09fbb93.tar.gz
gcc: Update patches submitted/merged upstream
I took 5 of our patches and submitted to upstream gcc. This highlighted that patches 0026 and 0018 should be merged together and some tweaks were made to try and make it acceptable to upstream. The other patches have their headers updated to match what was submitted. The libstdc++ option patch was also cleaned up ready for upstream as the documentation wasn't quite right. The CXXFLAGS_FOR_BUILD piece of 0026 is separated out into a new patch which can be submitted separately to upstream. Two of the patches have been merged, status updated accordinly. (From OE-Core rev: df9b8ec56ff29f14feb1fde6acbdf9c4667430cf) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch120
1 files changed, 58 insertions, 62 deletions
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)}}}\