[Bug other/15000] Support setting the default symbol visibility for ELF
s_gccbugzilla at nedprod dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 20 01:05:00 GMT 2004
------- Additional Comments From s_gccbugzilla at nedprod dot com 2004-04-19 23:45 -------
(In reply to comment #9)
> And on that same program, what is the output of readelf -d <binary>|grep
> TEXTREL, with and without -fvisibility=hidden? (I don't have a build with your
> patch handy) Or are you saying that you're aware that this will introduce a
> text relocation but you're not worried about it?
No, I'm saying there are precisely as many text relocations with or without
-fvisibility. In other words, this patch does nothing to reduce the number, but
it also does nothing to increase the number.
I have a simple solution to your problem - all declarations which are global
within the DSO but not available outside the DSO should be declared explicitly
as visibility hidden. I have enhanced my previous patch to support this - now
when you explicitly specify hidden, it always generates a locally bound
reference.
MSVC has no such concept, but to not use this doesn't break code, it simply
produces a less efficient binary. Therefore those coming from MSVC based code
can quickly produce a near-optimal ELF binary but they'll need to put in a
little more work to go all the way. Most importantly of all it transparently
handles compatibility with older Unix libraries not specifying visibility.
You can see updated docs at http://www.nedprod.com/programs/gccvisibility.html
I've attached the new patch to this bug report. I still must review your newer
patch, when I do I'll resubmit this newest patch to gcc-bugs.
Cheers,
Niall
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15000
More information about the Gcc-bugs
mailing list