[Top][All Lists]

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

Re: Building GRUB on platforms without ELF support

From: Christian Franke
Subject: Re: Building GRUB on platforms without ELF support
Date: Mon, 19 Nov 2007 21:29:19 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070802 SeaMonkey/1.1.4

Marco Gerards wrote:
Robert Millan <address@hidden> writes:

On Fri, Nov 16, 2007 at 11:58:14PM +0100, Christian Franke wrote:
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.
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.

Actually, binutils actually does not have this ("convert relocatable object files from format X to ELF") stuff.

How about building binutils with --enable-targets=i386-elf ?  Maybe the
Cygwin maintainers would even add it as default.

It is not so easy:

Cygwin's libbfd, ld and objcopy support elf32-i386, gas does not.

But ld refuses to output elf32-i386 if pe-i386 is the input format. This restriction is hard-coded into ld because some pe-specific operations are hard-coded into bfd backend (This includes the hack which fixes the pc-relative relocation in the executable).

Enable elf32-i386 as additional output format for gas does not work. The compilation fails, multiple emulations are not supported on i386 platform.

But even building gas as a cross-assembler does not help. Some assembler directives, like symbol type specs, are output format specific. Output from Cygwin's gcc produces syntax errors.

Therefore, you would need also a gcc build as a cross-compiler.

Not really worth the effort, so I posted the patch for kern/i386/dl.c instead.

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.

Better prompt "sorry", as rebuilding binutils probably won't work OOTB in many cases ... :-)


reply via email to

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