I modified some patches applied to upstream gcc-4.2 branch and redhat gcc-4.1 branch which fix a lot of visibility related bugs.
I took the patches from the redhat gcc-4.1 branch, and removed the changelog parts (did not apply) and modified them to apply to Gentoo gcc-4.1.1-r1
They fix the following bugs:
See http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01302.html for a description of the patches. Upstream will most probably not apply these patches to gcc-4.1 branch, but maybe Gentoo can do this? I compiled most of KDE (everything I have installed) with these patches and kdehiddenvisibility, and nothing visibly broke. Also, without these patches I was not able to compile geki's openoffice ebuilds, with these patches I was able to. (see http://forums.gentoo.org/viewtopic-t-489909-start-50.html )
Created attachment 96372 [details, diff]
Created attachment 96373 [details, diff]
broken of from previous patch in order to apply
Created attachment 96374 [details, diff]
Created attachment 96375 [details, diff]
KDE does not require these patches (builds and work fine without them), but there are other cases where these patches can break, will try if these fixes the one I have locally.
This does not fix bug #134162.
Warning: this might be breaking more visibility support. I've started getting text relocations on FFmpeg where it used to work fine. I'll let you know for sure after a gcc rebuild.
Sorry, false warning; visibility support did not change a bit with or without these patches for the software I can test myself.
Hmm... I get a compile failure with these patches and mozilla-firefox and mozilla-thunderbird. Might not be worthy of inclusion after all, but maybe the error really is in firefox? Anyone got a clue?
nsXPCOMObsolete.o:(.data.rel.ro+0x20): undefined reference to `nsFileSpecImpl::Create(nsISupports*, nsID const&, void**)'
nsXPCOMObsolete.o:(.data.rel.ro+0x80): undefined reference to `nsDirectoryIteratorImpl::Create(nsISupports*, nsID const&, void**)'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: libxpcom_compat_c.so: hidden symbol `nsFileSpecImpl::Create(nsISupports*, nsID const&, void**)' isn't defined
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
gmake: *** [libxpcom_compat_c.so] Error 1
gmake: Leaving directory `/var/tmp/portage/mozilla-firefox-184.108.40.206/work/mozilla/xpcom/obsolete/component'
gmake: *** [libs] Error 2
not that i have any say in this ;), but i think it'd be better to wait for 4.2 than have to maintain these ourselves. they're fairly invasive and visibility handling got a major overhaul for 4.2. it seems like a bad idea to completely change how visibility works in the middle of a stable series.