[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building GRUB on platforms without ELF support
From: |
Marco Gerards |
Subject: |
Re: Building GRUB on platforms without ELF support |
Date: |
Sun, 18 Nov 2007 12:35:55 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Robert Millan <address@hidden> writes:
> 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.
So am I.
> 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.
That would be a nice check to have.
--
Marco