From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Iqsg1-00052n-Oh for mharc-grub-devel@gnu.org; Sat, 10 Nov 2007 10:55:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iqsg0-00050K-LK for grub-devel@gnu.org; Sat, 10 Nov 2007 10:55:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iqsfx-0004s5-PN for grub-devel@gnu.org; Sat, 10 Nov 2007 10:55:16 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iqsfx-0004rd-KL for grub-devel@gnu.org; Sat, 10 Nov 2007 10:55:13 -0500 Received: from smtp-vbr11.xs4all.nl ([194.109.24.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iqsfw-00064P-IN for grub-devel@gnu.org; Sat, 10 Nov 2007 10:55:13 -0500 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr11.xs4all.nl (8.13.8/8.13.8) with ESMTP id lAAFtBY9010169 for ; Sat, 10 Nov 2007 16:55:11 +0100 (CET) (envelope-from mgerards@xs4all.nl) From: Marco Gerards To: The development of GRUB 2 References: <471D0F5B.20805@t-online.de> <87hcjvmsc7.fsf@xs4all.nl> <4734BB45.2030909@t-online.de> Mail-Copies-To: mgerards@xs4all.nl Date: Sat, 10 Nov 2007 16:55:45 +0100 In-Reply-To: <4734BB45.2030909@t-online.de> (Christian Franke's message of "Fri, 09 Nov 2007 20:55:49 +0100") Message-ID: <874pfuhz7i.fsf@xs4all.nl> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 Subject: Re: [PATCH] Fix packing issue of machine_mmap_entry X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2007 15:55:16 -0000 Christian Franke writes: > Marco Gerards wrote: > >>> ... >>> Add compile time assert to check packing. >>> >> >> Can you remove the compile time assert? > > Done. > >> We usually check stuff like >> this using configure. If you can send in a patch for configure.ac, >> that would be appreciated. >> >> > Yes, but be patient. > > The configure approach is quite different: In configure, you can check > whether compiler supports attr packed and whether it works as > expected. With the good old typedef compile time assert, you can check > whether this *specific* structure is properly declared and packed. Right, but if you add a configure.ac option you can see if it works globally. If it doesn't, we have a problem anyways. We shouldn't rely on how it is packed. If the packed attribute doesn't work, GRUB can't be compiled. >>> --- grub2.orig/include/grub/i386/pc/init.h 2007-07-22 01:32:23.000000000 +0200 >>> +++ grub2/include/grub/i386/pc/init.h 2007-10-13 21:25:24.000000000 +0200 >>> @@ -40,10 +40,14 @@ grub_uint32_t grub_get_eisa_mmap (void); >>> struct grub_machine_mmap_entry >>> { >>> grub_uint32_t size; >>> - grub_uint64_t addr; >>> + grub_uint64_t addr; /* must be at offset 4, see startup.S */ >> >> I do not think this comment is required. It's fixed now :-) >> >> > > Hmm...OK removed. Now there is no clue why this struct has packing > requirements. And this also is no longer checked. All structs that rely on gcc not adding packing for alignment, should have the packed attribute. > Christian > > > 2007-11-09 Christian Franke > > * include/grub/i386/pc/init.h (struct grub_machine_mmap_entry): > Add attribute packed, gcc 3.4.4 on Cygwin aligns this > to 64 bit boundary by default. This looks good :-) -- Marco