dwfl_module_relocate_address() versus base address

Mark Wielaard mjw@redhat.com
Mon Dec 15 12:07:00 GMT 2008


Hi Roland,

On Fri, 2008-12-12 at 12:06 -0800, Roland McGrath wrote:
> I think dwfl_module_relocate_address might be applying the wrong bias.  It
> subtracts the dwbias, but it should subtract the main file bias.  The
> address you pass it is an absolute address in that Dwfl's address space,
> and what it should yield is the address relative to the first p_vaddr in
> the DSO (i.e. 0 if not prelinked).

Aha! Doh. Yes, things make a lot more sense now. Since older/current
versions of dwfl_module_relocate_address() will have this bug I am using
dwfl_module_address_section() now, which does seem to do the right
thing. Then to get the relative address of the symbol when the code is
mapped in all we need is the section offset. This seems to work fine in
all cases. Although I am still confused how this ever worked before.
Also for the kernel we still do things slightly differently (making
things relative to _stext) . I checked in the following patch to my
pr6866 branch and will be testing more with it.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: translate.patch
Type: text/x-patch
Size: 1481 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20081215/488be8d9/attachment.bin>


More information about the Systemtap mailing list