[Bug other/15000] Support setting the default symbol visibility for ELF

bryner at brianryner dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 20 09:05:00 GMT 2004


------- Additional Comments From bryner at brianryner dot com  2004-04-20 06:29 -------
Ok, I see what you're saying now.  Your patch only changes the visibility for
functions which don't give an explicit visibility _and_ are defined within the
current source file.  Sorry for missing that earlier.  So this will indeed not
break anything.  Except, perhaps, for function-pointer-equality... consider
taking the address of printfHere from within the given .c file, and from another
.c file linked into the same .so -- I think the former will give the real
function address, while the latter will give the PLT slot address.

My main concern with this approach is that for C++, it's common to define only a
single class within a given source file.  This patch will avoid the PLT overhead
on calls to internal methods from inside that source file, but it does nothing
for calling methods on a class from another source file within the DSO -- unless
you explicitly annotate all of the method declarations with
visibility("hidden").  And at least for me that's a major thing I'd like to see
from this option - avoiding the PLT overhead for calls to methods in other
object files that are linked into the same DSO, _without_ adding a "hidden"
declaration to hundreds of class declarations.  Perhaps we're looking for
different things from this patch.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15000



More information about the Gcc-bugs mailing list