[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Building GRUB on platforms without ELF support

From: Christian Franke
Subject: Building GRUB on platforms without ELF support
Date: Fri, 16 Nov 2007 23:58:14 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070802 SeaMonkey/1.1.4

Building GRUB modules requires ELF support in gas and ld. For platforms where ELF is not the native format, ld may support ELF output. If not (like on Cywin) some conversion to ELF is necessary.

In general, GNU objcopy allows conversion between object file formats. Unfortunately, objcopy (and BFD itself) does not include any support for the conversion of relocation formats (even conversion between ELF variants do not work). In particular, when converting PE (a COFF variant) to ELF, objcopy does not abort but silently produces bad PC-relative relocation offsets. In my first Cygwin patch, there is a hack to fix this in the GRUB ELF loader.

For specific conversions, fixing this in objcopy itself is easy. But there is not much chance that such pragmatic patches will be accepted upstream.

I have prepared a reduced (~680 LoC) version of objcopy with the PE->ELF fix added. To support build on non-ELF platforms, I would suggest to add this to the GRUB codebase. It can be later extended for other platforms if desired.

Thanks for any comment.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]