From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LbAcX-00053f-7m for mharc-grub-devel@gnu.org; Sun, 22 Feb 2009 04:27:33 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LbAcU-00050W-VO for grub-devel@gnu.org; Sun, 22 Feb 2009 04:27:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LbAcU-0004zH-Ar for grub-devel@gnu.org; Sun, 22 Feb 2009 04:27:30 -0500 Received: from [199.232.76.173] (port=35812 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LbAcU-0004yx-4j for grub-devel@gnu.org; Sun, 22 Feb 2009 04:27:30 -0500 Received: from fg-out-1718.google.com ([72.14.220.154]:38515) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LbAcT-0002dY-PF for grub-devel@gnu.org; Sun, 22 Feb 2009 04:27:29 -0500 Received: by fg-out-1718.google.com with SMTP id l27so1768444fgb.30 for ; Sun, 22 Feb 2009 01:27:28 -0800 (PST) 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:references:in-reply-to :content-type:content-transfer-encoding; bh=xRJ5czrcwkWFSElIT9U4VU3T225QRnMH2bVGCDVsW0E=; b=e+/D82SLBfII8lhn43M05bJLqrRgrVGKCWbe/xUuftKxsMzN8zwFVh8Js+l4yK3Bh9 YoVyd8aS2BDVwW3x5pVGHA8q7Q4zGLwx7aKIV1De99id5L470IKPQPx+JbD98goRAHqJ BBmFpES3ce6UhsQmRTt+4aOERm5VtOzyc33cY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=HvqeQYgKJ3cKTb1ckLbBiWfKriIhHTsONBhRDnAgUOHaqmSrq1W2UPFAiLfrg2tf6C F62AxgJxE6d6u9ZkTVo7ZFE592L9PTl3/QKp6N9tvnj/nvwZphZgLjpfBGi3ovuc0NtB ZzOV5L/TDqfi+OrXcDc1MXRhr1BgUhsJC9OYI= Received: by 10.86.65.9 with SMTP id n9mr2177229fga.55.1235294848527; Sun, 22 Feb 2009 01:27:28 -0800 (PST) Received: from ?192.168.1.25? (112-27.1-85.cust.bluewin.ch [85.1.27.112]) by mx.google.com with ESMTPS id e20sm4780048fga.36.2009.02.22.01.27.27 (version=SSLv3 cipher=RC4-MD5); Sun, 22 Feb 2009 01:27:28 -0800 (PST) Message-ID: <49A11A7F.9060806@gmail.com> Date: Sun, 22 Feb 2009 10:27:27 +0100 From: phcoder User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: The development of GRUB 2 References: <20090222005211.GA29483@thorin> In-Reply-To: <20090222005211.GA29483@thorin> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: bugs in loader/i386/pc/multiboot.c 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: Sun, 22 Feb 2009 09:27:31 -0000 Robert Millan wrote: > Hi, > > The problem with elf64 in our multiboot loader is that it duplicates a lot > of code from elf32 and this eventually leads to bitrot. > > In fact, grub_multiboot_load_elf32 and grub_multiboot_load_elf64 are supposed > to be almost identical, and only differ in s/32/64/ references. > > It'd be fairly simple to resincronize them, but I'd really like to find a > way to prevent this from happening again. > > Does someone have any idea on what would be a good approach? > Move it to a separate file and instead of writing e.g. Elf32_Sym write Elf_Sym then in the top of the file: #ifdef ELF64 #define Elf_Sym Elf64_Sym ... #else #define Elf_Sym Elf32_Sym ... #endif And then compile the same file twice, once with -DETLF32 and once with -DELF64. I was actually planning to do the same with my efiemu. If you agree I can do this scheme in both places Regard Vladimir 'phcoder' Serbinenko