From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12395 invoked by alias); 27 Mar 2003 17:26:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12361 invoked by uid 71); 27 Mar 2003 17:26:00 -0000 Resent-Date: 27 Mar 2003 17:26:00 -0000 Resent-Message-ID: <20030327172600.12360.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, brendan@zen.org Received: (qmail 8889 invoked by uid 48); 27 Mar 2003 17:19:38 -0000 Message-Id: <20030327171938.8887.qmail@sources.redhat.com> Date: Thu, 27 Mar 2003 17:46:00 -0000 From: brendan@zen.org Reply-To: brendan@zen.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/10246: libsupc++ needs to be independent (again) of libstdc++ X-SW-Source: 2003-03/txt/msg01921.txt.bz2 List-Id: >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 * 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 * 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 * 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 #include void foo () { throw 0; } int main () { try { foo (); } catch (int x) { std::terminate(); } ::exit (1); }