This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: Patch for IA64 32-bit function descriptors
- From: "Jessica Han" <jessica at cup dot hp dot com>
- To: <bkoz at redhat dot com>, <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 21 Jun 2002 14:40:52 -0700
- Subject: RE: Patch for IA64 32-bit function descriptors
- Reply-to: <jessica at cup dot hp dot com>
>-----Original Message-----
>From: Benjamin Kosnik [mailto:bkoz@redhat.com]
>> Unfortunately,
>> attribute__ ((aligned(__alignof__(_GLIBCPP_VTABLE_PADDING))));
>> doesn't work for HP-UX on IA64.
>
>Why?
>
Because the alignment doesn't make a different in my struct lay out. I have
a test case like is:
t.c
struct mystruct{
int *i1 __attribute__ ((aligned(__alignof__(16))));
int *i2 __attribute__ ((aligned(__alignof__(16))));
int i3;
};
int main(){
struct mystruct m;
printf(" address if i1 is %p, address of i2 is %p , address of i3 is
%p\n",
&m.i1, &m.i2, &m.i3);
printf("the size is %d\n", sizeof(m));
}
I compiled it on IA64 Linux with GCC 3.1, the output is
address if i1 is 0x80000fffffffbab0, address of i2 is 0x80000fffffffbab8 ,
address of i3 is 0x80000fffffffbac0
the size is 24.
Following is the patch I came up based on your template. Thanks.
2002-06-21 Jessica Han <jessica@cup.hp.com>
* config/os/hpux/os_defines.h Define _GLIBCPP_VTABLE_PADDING
* libsupc++/tinfo.cc Handle the 8 byte aligned vtable entries when
_GLIBCPP_VTABLE_PADDING is defined.
*** os_defines.h.1.10 Thu Jun 20 14:43:42 2002
--- os_defines.h Thu Jun 20 14:52:05 2002
*************** namespace std {
*** 76,79 ****
--- 76,87 ----
#endif
}
#define _GLIBCPP_USE_LONG_LONG 1
+
+ /* HPUX on IA64 requires vtable to be 64 bit aligned even at 32 bit mode.
We
+ need to pad the vtable structure to achieve this. */
+ #if !defined(_LP64) && defined (__ia64__)
+ #define _GLIBCPP_VTABLE_PADDING 8
+ typedef long int __padding_type;
+ #endif
+
#endif
*** tinfo.cc.1.9 Thu Jun 20 14:43:00 2002
--- tinfo.cc Fri Jun 21 14:35:25 2002
***************
*** 29,34 ****
--- 29,35 ----
// the GNU General Public License.
#include <cstddef>
+ #include <bits/c++config.h>
#include "tinfo.h"
#include "new" // for placement new
*************** using namespace abi;
*** 95,101 ****
--- 96,108 ----
// have to keep alignments consistent manually.
struct vtable_prefix {
ptrdiff_t whole_object; // offset to most derived object
+ #ifdef _GLIBCPP_VTABLE_PADDING
+ ptrdiff_t padding1; // additional padding if necessary
+ #endif
const __class_type_info *whole_type; // pointer to most derived
type_info
+ #ifdef _GLIBCPP_VTABLE_PADDING
+ ptrdiff_t padding2; // additional padding if necessary
+ #endif
const void *origin; // what a class's vptr points to
};
----
Jessica Han
Open Source Tools
Hewlett-Packard
(408) 447-6154