grub-devel
[Top][All Lists]
Advanced

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

Re: [patch] Dynamic Loader Bugs


From: Tomas Ebenlendr
Subject: Re: [patch] Dynamic Loader Bugs
Date: Fri, 15 Oct 2004 02:07:37 +0200
User-agent: Mutt/1.5.6i

This patch is nice, after aplying this patch, and fixing the
mregparm=3 stuff, grub-emu can be changed to load the modules dynamically,
instead of statically linking.

I have just few questions, because I want to know how it works.

> 1. Gcc 3.4 will delete the module initialization and finalisation functions 
> as 
> they appear to be unused.
> 

It is deleted before objcopy -K ... aplies ? Or -K is just ignored? 

> 2. grub_dl_load_file contains a null pointer dereference.
> 
> 3. The modules contain common symbols, which the dynamic loader can't handle.
> 

Yes I saw one variable somwhere in normal.mod that was not
preinitialized, and so gcc assumes, that dynamic loader will aloccate
appropriate space.(And it doesn't.) Is this what you mean?

> 4. The dynamic loader uses the size of common symbols as their address, 
> instead of returning an error.
> 

If I understand it well, it thinks that the symbol lives at address 0x4.
( I'm sorry that I'm not more specific, but I lost all my data about two
  weeks ago, and I didn't installed all my stuff yet. )

> Attached is a patch which fixes points 1 to 3.
> 
> 2004-10-09  Timothy Baldwin  <address@hidden>
> 
>         * include/grub/dl.h (GRUB_MOD_INIT): Changed __attribute__ ((unused)) 
>         to __attribute__ ((used)).

This fixes 1.

>         (GRUB_MOD_FINI): Likewise.
>         * kern/dl.c (grub_dl_load_file): Fix null pointer dereference.

This fixes 2.

>         * genmk.rb (PModule): Assign space to common symbols when
>           linking modules. 

This fixes the 3. am I rigt? And so 4. need not to be fixed.

-- 
                                 Tomas 'ebi' Ebenlendr
                                 http://get.to/ebik
                                 PF 2004.78708475638





reply via email to

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