public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] Introduce -nolibstdc++ option
@ 2022-06-22  5:22 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-22  5:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:766d5eb1939df3bbc4dc1c407a1b6e56039ae4fb

commit 766d5eb1939df3bbc4dc1c407a1b6e56039ae4fb
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jun 20 19:44:23 2022 -0300

    Introduce -nolibstdc++ option
    
    Using g++ to link without libstdc++, as in g++.dg/abi/pure-virtual1.C,
    is error prone, because there's no way to tell g++ to drop libstdc++
    without also dropping libc and any other libraries that the target
    implicitly links in.
    
    This has often led to the need for manual adjustments to this
    testcase.
    
    I figured adding support for -nolibstdc++, even though redundant,
    makes some sense.  One could presumably use gcc rather than g++ for
    linking, for the same effect, but sometimes changing the link command
    is harder than adding an option, as in our testsuite.
    
    
    for  gcc/ChangeLog
    
            * common.opt (nolibstdc++): New.
            * doc/invoke.texi (-nolibstdc++): Document it.
    
    for  gcc/cp/ChangeLog
    
            * g++spec.c (lang_specific_driver): Implement -nolibstdc++.
    
    for  gcc/testsuite/ChangeLog
    
            * g++.dg/abi/pure-virtual1.C: Use -nolibstdc++.

Diff:
---
 gcc/common.opt                           | 3 +++
 gcc/cp/g++spec.cc                        | 1 +
 gcc/doc/invoke.texi                      | 6 +++++-
 gcc/testsuite/g++.dg/abi/pure-virtual1.C | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 32917aafcae..e00c6fc2fb0 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3456,6 +3456,9 @@ Driver
 nolibc
 Driver
 
+nolibstdc++
+Driver
+
 nostdlib
 Driver
 
diff --git a/gcc/cp/g++spec.cc b/gcc/cp/g++spec.cc
index 8174d652776..539e6ca089d 100644
--- a/gcc/cp/g++spec.cc
+++ b/gcc/cp/g++spec.cc
@@ -160,6 +160,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
 	{
 	case OPT_nostdlib:
 	case OPT_nodefaultlibs:
+	case OPT_nolibstdc__:
 	  library = -1;
 	  break;
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index fb506364702..de105ddf029 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -652,7 +652,7 @@ Objective-C and Objective-C++ Dialects}.
 @item Linker Options
 @xref{Link Options,,Options for Linking}.
 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
--nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
+-nostartfiles  -nodefaultlibs  -nolibc  -nolibstdc++  -nostdlib @gol
 -e @var{entry}  --entry=@var{entry} @gol
 -pie  -pthread  -r  -rdynamic @gol
 -s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
@@ -16787,6 +16787,10 @@ absence of a C library is assumed, for example @option{-lpthread} or
 @option{-lm} in some configurations.  This is intended for bare-board
 targets when there is indeed no C library available.
 
+@item -nolibstdc++
+@opindex nolibstdc++
+Do not link with standard C++ libraries implicitly.
+
 @item -nostdlib
 @opindex nostdlib
 Do not use the standard system startup files or libraries when linking.
diff --git a/gcc/testsuite/g++.dg/abi/pure-virtual1.C b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
index 538e2cb097a..889c33e4952 100644
--- a/gcc/testsuite/g++.dg/abi/pure-virtual1.C
+++ b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
@@ -1,7 +1,7 @@
 // Test that we don't need libsupc++ just for __cxa_pure_virtual.
 // { dg-do link }
 // { dg-require-weak }
-// { dg-additional-options "-fno-rtti -nodefaultlibs -lc" }
+// { dg-additional-options "-fno-rtti -nolibstdc++" }
 // { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } }
 // { dg-xfail-if "AIX weak" { powerpc-ibm-aix* } }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] Introduce -nolibstdc++ option
@ 2022-06-21  0:16 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-21  0:16 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:344aa02cf4d8196b718dcdc29f2301c19f13da31

commit 344aa02cf4d8196b718dcdc29f2301c19f13da31
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jun 20 19:44:23 2022 -0300

    Introduce -nolibstdc++ option
    
    Using g++ to link without libstdc++, as in g++.dg/abi/pure-virtual1.C,
    is error prone, because there's no way to tell g++ to drop libstdc++
    without also dropping libc and any other libraries that the target
    implicitly links in.
    
    This has often led to the need for manual adjustments to this
    testcase.
    
    I figured adding support for -nolibstdc++, even though redundant,
    makes some sense.  One could presumably use gcc rather than g++ for
    linking, for the same effect, but sometimes changing the link command
    is harder than adding an option, as in our testsuite.
    
    
    for  gcc/ChangeLog
    
            * common.opt (nolibstdc++): New.
            * doc/invoke.texi (-nolibstdc++): Document it.
    
    for  gcc/cp/ChangeLog
    
            * g++spec.c (lang_specific_driver): Implement -nolibstdc++.
    
    for  gcc/testsuite/ChangeLog
    
            * g++.dg/abi/pure-virtual1.C: Use -nolibstdc++.

Diff:
---
 gcc/common.opt                           | 3 +++
 gcc/cp/g++spec.cc                        | 1 +
 gcc/doc/invoke.texi                      | 6 +++++-
 gcc/testsuite/g++.dg/abi/pure-virtual1.C | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 32917aafcae..e00c6fc2fb0 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3456,6 +3456,9 @@ Driver
 nolibc
 Driver
 
+nolibstdc++
+Driver
+
 nostdlib
 Driver
 
