[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bugs in loader/i386/pc/multiboot.c
From: |
Robert Millan |
Subject: |
Re: bugs in loader/i386/pc/multiboot.c |
Date: |
Fri, 27 Feb 2009 22:41:47 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Sun, Feb 22, 2009 at 10:27:27AM +0100, phcoder wrote:
> 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
I will try. Does someone have a known-working Multiboot / ELF64 image I can
test with?
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."