From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7822 invoked by alias); 22 Apr 2003 16:22:31 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 7815 invoked from network); 22 Apr 2003 16:22:31 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 22 Apr 2003 16:22:31 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h3MGMTD01915; Tue, 22 Apr 2003 12:22:29 -0400 Received: from redhat.com (IDENT:fekwGOFbgZ4OcRsHXLhhno57QkGp/2qh@vpn50-32.rdu.redhat.com [172.16.50.32]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h3MGMSq11157; Tue, 22 Apr 2003 12:22:28 -0400 Received: (from aph@localhost) by redhat.com (8.11.6/8.11.0) id h3MGMOQ15399; Tue, 22 Apr 2003 17:22:24 +0100 From: Andrew Haley MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16037.27712.70828.603561@cuddles.redhat.com> Date: Tue, 22 Apr 2003 17:19:00 -0000 To: Nicola Pero Cc: Jason Merrill , Robert Dewar , , , Subject: Re: On alignment In-Reply-To: References: X-SW-Source: 2003-04/txt/msg01071.txt.bz2 Nicola Pero writes: > > > > > > That packing rule is part of the i86 psABI > > > > > > > > It's still mighty odd, and of course in Ada you have to override this rule > > > > since it conflicts with the Ada standard, which requires that the default > > > > minimum alignment of a composite be not less than the alignment of any > > > > component. > > > > > > It's pretty weird in C++. > > > > It's the same in C. Weird or not, that's what the SVR4 psABI says, so > > that's what we do. > > I suspect this is not just weird, but it would have consequences > for Objective-C. > > The ObjC runtime library is supposed to be able to compute > alignments in structures at runtime (for various tasks, like > encoding / decoding / forwarding). > > At runtime, the ObjC runtime library has information about the > struct - the type of each member. At the moment, it loops on the > struct members, and uses __alignof__ on each of them to get the > alignment of that member inside the struct (then, can read/write > the struct members). That's what we do in gcj, and that is precisely why I raised the issue. > As far as I understand from this discussion, this doesn't work any > longer. > > For a typical example, look at libobjc/archive.c, functions > objc_write_type() and objc_read_type(). > > Assuming that we have to live with this weird ABI thing, what > alternative is there in order to compute alignments inside structs > at runtime ? > > In other words, how can objc_write_type() and objc_read_type() be > fixed/rewritten in order to work with the weird/unsane ABI thing ? You have to create a struct that contains each base type and look at its alignment. Andrew.