From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31444 invoked by alias); 29 Apr 2005 06:31:28 -0000 Mailing-List: contact ecos-devel-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@sources.redhat.com Received: (qmail 31343 invoked from network); 29 Apr 2005 06:31:12 -0000 Received: from unknown (HELO europa.telenet-ops.be) (195.130.132.60) by sourceware.org with SMTP; 29 Apr 2005 06:31:12 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by europa.telenet-ops.be (Postfix) with SMTP id EE5E1198050; Fri, 29 Apr 2005 08:31:11 +0200 (MEST) Received: from p4 (d51A52AE6.access.telenet.be [81.165.42.230]) by europa.telenet-ops.be (Postfix) with ESMTP id A98F419805D; Fri, 29 Apr 2005 08:31:11 +0200 (MEST) Received: by p4 (Postfix, from userid 1000) id 2413F2DECF6; Fri, 29 Apr 2005 08:31:52 +0200 (CEST) To: Bart Veer Cc: ecos-devel@ecos.sourceware.org Subject: Re: CYG_HAL_TABLE_END alignment References: <87zmvig5k6.fsf@p4.48ers.dk> <20050428192809.2FDA665C099@smtp.ecoscentric.com> From: Peter Korsgaard Date: Fri, 29 Apr 2005 06:31:00 -0000 In-Reply-To: <20050428192809.2FDA665C099@smtp.ecoscentric.com> (Bart Veer's message of "Thu, 28 Apr 2005 20:28:09 +0100 (BST)") Message-ID: <87zmvi8560.fsf@p4.48ers.dk> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-04/txt/msg00018.txt.bz2 >>>>> "Bart" == Bart Veer writes: Bart> struct fred { Bart> cyg_uint32 a; Bart> cyg_uint8 b[3]; Bart> } Bart> On most architectures the compiler and linker will arrange for Bart> the start of this structure to be aligned to a 4-byte boundary, Bart> i.e. a byte of padding gets inserted. When the compiler Bart> iterates through the table it thinks it has a fred[] array with Bart> each entry properly aligned. The linker does not see an array, Bart> it gets a number of individual variables, but it will align Bart> each one's start to the appropriate boundary. So no problems so Bart> far. Yes, but the padding byte is "inside" the structure, E.G. sizeof(struct fred) == 8 - isn't it? Bart> Linker alignment only applies to the start of a structure, not Bart> the end. Therefore when the linker places the end of the table Bart> label this would appear immediately after the last entry, Bart> without the padding. That is a bad idea so the end is Bart> explicitly aligned in the code. But immediately after the last entry is correct, as that is where the next element would be placed. To me the alignment directive should simply be removed from the CYG_HAL_TABLE_END macro - or am I missing something? Bart> P.S. I'll take a look at your I2C patches when I get a chance, Bart> probably this weekend. Thanks! -- Bye, Peter Korsgaard