[Bug other/15000] Support setting the default symbol visibility for ELF
bryner at brianryner dot com
gcc-bugzilla@gcc.gnu.org
Mon Apr 19 15:21:00 GMT 2004
------- Additional Comments From bryner at brianryner dot com 2004-04-19 15:01 -------
(In reply to comment #4)
> So I really think we need to
> > provide an easy way for the user to ensure that declarations of functions in
> > external DSOs are treated as default visibility.
>
Local binding is not the same as hidden visibility. Your patch changes the
default visibility for declarations. Consider this simple test:
foo.c:
#include <stdlib.h>
int gtk_init (int *argc, char ***argv) __attribute__ ((visibility ("hidden")));
void foo ()
{
gtk_init (NULL, NULL);
}
gcc -shared -fPIC -o libfoo.so foo.c `pkg-config --libs gtk+-2.0`
readelf -d libfoo.so|grep TEXTREL
0x00000016 (TEXTREL) 0x0
I expect if you run readelf -d on the library you compiled with this patch you
will notice the TEXTREL there as well. If you read drepper's paper you'll see
that's something we want to avoid. And to avoid that, we have to distinguish
between a declaration of a function that will be defined inside the same DSO as
the caller, and one that will be defined in a DSO that is linked against.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15000
More information about the Gcc-bugs
mailing list