Bug 115549 - valgrind-3.0.1 PIC problems on x86
Summary: valgrind-3.0.1 PIC problems on x86
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.0.1
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Tom Hughes
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-02 17:45 UTC by solar
Modified: 2005-11-07 19:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
valgrind-3.0.1-pic-fix.patch (3.48 KB, patch)
2005-11-02 17:49 UTC, solar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description solar 2005-11-02 17:45:22 UTC
Version:           3.0.1 (using KDE KDE 3.4.1)
Installed from:    0Gentoo Packages
Compiler:          gcc-3.3.6 - gcc-3.4.4  
OS:                Linux

Hello. The current and previous versions of valgrind do not compile the helper apps correctly as pure pic shared objects.
I've tested this in the gentoo install of valgrind and confirmed it by building vanilla by hand.

ET_DYN TEXTREL ./helgrind/vgtool_helgrind.so
ET_DYN TEXTREL ./memcheck/vgpreload_memcheck.so
ET_DYN TEXTREL ./memcheck/vgtool_memcheck.so
ET_DYN TEXTREL ./massif/vgtool_massif.so
ET_DYN TEXTREL ./lackey/vgtool_lackey.so
ET_DYN TEXTREL ./addrcheck/vgpreload_addrcheck.so
ET_DYN TEXTREL ./addrcheck/vgtool_addrcheck.so
ET_DYN TEXTREL ./cachegrind/vgtool_cachegrind.so
ET_DYN TEXTREL ./none/vgtool_none.so

The total number of text relocations in all modules ammount to 5540. I hope I dont have to explain why this is a bad thing. I'll attach a patch to correct the problems
Comment 1 solar 2005-11-02 17:49:55 UTC
Created attachment 13253 [details]
valgrind-3.0.1-pic-fix.patch

cd valgrind-3.0.1
cat valgrind-3.0.1-pic-fix.patch | patch -p1
aclocal
automake
Comment 2 Tom Hughes 2005-11-02 17:52:39 UTC
I believe that my biarch patch (which hasn't gone in yet) fixes this as a side effect of the build process reworking that I did.

Certainly objdump and readelf suggest that there are very few relocations but I haven't found anything that produces a report in the format you gave?
Comment 3 Nicholas Nethercote 2005-11-02 17:57:56 UTC
It's probably worth mentioning that in the repository code the vgtool_*.so 
files are no longer built (due to static linking of the core with 
each tool) but the vgpreload_*.so files are still built.
Comment 4 PaX Team 2005-11-02 18:45:28 UTC
re: #2, the output in solar's report comes from a tool available under Gentoo as pax-utils, in particular, 'scanelf -t' produced it. readelf -d|grep TEXTREL achieves the same goal, so does eu-findtextrel from elfutils.
Comment 5 Tom Hughes 2005-11-02 18:51:53 UTC
My biarch patch does fix this then - eu-findtextrel reports no text relocations for any of the shared objects when it is applied.
Comment 6 solar 2005-11-02 19:50:21 UTC
Care to post a link to your biarch patch to gain a little pre testing?
Comment 7 Tom Hughes 2005-11-02 20:31:33 UTC
The reason the patch isn't in yet is that you have to futz around with things to build when it is applied as we need to sort out how to build multiple copies of VEX before it will all work smoorthly.
Comment 8 Tom Hughes 2005-11-07 19:08:13 UTC
The biarch patch has gone in now so as of SVN revision 5031 this should be fixed.