From patchwork Fri Dec 21 09:59:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 207774 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C48042C0092 for ; Fri, 21 Dec 2012 20:59:50 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1356688791; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=AoBQdD+w6wbEO9OAhXj80quqEZ4=; b=Sb6yStx315iNrbx9aai02UtJDQ3oB9ZPhyfcFzDp7YO9aivhpyrwBP2EPvHJF9 U79IbD5ZK4f51QXf7TR42R0Q638iBICRDuVyuc2FTmdaKeiBx0h0e4GzgjXOLd3L rGV5YQGj3b8SJw0e5bEYTkh7HiLsKWBqOmfnKN5fPfCVI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=v33tG6Q58ejBMxjtXbO5y9FEP4B3Ywky3WFGOnX9DeI8Bn9PGlp6x4UDXpE6gs bnPjx545ngp2Cq5a+/cYLGl2d6HtJ45q2KCO+S+IhHh+cK+RsgBpQXA6YC21DXtG NBNAy9Vuc4Oj8bf6L1xGN7lReY6L4vSyZfVuaJE04u9xA=; Received: (qmail 1760 invoked by alias); 21 Dec 2012 09:59:46 -0000 Received: (qmail 1742 invoked by uid 22791); 21 Dec 2012 09:59:45 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL, BAYES_05, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_CX X-Spam-Check-By: sourceware.org Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Dec 2012 09:59:38 +0000 Received: by mail-wi0-f179.google.com with SMTP id o1so2594422wic.12 for ; Fri, 21 Dec 2012 01:59:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.20.109 with SMTP id m13mr22305338wie.16.1356083977158; Fri, 21 Dec 2012 01:59:37 -0800 (PST) Received: by 10.216.153.132 with HTTP; Fri, 21 Dec 2012 01:59:37 -0800 (PST) In-Reply-To: References: <50D42823.9030601@oracle.com> <50D42CAB.4090704@oracle.com> <50D42E31.30807@oracle.com> Date: Fri, 21 Dec 2012 10:59:37 +0100 Message-ID: Subject: Re: [patch libstdc++]: Fix LLP64 pointer-size issues for cxxabi, eh_alloc, and hash_bytes From: Kai Tietz To: Paolo Carlini Cc: GCC Patches , "libstdc++" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello, I changed type in __base_class_type_info to wide-enough type only for llp64 target. By this we have no (new) side-effects to other targets. ChangeLog 2012-12-21 Kai Tietz * config/os/mingw32/os_defines.h (_GLIBCXX_LLP64): Define if llp64 abi is used. * config/os/mingw32-w64/os_defines.h: Likewise. * libsupc++/cxxabi.h (__base_class_type_info): Adjust type of __offset_flags for llp64. * libsupc++/eh_alloc.cc (EMERGENCY_OBJ_SIZE): Define proper for llp64 abi. (EMERGENCY_OBJ_COUNT): Likewise. (bitmask_type): Likewise. * ibsupc++/hash_bytes.cc (_Hash_bytes): Handle llp64. Tested for i686-w64-mingw32, x86_64-w64-mingw32, and x86_64-unknown-linux-gnu. Ok for apply? Regards, Kai Index: testsuite/19_diagnostics/error_condition/operators/equal.cc =================================================================== --- testsuite/19_diagnostics/error_condition/operators/equal.cc (Revision 194655) +++ testsuite/19_diagnostics/error_condition/operators/equal.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } } // Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Index: testsuite/19_diagnostics/error_condition/operators/not_equal.cc =================================================================== --- testsuite/19_diagnostics/error_condition/operators/not_equal.cc (Revision 194655) +++ testsuite/19_diagnostics/error_condition/operators/not_equal.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } } // Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Index: config/os/mingw32/os_defines.h =================================================================== --- config/os/mingw32/os_defines.h (Revision 194655) +++ config/os/mingw32/os_defines.h (Arbeitskopie) @@ -72,4 +72,8 @@ #define _GLIBCXX_CDTOR_CALLABI __thiscall #endif +#ifdef __x86_64__ +#define _GLIBCXX_LLP64 1 #endif + +#endif Index: config/os/mingw32-w64/os_defines.h =================================================================== --- config/os/mingw32-w64/os_defines.h (Revision 194655) +++ config/os/mingw32-w64/os_defines.h (Arbeitskopie) @@ -74,4 +74,8 @@ #define _GLIBCXX_CDTOR_CALLABI __thiscall #endif +#ifdef __x86_64__ +#define _GLIBCXX_LLP64 1 #endif + +#endif Index: libsupc++/cxxabi.h =================================================================== --- libsupc++/cxxabi.h (Revision 194655) +++ libsupc++/cxxabi.h (Arbeitskopie) @@ -356,7 +356,11 @@ namespace __cxxabiv1 { public: const __class_type_info* __base_type; // Base class type. +#ifdef _GLIBCXX_LLP64 + long long __offset_flags; // Offset and info. +#else long __offset_flags; // Offset and info. +#endif enum __offset_flags_masks { Index: libsupc++/eh_alloc.cc =================================================================== --- libsupc++/eh_alloc.cc (Revision 194655) +++ libsupc++/eh_alloc.cc (Arbeitskopie) @@ -60,7 +60,7 @@ using namespace __cxxabiv1; #if INT_MAX == 32767 # define EMERGENCY_OBJ_SIZE 128 # define EMERGENCY_OBJ_COUNT 16 -#elif LONG_MAX == 2147483647 +#elif !defined (_GLIBCXX_LLP64) && LONG_MAX == 2147483647 # define EMERGENCY_OBJ_SIZE 512 # define EMERGENCY_OBJ_COUNT 32 #else @@ -76,8 +76,12 @@ using namespace __cxxabiv1; #if INT_MAX == 32767 || EMERGENCY_OBJ_COUNT <= 32 typedef unsigned int bitmask_type; #else +#if defined (_GLIBCXX_LLP64) +typedef unsigned long long bitmask_type; +#else typedef unsigned long bitmask_type; #endif +#endif typedef char one_buffer[EMERGENCY_OBJ_SIZE] __attribute__((aligned)); Index: libsupc++/hash_bytes.cc =================================================================== --- libsupc++/hash_bytes.cc (Revision 194655) +++ libsupc++/hash_bytes.cc (Arbeitskopie) @@ -128,7 +128,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION size_t _Hash_bytes(const void* ptr, size_t len, size_t seed) { - static const size_t mul = (0xc6a4a793UL << 32UL) + 0x5bd1e995UL; + static const size_t mul = (((size_t) 0xc6a4a793UL) << 32UL) + + (size_t) 0x5bd1e995UL; const char* const buf = static_cast(ptr); // Remove the bytes not divisible by the sizeof(size_t). This Index: testsuite/18_support/50594.cc =================================================================== --- testsuite/18_support/50594.cc (Revision 194655) +++ testsuite/18_support/50594.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-fwhole-program" } +// { dg-options "-fwhole-program -static-libstdc++" { target *-*-mingw* } } // Copyright (C) 2011 Free Software Foundation // Index: testsuite/19_diagnostics/error_code/cons/1.cc =================================================================== --- testsuite/19_diagnostics/error_code/cons/1.cc (Revision 194655) +++ testsuite/19_diagnostics/error_code/cons/1.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } } // 2007-08-22 Benjamin Kosnik // Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. Index: testsuite/19_diagnostics/error_code/operators/bool.cc =================================================================== --- testsuite/19_diagnostics/error_code/operators/bool.cc (Revision 194655) +++ testsuite/19_diagnostics/error_code/operators/bool.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } } // 2007-08-22 Benjamin Kosnik // Copyright (C) 2007, 2009 Free Software Foundation, Inc. Index: testsuite/19_diagnostics/error_code/operators/equal.cc =================================================================== --- testsuite/19_diagnostics/error_code/operators/equal.cc (Revision 194655) +++ testsuite/19_diagnostics/error_code/operators/equal.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } } // 2007-08-22 Benjamin Kosnik // Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. Index: testsuite/19_diagnostics/error_code/operators/not_equal.cc =================================================================== --- testsuite/19_diagnostics/error_code/operators/not_equal.cc (Revision 194655) +++ testsuite/19_diagnostics/error_code/operators/not_equal.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } } // 2007-08-22 Benjamin Kosnik // Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. Index: testsuite/19_diagnostics/error_condition/cons/1.cc =================================================================== --- testsuite/19_diagnostics/error_condition/cons/1.cc (Revision 194655) +++ testsuite/19_diagnostics/error_condition/cons/1.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-additional-options "-static-libstdc++" { target *-*-mingw* } } // Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Index: testsuite/19_diagnostics/error_condition/operators/bool.cc =================================================================== --- testsuite/19_diagnostics/error_condition/operators/bool.cc (Revision 194655) +++ testsuite/19_diagnostics/error_condition/operators/bool.cc (Arbeitskopie) @@ -1,4 +1,5 @@ // { dg-options "-std=gnu++0x" } +// { dg-options "-std=gnu++0x -static-libstdc++" { target *-*-mingw* } } // Copyright (C) 2008, 2009 Free Software Foundation, Inc. //