summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-9.5/0005-optional-libstdc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-9.5/0005-optional-libstdc.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-9.5/0005-optional-libstdc.patch125
1 files changed, 125 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-9.5/0005-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc-9.5/0005-optional-libstdc.patch
new file mode 100644
index 0000000000..3c28aeac63
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-9.5/0005-optional-libstdc.patch
@@ -0,0 +1,125 @@
1From 435e45592e944018f33bff32f1202b0872a23141 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:12:56 +0400
4Subject: [PATCH 05/39] 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 916cc67b453..41619fa591c 100644
29--- a/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt
31@@ -1952,6 +1952,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 6c4574a837d..0e2657f00ee 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 c3d3d51a28f..2f7ffe456c3 100644
56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi
58@@ -228,6 +228,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 -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
68@@ -539,7 +542,7 @@ Objective-C and Objective-C++ Dialects}.
69 -pie -pthread -r -rdynamic @gol
70 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
71 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
72--shared -shared-libgcc -symbolic @gol
73+-shared -shared-libgcc -symbolic -nostdlib++ @gol
74 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
75 -u @var{symbol} -z @var{keyword}}
76
77@@ -13321,6 +13324,33 @@ Specify that the program entry point is @var{entry}. The argument is
78 interpreted by the linker; the GNU linker accepts either a symbol name
79 or an address.
80
81+@item -nostdlib++
82+@opindex nostdlib++
83+Do not use the standard system C++ runtime libraries when linking.
84+Only the libraries you specify will be passed to the linker.
85+
86+@cindex @option{-lgcc}, use with @option{-nostdlib}
87+@cindex @option{-nostdlib} and unresolved references
88+@cindex unresolved references and @option{-nostdlib}
89+@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
90+@cindex @option{-nodefaultlibs} and unresolved references
91+@cindex unresolved references and @option{-nodefaultlibs}
92+One of the standard libraries bypassed by @option{-nostdlib} and
93+@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
94+which GCC uses to overcome shortcomings of particular machines, or special
95+needs for some languages.
96+(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
97+Collection (GCC) Internals},
98+for more discussion of @file{libgcc.a}.)
99+In most cases, you need @file{libgcc.a} even when you want to avoid
100+other standard libraries. In other words, when you specify @option{-nostdlib}
101+or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
102+This ensures that you have no unresolved references to internal GCC
103+library subroutines.
104+(An example of such an internal subroutine is @code{__main}, used to ensure C++
105+constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
106+GNU Compiler Collection (GCC) Internals}.)
107+
108 @item -pie
109 @opindex pie
110 Produce a dynamically linked position independent executable on targets
111diff --git a/gcc/gcc.c b/gcc/gcc.c
112index a2601a6bb06..cd6c6fc95db 100644
113--- a/gcc/gcc.c
114+++ b/gcc/gcc.c
115@@ -1052,6 +1052,7 @@ proper position among the other output files. */
116 %(mflib) " STACK_SPLIT_SPEC "\
117 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
118 %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\
119+ %{!nostdlib++:}\
120 %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}"
121 #endif
122
123--
1242.25.1
125