M7350/oe-core/meta/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch

99 lines
3.7 KiB
Diff
Raw Normal View History

2024-09-09 08:57:42 +00:00
From 307c8ff3ef666b7bd5ac733863f2fbb27a9d521e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:12:56 +0400
Subject: [PATCH 20/35] optional libstdc
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
2024-09-09 08:52:07 +00:00
will not run correctly since by default the linker will try to link against libstdc++
which shouldn't exist yet. We need an option to disable -lstdc++
2024-09-09 08:57:42 +00:00
option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
2024-09-09 08:52:07 +00:00
driver. This patch adds such an option which only disables the -lstdc++.
2024-09-09 08:57:42 +00:00
A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
2024-09-09 08:52:07 +00:00
do this officially, the likely answer is don't build libstdc++ separately.
RP 29/6/10
2024-09-09 08:57:42 +00:00
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Inappropriate [embedded specific]
---
gcc/c-family/c.opt | 4 ++++
gcc/cp/g++spec.c | 1 +
gcc/doc/invoke.texi | 9 +++++++--
gcc/gcc.c | 1 +
4 files changed, 13 insertions(+), 2 deletions(-)
Index: gcc-4.9-20140316/gcc/c-family/c.opt
===================================================================
--- gcc-4.9-20140316.orig/gcc/c-family/c.opt
+++ gcc-4.9-20140316/gcc/c-family/c.opt
@@ -1323,6 +1323,10 @@ nostdinc++
C++ ObjC++
Do not search standard system include directories for C++
+nostdlib++
+Driver
+Do not link standard C++ runtime library
+
o
C ObjC C++ ObjC++ Joined Separate
; Documented in common.opt
Index: gcc-4.9-20140316/gcc/cp/g++spec.c
2024-09-09 08:52:07 +00:00
===================================================================
2024-09-09 08:57:42 +00:00
--- gcc-4.9-20140316.orig/gcc/cp/g++spec.c
+++ gcc-4.9-20140316/gcc/cp/g++spec.c
@@ -138,6 +138,7 @@ lang_specific_driver (struct cl_decoded_
2024-09-09 08:52:07 +00:00
switch (decoded_options[i].opt_index)
{
case OPT_nostdlib:
+ case OPT_nostdlib__:
case OPT_nodefaultlibs:
library = -1;
break;
2024-09-09 08:57:42 +00:00
Index: gcc-4.9-20140316/gcc/doc/invoke.texi
2024-09-09 08:52:07 +00:00
===================================================================
2024-09-09 08:57:42 +00:00
--- gcc-4.9-20140316.orig/gcc/doc/invoke.texi
+++ gcc-4.9-20140316/gcc/doc/invoke.texi
@@ -193,6 +193,7 @@ in the following sections.
-fvisibility-inlines-hidden @gol
-fvtable-verify=@var{std|preinit|none} @gol
-fvtv-counts -fvtv-debug @gol
+-nostdlib++ @gol
2024-09-09 08:52:07 +00:00
-fvisibility-ms-compat @gol
2024-09-09 08:57:42 +00:00
-fext-numeric-literals @gol
2024-09-09 08:52:07 +00:00
-Wabi -Wconversion-null -Wctor-dtor-privacy @gol
2024-09-09 08:57:42 +00:00
@@ -457,7 +458,7 @@ Objective-C and Objective-C++ Dialects}.
2024-09-09 08:52:07 +00:00
-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
2024-09-09 08:57:42 +00:00
-s -static -static-libgcc -static-libstdc++ @gol
-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
--shared -shared-libgcc -symbolic @gol
+-shared -shared-libgcc -symbolic -nostdlib++ @gol
2024-09-09 08:52:07 +00:00
-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
-u @var{symbol}}
2024-09-09 08:57:42 +00:00
@@ -10285,6 +10286,11 @@ These entries are usually resolved by en
2024-09-09 08:52:07 +00:00
libc. These entry points should be supplied through some other
mechanism when this option is specified.
+@item -nostdlib++
+@opindex nostdlib++
+Do not use the standard system C++ runtime libraries when linking.
+Only the libraries you specify will be passed to the linker.
+
@cindex @option{-lgcc}, use with @option{-nostdlib}
@cindex @option{-nostdlib} and unresolved references
@cindex unresolved references and @option{-nostdlib}
2024-09-09 08:57:42 +00:00
Index: gcc-4.9-20140316/gcc/gcc.c
2024-09-09 08:52:07 +00:00
===================================================================
2024-09-09 08:57:42 +00:00
--- gcc-4.9-20140316.orig/gcc/gcc.c
+++ gcc-4.9-20140316/gcc/gcc.c
@@ -772,6 +772,7 @@ proper position among the other output f
2024-09-09 08:52:07 +00:00
%(mflib) " STACK_SPLIT_SPEC "\
2024-09-09 08:57:42 +00:00
%{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
2024-09-09 08:52:07 +00:00
%{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
+ %{!nostdlib++:}\
%{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
#endif