public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4870] c++, driver: Fix -static-libstdc++ for targets without Bstatic/dynamic.
@ 2022-12-23 8:53 Iain D Sandoe
0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2022-12-23 8:53 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a846817739c1e7b930d593cd51963d6b46b5dfc6
commit r13-4870-ga846817739c1e7b930d593cd51963d6b46b5dfc6
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu Jan 6 08:37:18 2022 +0000
c++, driver: Fix -static-libstdc++ for targets without Bstatic/dynamic.
The current implementation for swapping between the static and shared c++
runtimes relies on the static linker supporting Bstatic/dynamic which is
not available for every target (Darwin's linker does not support this).
Specs substitution (%s) is an alternative solution for this (which is what
Darwin uses for Fortran, D and Objective-C). However, specs substitution
requires that the '-static-libstdc++' be preserved in the driver's command
line. The patch here arranges for this to be done when the configuration
determines that linker support for Bstatic/dynamic is missing.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/ChangeLog:
* g++spec.cc (lang_specific_driver): Preserve -static-libstdc++ in
the driver command line for targets without -Bstatic/dynamic support
in their static linker.
Diff:
---
gcc/cp/g++spec.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/cp/g++spec.cc b/gcc/cp/g++spec.cc
index 3d3b042dd56..f95d7965355 100644
--- a/gcc/cp/g++spec.cc
+++ b/gcc/cp/g++spec.cc
@@ -234,7 +234,12 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
case OPT_static_libstdc__:
library = library >= 0 ? 2 : library;
+#ifdef HAVE_LD_STATIC_DYNAMIC
+ /* Remove -static-libstdc++ from the command only if target supports
+ LD_STATIC_DYNAMIC. When not supported, it is left in so that a
+ back-end target can use outfile substitution. */
args[i] |= SKIPOPT;
+#endif
break;
case OPT_stdlib_:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-23 8:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23 8:53 [gcc r13-4870] c++, driver: Fix -static-libstdc++ for targets without Bstatic/dynamic Iain D Sandoe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).