All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Building GRUB on platforms without ELF support
Date: Sun, 18 Nov 2007 12:35:55 +0100	[thread overview]
Message-ID: <87oddrrdk4.fsf@xs4all.nl> (raw)
In-Reply-To: <20071118070706.GA3531@thorin> (Robert Millan's message of "Sun,  18 Nov 2007 08:07:07 +0100")

Robert Millan <rmh@aybabtu.com> 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




  reply	other threads:[~2007-11-18 11:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-16 22:58 Building GRUB on platforms without ELF support Christian Franke
2007-11-18  7:07 ` Robert Millan
2007-11-18 11:35   ` Marco Gerards [this message]
2007-11-19 20:29     ` Christian Franke
2007-12-06 12:08       ` Robert Millan
2007-12-06 12:58         ` Christian Franke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oddrrdk4.fsf@xs4all.nl \
    --to=mgerards@xs4all.nl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.