This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pending patches ping


On Tue, 2013-01-29 at 11:22 +0100, Mark Wielaard wrote:
> On Wed, 2013-01-23 at 22:13 +0100, Jan Kratochvil wrote:
> > [patchv3] Fix dwfl_report_elf BASE alignment
> > https://lists.fedorahosted.org/pipermail/elfutils-devel/2012-November/002759.html
> > Message-ID: <20121116161051.GA2042@host2.jankratochvil.net>
> 
> The actual change is very small:
> 
> --- a/libdwfl/dwfl_report_elf.c
> +++ b/libdwfl/dwfl_report_elf.c
> @@ -181,8 +181,6 @@ __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name,
>  	    {
>  	      vaddr = ph->p_vaddr & -ph->p_align;
>  	      address_sync = ph->p_vaddr + ph->p_memsz;
> -	      if ((base & (ph->p_align - 1)) != 0)
> -		base = (base + ph->p_align - 1) & -ph->p_align;
>  	      start = base + vaddr;
>  	      break;
>  	    }
> 
> But I don't fully understand this code so will have to lookup the
> references you gave first.

I still cannot really say I understand it all. But I agree it is strange
to change the given base. I don't understand why that is done.

In your testcase you assume that using dwfl_report_elf () will load the
module at the base address. That seems warranted given the
documentation. At least it is surprising that it isn't and if we don't
fix this like you suggest it should be documented. I think it should be
fixed as you propose, but maybe Roland knows why it is this way.

If it isn't fixed, then at least your testcase could be made to work by
first checking the start address of the Dwfl_Module and using that
instead of the base as offset. Would that be a workaround for your
issue? Or is there more to it than your testcase suggests?

Thanks,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]