public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/10246: libsupc++ needs to be independent (again) of libstdc++
@ 2003-03-27 17:46 brendan
  0 siblings, 0 replies; only message in thread
From: brendan @ 2003-03-27 17:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10246
>Category:       libstdc++
>Synopsis:       libsupc++ needs to be independent (again) of libstdc++
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 27 17:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Brendan Kehoe
>Release:        CVS tree 2003-03-27
>Organization:
>Environment:
n/a
>Description:
In the FAQ in docs/html/faq, $2.4 says:

   If the only functions from libstdc++.a which you need are language
   support functions (those listed in [73]clause 18 of the standard,
   e.g., new and delete), then try linking against libsupc++.a (usually
   specifying -lsupc++ when calling g++ for the final link step will do
   it). This library contains only those support routines, one per object
   file. But if you are using anything from the rest of the library, such
   as IOStreams or vectors, then you'll still need pieces from
   libstdc++.a.


Thus, given a test that does very little, you'd expect that compiling it with

    gcc test.cpp -lsupc++

would succeed.  However, with the attached test that does a call to std::terminate(), the current devo tree (don't know about 3.3's branch) will fail to link with

/home/brendan/gcc/libstdc++-v3/libsupc++/vterminate.cc:66: undefined reference to `__cxa_demangle'


This added the use of demangling in terminate:

	2002-04-01 Phil Edwards <pme@gcc.gnu.org>

        * config/linker-map.gnu:  Export __verbose_terminate_handler.
        * libsupc++/Makefile.am (sources):  Add cxa_demangle.c, dyn-string.c.
        Make new LTCOMPILE variable, use it in new special build rules.
        * libsupc++/Makefile.in:  Rebuild.
        * src/vterminate.cc (__verbose_terminate_handler):  Enable use of
        runtime __cxa_demangle.

And then vterminate moved to libsupc++ as well:

	2002-12-25  Phil Edwards  <pme@gcc.gnu.org>

	* src/vterminate.cc:  Move to...
	* libsupc++/vterminate.cc:  ...here.  New file.  Replace fprintf with
	writestr macro.  Slight reword to explanatory text.
	...

And recently, demangle moved out of libsupc++:

	2003-02-27  Benjamin Kosnik  <bkoz@redhat.com>

        * src/Makefile.am (sources): Add demangle.cc.
        (demangle.o): Add.
        (demangle.lo): Add.     
        * src/Makefile.in: Regenerate.
        * libsupc++/Makefile.am: Remove old __cxa_demangle bits.
        * libsupc++/Makefile.in: Regenerate.


I believe that demangling has to go back into libsupc++ in order for  __verbose_terminate_handler to be able to use __cxa_demangle.

>How-To-Repeat:
Build & link the test with gcc 3.2 doing just
  gcc call-terminate.cpp -o t -lsupc++
You can then run ./t and see it call abort() from terminate().
But then build and link it with a source tree checked out since late February, and you'll get the error that the linker can't resolve __cxa_terminate.
>Fix:
Move the demangler from libstdc++ to libsupc++.

Or, make libstdc++-v3/libsupc++/eh_term_handler.cc not use __gnu_cxx::__verbose_terminate_handler as the default for __cxxabiv1::__terminate_handler, at least for cases where the rest of libstdc++ is not provided.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="call-terminate.cpp"
Content-Disposition: inline; filename="call-terminate.cpp"

#include <exception>
#include <cstdlib>

void foo () { throw 0; }

int main ()
{
  try { foo (); } catch (int x) { std::terminate(); }
  ::exit (1);
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-27 17:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-27 17:46 libstdc++/10246: libsupc++ needs to be independent (again) of libstdc++ brendan

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