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.
(http://sourceware.org/ml/binutils/2007-10/threads.html#00302)
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.
Christian
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel