Hi Alexandre, Alexandre Oliva via Gcc-patches writes: > Hello, Gerald, > > On Feb 11, 2023, Gerald Pfeifer wrote: > >> On Thu, 23 Jun 2022, Alexandre Oliva via Gcc-patches wrote: >>> Introduce -nostdlib++ 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. > >> % grep -r nostdlib $WWWDOCS >> % > >> Should this be documented in gcc-13/changes.html? Would you mind proposing >> a snippet (or going ahead and pushing it)? > > I can't make my mind up about this. > > At first, the goal of adding the option was just to aid this specific > test. But then, it transpired that other compilers offered a similar > option, with the spelling that we ended up using, so perhaps it would > make sense to document it, after all. IMO, yes - in fact, the libstdc++ manual even has a use-case for this (freestanding when the compiler is *not* built with libstdc++ in freestanding mode) and documents using the gcc driver rather than the g++ one. See libstdc++-v3/doc/xml/manual/using.xml: If you're using a libstdc++ configured for hosted environments, and would like to not involve the libraries libstdc++ would depend on in your programs, you will need to use gcc to link your application with only libsupc++.a, like so: If you think the flag you added fits here, would you mind also including this file in your patch? Note that this flag is only applicable here if MATH_LIBRARY is omitted but libsupc++.a is kept on the linker command line (apologies for not checking ahead of writing this email - I'm not currently in a convenient spot to do so). Thanks in advance, have a lovely day. > How about this, does this seem useful? > > diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html > index ff70d2eefecec..c1bbbfa28e18e 100644 > --- a/htdocs/gcc-13/changes.html > +++ b/htdocs/gcc-13/changes.html > @@ -333,6 +333,9 @@ a work-in-progress.

>
  • The -Wpessimizing-move > and -Wredundant-move > warnings have been extended to warn in more contexts.
  • > +
  • The -nostdlib++ > + option has been added, to enable linking with g++ > + without implicitly linking in the C++ standard library.
  • > > >

    Runtime Library (libstdc++)

    -- Arsen Arsenović