public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Kai Tietz <ktietz70@googlemail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [patch libstdc++]: Fix LLP64 pointer-size issues for cxxabi, eh_alloc, and hash_bytes
Date: Fri, 21 Dec 2012 14:59:00 -0000	[thread overview]
Message-ID: <CAAiZkiBPNnJzaA90AapEYeoix1zzo2ps5v_w93vm-dj_exH=yQ@mail.gmail.com> (raw)
In-Reply-To: <CAEwic4ZULebuGWNVcL0TpW34eDr9UzpQfCMyGOCbko7sGaqVSg@mail.gmail.com>

On Fri, Dec 21, 2012 at 1:59 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hello,
>
> this patch fixes some remaining issues with pointer-sizes for llp64
> abi in libstdc++.

See comments below.
>
> 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): Change
>         type __offset_flags to intptr_t.
>         * 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: 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,7 @@ namespace __cxxabiv1
>    {
>    public:
>      const __class_type_info*   __base_type;  // Base class type.
> -    long                       __offset_flags;  // Offset and info.
> +    intptr_t                   __offset_flags;  // Offset and info.

this should use ptrdiff_t.

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

Use size_t here


>
>
>  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<const char*>(ptr);
>
>      // Remove the bytes not divisible by the sizeof(size_t).  This

  parent reply	other threads:[~2012-12-21 14:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21  8:00 Kai Tietz
2012-12-21  9:12 ` Marc Glisse
2012-12-21  9:13 ` Paolo Carlini
2012-12-21  9:16   ` Kai Tietz
2012-12-21  9:32     ` Paolo Carlini
2012-12-21  9:36       ` Kai Tietz
2012-12-21  9:39         ` Paolo Carlini
2012-12-21  9:48           ` Kai Tietz
2012-12-21  9:59             ` Kai Tietz
2012-12-21 10:02               ` Paolo Carlini
2012-12-21 15:04             ` Gabriel Dos Reis
2012-12-21 15:54               ` Kai Tietz
2012-12-21 14:59 ` Gabriel Dos Reis [this message]
2012-12-21 10:13 Uros Bizjak
2012-12-21 10:16 ` Kai Tietz

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='CAAiZkiBPNnJzaA90AapEYeoix1zzo2ps5v_w93vm-dj_exH=yQ@mail.gmail.com' \
    --to=gdr@integrable-solutions.net \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ktietz70@googlemail.com \
    --cc=libstdc++@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).