GNOME Bugzilla – Bug 656231
using --as-needed in LDFLAGS is not respected and it links on unneeded libs
Last modified: 2012-09-21 13:37:15 UTC
same issue reported in bug 656229 and bug 655517. taking as example /usr/lib/gnome-settings-daemon-3.0/libprint-notifications.so it links to 37 sonames, the package in total linking on 480 sonames sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool applying this workaround reduces the linkage for that specific test to 7 and in total the package now links on 170 sonames. I personally don't know how many modules from gnome are affected but in my opinion this issue needs to be fixed upstream instead of packaging. System information: binutils 2.21.1-1 libtool 2.4 gcc 4.6.1 CFLAGS="-march=i686 -mtune=generic -O2 -pipe" CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe" LDFLAGS="-Wl,--hash-style=gnu -Wl,--as-needed"
Your numbers seem inflated. rpm -q --requires gnome-settings-daemon | wc -l 84
does rpm -q --requires return a specific soname once or multiple? My count is for each elf from the package, do readelf and get the NEEDED and count them. It doesn't remove duplicates from the list. The reason I don't remove duplicate is to see which one really link to uneeded shared libraries.
What's the point you're trying to make here? Is there a patch coming? I'm certainly not going to take something which changes the linkage style for all the platforms.
Ionut, can you please respond to comment#3 ?
my point is to not have gnome modules link to unneeded libraries saving everyone time with recompilation. i do not expect changing the linkage style since is mostly a libtool problem. i intend to contact libtool developers but i'm pretty sure they know about this problem.
This is a hack: sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool and not something we can ship in GNOME. Please deal with the problem downstream, and feel free to file new bugs if you see erroneously linked plugins.