diff --git a/gcc/cp/g++spec.cc b/gcc/cp/g++spec.cc
index 8174d652776..539e6ca089d 100644
--- a/gcc/cp/g++spec.cc
+++ b/gcc/cp/g++spec.cc
@@ -160,6 +160,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
 	{
 	case OPT_nostdlib:
 	case OPT_nodefaultlibs:
+	case OPT_nolibstdc__:
 	  library = -1;
 	  break;
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 50f57877477..469b6d97e0d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -652,7 +652,7 @@ Objective-C and Objective-C++ Dialects}.
 @item Linker Options
 @xref{Link Options,,Options for Linking}.
 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
--nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
+-nostartfiles  -nodefaultlibs  -nolibc  -nolibstdc++  -nostdlib @gol
 -e @var{entry}  --entry=@var{entry} @gol
 -pie  -pthread  -r  -rdynamic @gol
 -s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
@@ -16787,6 +16787,10 @@ absence of a C library is assumed, for example @option{-lpthread} or
 @option{-lm} in some configurations.  This is intended for bare-board
 targets when there is indeed no C library available.
 
+@item -nolibstdc++
+@opindex nolibstdc++
+Do not link with standard C++ libraries implicitly.
+
 @item -nostdlib
 @opindex nostdlib
 Do not use the standard system startup files or libraries when linking.
diff --git a/gcc/testsuite/g++.dg/abi/pure-virtual1.C b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
index 538e2cb097a..889c33e4952 100644
--- a/gcc/testsuite/g++.dg/abi/pure-virtual1.C
+++ b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
@@ -1,7 +1,7 @@
 // Test that we don't need libsupc++ just for __cxa_pure_virtual.
 // { dg-do link }
 // { dg-require-weak }
-// { dg-additional-options "-fno-rtti -nodefaultlibs -lc" }
+// { dg-additional-options "-fno-rtti -nolibstdc++" }
 // { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } }
 // { dg-xfail-if "AIX weak" { powerpc-ibm-aix* } }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] Introduce -nolibstdc++ option
@ 2022-06-21  0:08 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-21  0:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0d4d8a3e90d79b1659db9331a00db86f8ba35420

commit 0d4d8a3e90d79b1659db9331a00db86f8ba35420
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jun 20 19:44:23 2022 -0300

    Introduce -nolibstdc++ option
    
    Using g++ to link without libstdc++, as in g++.dg/abi/pure-virtual1.C,
    is error prone, because there's no way to tell g++ to drop libstdc++
    without also dropping libc and any other libraries that the target
    implicitly links in.
    
    This has often led to the need for manual adjustments to this
    testcase.
    
    I figured adding support for -nolibstdc++, even though redundant,
    makes some sense.  One could presumably use gcc rather than g++ for
    linking, for the same effect, but sometimes changing the link command
    is harder than adding an option, as in our testsuite.
    
    
    for  gcc/ChangeLog
    
            * common.opt (nolibstdc++): New.
            * doc/invoke.texi (-nolibstdc++): Document it.
    
    for  gcc/cp/ChangeLog
    
            * g++spec.c (lang_specific_driver): Implement -nolibstdc++.
    
    for  gcc/testsuite/ChangeLog
    
            * g++.dg/abi/pure-virtual1.C: Use -nolibstdc++.
    
    TN: V526-020

Diff:
---
 gcc/common.opt                           | 3 +++
 gcc/cp/g++spec.cc                        | 1 +
 gcc/doc/invoke.texi                      | 6 +++++-
 gcc/testsuite/g++.dg/abi/pure-virtual1.C | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 32917aafcae..e00c6fc2fb0 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3456,6 +3456,9 @@ Driver
 nolibc
 Driver
 
+nolibstdc++
+Driver
+
 nostdlib
 Driver
 
diff --git a/gcc/cp/g++spec.cc b/gcc/cp/g++spec.cc
index 8174d652776..539e6ca089d 100644
--- a/gcc/cp/g++spec.cc
+++ b/gcc/cp/g++spec.cc
@@ -160,6 +160,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
 	{
 	case OPT_nostdlib:
 	case OPT_nodefaultlibs:
+	case OPT_nolibstdc__:
 	  library = -1;
 	  break;
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 50f57877477..469b6d97e0d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -652,7 +652,7 @@ Objective-C and Objective-C++ Dialects}.
 @item Linker Options
 @xref{Link Options,,Options for Linking}.
 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
--nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
+-nostartfiles  -nodefaultlibs  -nolibc  -nolibstdc++  -nostdlib @gol
 -e @var{entry}  --entry=@var{entry} @gol
 -pie  -pthread  -r  -rdynamic @gol
 -s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
@@ -16787,6 +16787,10 @@ absence of a C library is assumed, for example @option{-lpthread} or
 @option{-lm} in some configurations.  This is intended for bare-board
 targets when there is indeed no C library available.
 
+@item -nolibstdc++
+@opindex nolibstdc++
+Do not link with standard C++ libraries implicitly.
+
 @item -nostdlib
 @opindex nostdlib
 Do not use the standard system startup files or libraries when linking.
diff --git a/gcc/testsuite/g++.dg/abi/pure-virtual1.C b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
index 538e2cb097a..889c33e4952 100644
--- a/gcc/testsuite/g++.dg/abi/pure-virtual1.C
+++ b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
@@ -1,7 +1,7 @@
 // Test that we don't need libsupc++ just for __cxa_pure_virtual.
 // { dg-do link }
 // { dg-require-weak }
-// { dg-additional-options "-fno-rtti -nodefaultlibs -lc" }
+// { dg-additional-options "-fno-rtti -nolibstdc++" }
 // { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } }
 // { dg-xfail-if "AIX weak" { powerpc-ibm-aix* } }


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-22  5:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22  5:22 [gcc(refs/users/aoliva/heads/testme)] Introduce -nolibstdc++ option Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2022-06-21  0:16 Alexandre Oliva
2022-06-21  0:08 Alexandre Oliva

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).