diff --git a/gcc/common.opt b/gcc/common.opt index ed50f77848d..e7a51e882ba 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -3467,6 +3467,9 @@ Driver nostdlib Driver +nostdlib++ +Driver + o Common Driver Joined Separate Var(asm_file_name) MissingArgError(missing filename after %qs) -o Place output into . diff --git a/gcc/cp/g++spec.cc b/gcc/cp/g++spec.cc index 8174d652776..b63d8350ba1 100644 --- a/gcc/cp/g++spec.cc +++ b/gcc/cp/g++spec.cc @@ -159,6 +159,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, switch (decoded_options[i].opt_index) { case OPT_nostdlib: + case OPT_nostdlib__: case OPT_nodefaultlibs: library = -1; break; diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 07a1bf40ad9..f794edd49e1 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -653,7 +653,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 -nostdlib -nostdlib++ @gol -e @var{entry} --entry=@var{entry} @gol -pie -pthread -r -rdynamic @gol -s -static -static-pie -static-libgcc -static-libstdc++ @gol @@ -16846,6 +16846,10 @@ library subroutines. constructors are called; @pxref{Collect2,,@code{collect2}, gccint, GNU Compiler Collection (GCC) Internals}.) +@item -nostdlib++ +@opindex nostdlib++ +Do not implicitly link with standard C++ libraries. + @item -e @var{entry} @itemx --entry=@var{entry} @opindex e diff --git a/gcc/testsuite/g++.dg/abi/pure-virtual1.C b/gcc/testsuite/g++.dg/abi/pure-virtual1.C index 538e2cb097a..59eaf225620 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 -nostdlib++" } // { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } } // { dg-xfail-if "AIX weak" { powerpc-ibm-aix* } }