grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Kernel fixes for Cygwin


From: Christian Franke
Subject: Re: [PATCH] Kernel fixes for Cygwin
Date: Mon, 21 Jul 2008 12:21:30 +0200

Bean wrote:
> On Mon, Jul 21, 2008 at 4:51 AM, Christian Franke
> <...> wrote:
> > This adds Cygwin support to kernel sources. It handles the issues
> > introduced by PE->ELF conversion and adds support for
> > HAVE_ASM_USCORE.
> > 
> > Christian
> > 
> > 2007-07-20      Christian Franke  <address@hidden>
> > 
> > * include/grub/dl.h: Remove .previous, gas supports this only for
> > ELF format.
> > 
> > * include/grub/symbol.h [__CYGWIN__] (#define FUNCTION/VARIABLE):
> > Remove .type, gas supports this only for ELF format.
> > 
> > * kern/dl.c (grub_dl_resolve_symbols): Add check for grub_mod_init
> > and grub_mod_fini for symbols without a type. Handle HAVE_ASM_USCORE
> > case for these symbols.
> > (grub_dl_resolve_dependencies): Add check for trailing nullbytes in
> > symbol table. This fixes an infinite loop if table is zero filled.
> > 
> > * kern/i386/dl.c [__CYGWIN__] (fix_pc_rel_relocation): New function
> > to fix bad PC relative relocation produced by objcopy.
> > [__CYGWIN__] (grub_arch_dl_relocate_symbols): Add fix of PC relative
> > relocation.
> > (grub_arch_dl_relocate_symbols): Abort on unknown relocation type.
> > 
> 
> Hi,
> 
> I'm not fond of fixing elf relocation bug in dl.c. ...
> 

Hi,

I agree that kern/i386/dl.c:fix_pc_rel_relocation() is an ugly hack and
shall be removed when a better solution is available.


> ... First of all, this
> is an objcopy bug, it may be changed in the future, ...
> 

My patch for objcopy was rejected upstream. According to binutils
mailing list, this is not an objcopy bug, but a BFD design limitation:
http://sourceware.org/ml/binutils/2007-10/msg00306.html

So I don't expect a fix before time_t wraps around ...


> ... also, it makes
> modules compiled by cygwin not compatible with those compiled by elf
> gcc.
> 

The fix_pc_rel_relocation() works also with correct ELF files, because
the (-4) fix is only applied if necessary.

Supporting Modules compiled with ELF gcc would also require to handle
the different syntax of C-Symbols (HAVE_ASM_USCORE or NOT).

Actually my first version of supported this by aliasing symbols
with/without underscore in kern/dl.c. It was tested with modules
compiled with Linux gcc loaded by kernel.img compiled with Cygwin gcc
and vice versa and all this *worked*.

But according to a comment from Robert, this is possibly useless or not
desired, see:
http://lists.gnu.org/archive/html/grub-devel/2007-11/msg00152.html

So I removed this (non?-)feature for now. Would be easy to re-add later.

Christian







reply via email to

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