grub-devel
[Top][All Lists]
Advanced

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

Re: grub-pe2elf


From: Christian Franke
Subject: Re: grub-pe2elf
Date: Fri, 31 Jul 2009 20:27:58 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16

Hi Robert,

Robert Millan wrote:
On a recent discussion on IRC, Bean pointed out that grub-pe2elf is essentially
a workaround for a bug in objcopy.


It is essentially a limitation of BFD: The object format specific backends are apparently not implemented such that conversion between different relocation formats is supported.

In particular, a relocation 'addend' (-4 in this case) is lost during conversion if source or target relocation format do not support it as separate field. Some conversions may work. PE -> ELF does not work, the problem is in both backends in this case.


Bean explained that this bug is quite obvious.  It seems Christian sent them
a patch, but it hasn't been applied (I don't know if it was rejected, or just
ignored, Christian could you explain?).


The patch was actually an ad-hoc approach to fix it in objcopy itself for the PE->ELF case only:
http://sourceware.org/ml/binutils/2007-10/msg00302.html

A generic solution which would have more chances to get accepted would require substantial work in BFD itself. Conversion between relocation formats is apparently rarely needed. A related bugzilla entry was reopened in 2005 and is idle since then:
http://sourceware.org/bugzilla/show_bug.cgi?id=970


Later in July 2008, Bean added grub-pe2elf to the repository.


Yes, and I really appreciated this :-)


First of all, I'm worried that we have discussions to decide things and they
are later forgotten or ignored.  Bean, please can you provide some explanation
on what happened?

Also, I think this commit should be reverted (at least the part that adds
grub-pe2elf).

I would regret this. Then you could also revert all my Cygwin related additions (some also included in Bean's r1726) because these no longer make much sense unless someone fixes BFD or maintains a ELF toolchain for Cygwin.


Nevertheless, it's not an obligation for us to support win32.  As long as we
can do it sanely, I'm fine with it, but I don't want to see GRUB dragged into
a situation in which we need to preserve win32 support at all costs.


$ find grub2 -type f -name '*.[ch]' | xargs cat | wc -l
128175

$ cat grub2/util/grub-pe2elf.c | wc -l
521

0.4% of the total LoC is IMO less than 'all costs' :-)

--
Regards
Christian Franke





reply via email to

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