[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building GRUB on platforms without ELF support
From: |
Robert Millan |
Subject: |
Re: Building GRUB on platforms without ELF support |
Date: |
Sun, 18 Nov 2007 08:07:07 +0100 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Fri, Nov 16, 2007 at 11:58:14PM +0100, Christian Franke wrote:
> 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.
I'm not sure what the GRUB maintainers will think, but I'm not very inclined
to duplicate stuff that binutils already have.
How about building binutils with --enable-targets=i386-elf ? Maybe the
Cygwin maintainers would even add it as default. We could also have a
configure check that aborts build when -m elf_i386 is not supported (which
may also be a problem on pure-x86_64 environment!) and prompt user to
rebuild binutils.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)