On 10/21/2011 8:09 AM, William Cohen wrote:
> On 10/20/2011 07:22 PM, Maynard Johnson wrote:
>> William Cohen wrote:
>>> I have been looking into a bug reported on Fedora about oprofile not providing per function counts for libraries by opreport (Bug 746823 - oprofile and sysprof fail to read symbol files). We have narrowed down the cause to the prelink changing the address of sections in the shared library and then later bfd_info::translate_debuginfo_syms() is not able to find the matching section for the debuginfo in the share library section. The debuginfo section are left with the SEC_LOAD flag unset and are later removed as uninteresting symbols. There is additional information about the bug at:
>>> I am a bit leery just shoving a patch in to fix this particular bug because there have been a number of fixes in there for various cases. Any suggestions on how to best address this issue?
>> Sheesh, translate_debuginfo_syms is fragile! This isn't the first time it's caused problems, if you recall. This hack of a function came into existence as a result of a bug I reported back on June 18, 2009 (subject "[PATCH] Fix computation of symbol size on corner case"). John wasn't enamored with my proposed fix, and we eventually agreed to fix the problem by filtering symbols whose section flags does not contain SEC_LOAD. In retrospect, this was not a good fix. In September, a user reported that debuginfo file processing was broken, and it was because the section flags in debuginfo files do NOT have SEC_LOAD, so they were ALL being filtered out. Instead of re-thinking the strategy of how to fix the original problem (the one I reported in June 2009), we doubled-down and came up with translate_debuginfo_syms().
>> I personally would be happy to do away with translate_debuginfo_syms, which should fix the problem your Fedora users see when using prelink. *Will*, maybe you've done this already, but can you comment out the following two lines in bfd_support.cpp:bfd_info::get_symbols()
>> if (image_bfd_info)
>> translate_debuginfo_syms(syms.get(), nr_syms);
>> If that tests out OK, we'll then discuss alternatives for fixing the original problem.
> Commenting out those two lines isn't going to help. The problem is that the translate_debuginfo_syms() function copies changes the sections over to the sections from the original binary that have the appropriate flags set. The debuginfo files sections are missing the SEC_LOAD flags, so when those don't get translated back to the original binary they get filtered out.
Sorry it took me a while to get back to ou. Yeah, my suggested hack was a
brain-dead idea. That's what I get for operating in the dark. I got access to
a Fedora 16/POWER7 system and was able to reproduce the problem. In fact, I
found I could reproduce a similar-looking problem on RHEL 6.1/POWER7, too.
Patch to follow.
> Jakub suggested correcting the address so translate_debuginfo_syms can match up the sections in:
Actually, the oprofile kernel driver adjusts the addresses for us, re-basing to