From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Lhkrs-0002hr-DA for mharc-grub-devel@gnu.org; Thu, 12 Mar 2009 09:22:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lhkrp-0002h0-UP for grub-devel@gnu.org; Thu, 12 Mar 2009 09:22:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lhkrn-0002fi-E1 for grub-devel@gnu.org; Thu, 12 Mar 2009 09:22:32 -0400 Received: from [199.232.76.173] (port=57844 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lhkrn-0002fb-6k for grub-devel@gnu.org; Thu, 12 Mar 2009 09:22:31 -0400 Received: from mail-fx0-f176.google.com ([209.85.220.176]:39294) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lhkrl-0005ZF-U9 for grub-devel@gnu.org; Thu, 12 Mar 2009 09:22:30 -0400 Received: by fxm24 with SMTP id 24so411047fxm.42 for ; Thu, 12 Mar 2009 06:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=74g+0PSeSeSgGbgV0CoTQjx+17ZcZeMXlL+36BUhhCo=; b=AyTQFQRER9Ce9zyzB44+JzvlyrVEhJQW0pZoEROrQaOBrOieqazgLYmhjx9dyEl8cL aNslLigXcQ5xxRjEKhENDZEpDt3evicTeUTNWMNa4Iyqsyp0EgXX9KrPEo3HjWnmVOpe F2DCARCU8wbVdd+93flyai4uBlW/b7bMGVPb4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=Gf+Me2UubdFus1KdsraT+oQqKRgnsa4Kd6KEwHIJ6kDtQQ3p4eJbrREoksO3Ijdfu1 9OrJaqHusTWaVwJ7Uer1IzBHiYC/Noj8nHq64AUp2f7PXmSHYnY1gSOFBcsUmDRcYFqf A+1LiKhSoIvuYPd6ncHKmiR4DmgjfrvDFVMWU= Received: by 10.204.77.73 with SMTP id f9mr512045bkk.66.1236864148835; Thu, 12 Mar 2009 06:22:28 -0700 (PDT) Received: from ?82.130.80.49? (hg-public-dock-49-dhcp.ethz.ch [82.130.80.49]) by mx.google.com with ESMTPS id 35sm1008410fkt.23.2009.03.12.06.22.27 (version=SSLv3 cipher=RC4-MD5); Thu, 12 Mar 2009 06:22:27 -0700 (PDT) Message-ID: <49B90C94.4070302@gmail.com> Date: Thu, 12 Mar 2009 14:22:28 +0100 From: phcoder User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="------------080406050104060007080608" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Fwd: Re: ELF bugfixes] 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: Thu, 12 Mar 2009 13:22:34 -0000 This is a multi-part message in MIME format. --------------080406050104060007080608 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit -- Regards Vladimir 'phcoder' Serbinenko --------------080406050104060007080608 Content-Type: message/rfc822; name="Re: ELF bugfixes.eml" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Re: ELF bugfixes.eml" Return-Path: Received: from ?82.130.80.49? (hg-public-dock-49-dhcp.ethz.ch [82.130.80.49]) by mx.google.com with ESMTPS id 13sm998483fks.27.2009.03.12.06.21.43 (version=SSLv3 cipher=RC4-MD5); Thu, 12 Mar 2009 06:21:44 -0700 (PDT) Message-ID: <49B90C69.60703@gmail.com> Date: Thu, 12 Mar 2009 14:21:45 +0100 From: phcoder User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: David Miller Subject: Re: ELF bugfixes References: <49B8C686.5060508@gmail.com> <20090312.020757.187232522.davem@davemloft.net> <49B8F067.2040503@gmail.com> <20090312.055819.95768237.davem@davemloft.net> In-Reply-To: <20090312.055819.95768237.davem@davemloft.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit David Miller wrote: > From: phcoder > Date: Thu, 12 Mar 2009 12:22:15 +0100 > >> David Miller wrote: >>> From: phcoder >>> Date: Thu, 12 Mar 2009 09:23:34 +0100 >>> >>>> Index: include/grub/elf.h >>>> =================================================================== >>>> --- include/grub/elf.h (revision 2036) >>>> +++ include/grub/elf.h (working copy) >>>> @@ -77,7 +77,7 @@ >>>> Elf32_Half e_shentsize; /* Section header table entry size */ >>>> Elf32_Half e_shnum; /* Section header table entry count */ >>>> Elf32_Half e_shstrndx; /* Section header string table index */ >>>> -} Elf32_Ehdr; >>>> +} __attribute__ ((packed)) Elf32_Ehdr; >>>> >>> There is no reason why you should need the packed attribute here. >>> I can't think of any cpu where this could even remotely be necessary. >>> And if it's not necessary, all it does it emit terribly suboptimal >>> code on RISC cpus. >> If it doesn't make a difference in the structure why does the compiler generate different code? > > Because packed also means that the alignment of the structure > can't be assumed to be naturally word aligned. So the compiler > has to use byte loads and stores to load a word, for example, > on RISC machines. > > This is because the packed attribute influences how the structure is > embedded into other structures. > > This attribute controls two different things, not just local packing. I knew it but normally when you parse files normally offsets aren't guaranteed to be aligned. But now it seems that elf parser is written in a way to guarantee at least some alignments. Then this part of patch probably is to be dropped or changed to proper aligned attribute -- Regards Vladimir 'phcoder' Serbinenko --------------080406050104060007080608--