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


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to