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: dwfl_module_getsym vs. prelink


On Fri, 2013-11-15 at 14:35 +0100, Mark Wielaard wrote:
> On Thu, 2013-11-14 at 16:00 -0800, Josh Stone wrote:
> > > $ /usr/sbin/prelink -u testfilebazmin
> > > $ /usr/sbin/prelink -r 0x70000000 testfilebazmin
> > > $ ./dwflsyms -e testfilebazmin | grep -w FUNC | grep -wE 'main|foo|bar'
> > >    8: FUNC	LOCAL	foo (20) 0x75c
> > >   47: FUNC	GLOBAL	bar (40) 0x770
> > >   51: FUNC	GLOBAL	main (35) 0x738
> > 
> > Normal prelink is better here, but now prelink -r didn't actually appear
> > to move any of foo, bar, or main!?! 
> 
> $ eu-readelf -l testfilebazmin | grep LOAD | head -1  LOAD           0x000000 0x0000000070000000 0x0000000070000000 0x000a5c 0x000a5c R E 0x200000
> $ eu-readelf -s testfilebazmin | grep -w FUNC | grep -wE 'main|foo|bar'
>    12: 00000000700007f0     35 FUNC    GLOBAL DEFAULT       13 main
> $ eu-readelf --elf-section -s testfilebazmin | grep -w FUNC | grep -wE 'main|foo|bar'
>     7: 0000000000000814     20 FUNC    LOCAL  DEFAULT       13 foo
>    36: 0000000000000828     44 FUNC    GLOBAL DEFAULT       13 bar
> $ ./dwflsyms -e testfilebazmin | grep -w FUNC | grep -wE 'main|foo|bar'
>    8: FUNC	LOCAL	foo (20) 0x814, rel: 0xffffffff90000814
>   47: FUNC	GLOBAL	main (35) 0x700007f0, rel: 0x7f0
>   49: FUNC	GLOBAL	bar (44) 0x828, rel: 0xffffffff90000828
> 
> OK, that is definitely a bug. But I cannot immediately explain why it
> worked fine in the -N case and not in the -r case. Except for the
> specific load address there should be no difference.

Except that prelink -r doesn't actually do a prelink. In particular it
doesn't add a .gnu.prelink_undo section which we look for to create the
synchronization address between the main and debug files. See 
find_prelink_address_sync() in libdwfl/dwfl_module_getdwarf.c.

This is a somewhat strange case. We separate the main and debug/aux
files first and then run prelink -r to adjust the base address of the
main file. How important is this case?

Thanks,

Mark


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