From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28492 invoked by alias); 15 Jun 2012 17:47:22 -0000 Received: (qmail 28268 invoked by uid 22791); 15 Jun 2012 17:47:20 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED,TW_CX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Jun 2012 17:47:07 +0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53673] Add magic weak symbol to indicate C++ standard setting (C++03, C++11 etc) to help debug ABI problems Date: Fri, 15 Jun 2012 17:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg01039.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53673 --- Comment #7 from Jonathan Wakely 2012-06-15 17:46:51 UTC --- (In reply to comment #6) > Technically, you could add it to the top of or whatever is a > guaranteed included library header: libstdc++'s would be the right place and as part of the std lib the symbol should probably be named __glibcxx_blah I think you'd also need an actual definition or nothing will be emitted for the declaration alone: #if __GXX_WEAK__ #if __cplusplus == 201103L extern "C" void __glibcxx_std_cxx11() __attribute__((weak)); extern "C" void __glibcxx_std_cxx11() { } #else if __cplusplus == 199711L extern "C" void __glibcxx_std_cxx98() __attribute__((weak)); extern "C" void __glibcxx_std_cxx98() { } #else #warning Unknown C++ standard version #endif #endif > No, it's fair enough, I only know that from watching the discussions on ISO and > I have no idea if it's actually written in the final published standard. It is > however written in Nicolai Josuttis' updated C++11 "The C++ standard library" > in the chapter on C++11 core language changes. And if you think it through, > there has to be in practice ABI breakage in 03 ABIs because no one could have > anticipated during their design of what 11 would require [1]. > > [1]: This may not apply to GCC as it revised its ABI quite recently, and I'm > sure its designers took into account likely future 11 requirements. The current G++ ABI is eight years old and (modulo bugs) the same for c++98 and c++11, see Bug 53646 comment 17 Again, the incompatibilities are in the library not the core language. Whether that's generally true for other compilers is irrelevant here.