public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: brendan@zen.org
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/10246: libsupc++ needs to be independent (again) of libstdc++
Date: Thu, 27 Mar 2003 17:46:00 -0000	[thread overview]
Message-ID: <20030327171938.8887.qmail@sources.redhat.com> (raw)


>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);
}


                 reply	other threads:[~2003-03-27 17:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030327171938.8887.qmail@sources.redhat.com \
    --to=brendan@zen.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).