Patch for IA64 32-bit function descriptors

Benjamin Kosnik bkoz@redhat.com
Fri Jun 14 14:31:00 GMT 2002


> We do hope the change can go back to FSF tree, without the patch, C++
> is totally broken on IA64 HPUX. Is there a way to change the source
> file(tinfo.cc ) at configuration time? Thanks.

The patch is currently not acceptable. Here's a different way to do it
that is more palatable: I'd appreciate it if you could formulate
something along these lines.

It would be nice to do something like

  // Offset to most derived object.
#ifdef _GLIBCPP_VTABLE_PADDING
  ptrdiff_t whole_object __attribute__
((aligned(__alignof__(_GLIBCPP_VTABLE_PADDING))));
#else
  ptrdiff_t whole_object; 
#endif
 
instead of:
  // Offset to most derived object.
  ptrdiff_t whole_object;           
#ifdef _GLIBCPP_VTABLE_PADDING
  __padding_type padding1;
#endif
 
But I'm not quite sure this will work with the odd alignment issues with
IA64 HPUX.

2002-06-14  Benjamin Kosnik  <bkoz@redhat.com>

	* config/os/hpux/bits/os_defines.h (__padding_type): Add.
	(_GLIBCPP_VTABLE_PADDING): Define.
	* libsupc++/tinfo.cc (struct vtable_prefix ): Add padding.

Index: config/os/hpux/bits/os_defines.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/hpux/bits/os_defines.h,v
retrieving revision 1.10
diff -c -p -r1.10 os_defines.h
*** config/os/hpux/bits/os_defines.h	30 Apr 2002 19:50:29 -0000	1.10
--- config/os/hpux/bits/os_defines.h	14 Jun 2002 21:20:22 -0000
***************
*** 1,6 ****
! // Specific definitions for generic platforms  -*- C++ -*-
  
! // Copyright (C) 2000 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
--- 1,6 ----
! // Specific definitions for HPUX  -*- C++ -*-
  
! // Copyright (C) 2000, 2002 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
***************
*** 62,68 ****
  
     We also force _GLIBCPP_USE_LONG_LONG here so that we don't have
     to bastardize configure to deal with this sillyness.  */
! namespace std {
  #ifndef __LP64__
    __extension__ extern "C" long long strtoll (const char *, char **,
int)
      __asm  ("__strtoll");
--- 62,69 ----
  
     We also force _GLIBCPP_USE_LONG_LONG here so that we don't have
     to bastardize configure to deal with this sillyness.  */
! namespace std 
! {
  #ifndef __LP64__
    __extension__ extern "C" long long strtoll (const char *, char **,
int)
      __asm  ("__strtoll");
*************** namespace std {
*** 75,79 ****
--- 76,87 ----
      __asm  ("strtoul");
  #endif
  }
+ 
  #define _GLIBCPP_USE_LONG_LONG 1
+ 
+ #if !defined(_LP64) && defined (__ia64__)
+ # define _GLIBCPP_VTABLE_PADDING 8
+ typedef ptrdiff_t __padding_type;
+ #endif
+ 
  #endif
Index: libsupc++/tinfo.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/tinfo.cc,v
retrieving revision 1.9
diff -c -p -r1.9 tinfo.cc
*** libsupc++/tinfo.cc	9 Jan 2002 20:39:27 -0000	1.9
--- libsupc++/tinfo.cc	14 Jun 2002 21:20:26 -0000
*************** namespace {
*** 91,102 ****
  using namespace std;
  using namespace abi;
  
! // initial part of a vtable, this structure is used with offsetof, so
we don't
! // have to keep alignments consistent manually.
! struct vtable_prefix {
!   ptrdiff_t whole_object;           // offset to most derived object
!   const __class_type_info *whole_type;  // pointer to most derived
type_info
!   const void *origin;               // what a class's vptr points to
  };
  
  template <typename T>
--- 91,115 ----
  using namespace std;
  using namespace abi;
  
! // Initial part of a vtable, this structure is used with offsetof, so
! // we don't have to keep alignments consistent manually.  Some targets
! // require additional padding: if so, os_defines.h sets this up.
! struct vtable_prefix 
! {
!   // Offset to most derived object.
!   ptrdiff_t whole_object;           
! #ifdef _GLIBCPP_VTABLE_PADDING
!   __padding_type padding1;
! #endif
!   
!   // Pointer to most derived type_info.
!   const __class_type_info *whole_type;  
! #ifdef _GLIBCPP_VTABLE_PADDING
!   __padding_type padding1;
! #endif
! 
!   // What a class's vptr points to.
!   const void *origin;               
  };
  
  template <typename T>



More information about the Libstdc++ mailing list