Why are libgcc.a and libgcc_eh.a compiled with -fvisibility=hidden?
Ollie Wild
aaw@google.com
Thu Mar 8 02:24:00 GMT 2012
For reasons outside the scope of this discussion, we're experimenting
with statically linking libgcc.a and libgcc_eh.a into dynamically
linked applications which depend on libc but no other dynamic
libraries. To make this work, libc needs to access a few functions
for stack unwinding inside pthread_cancel. With suitable
modifications, everything works, except for one problem: libgcc_eh.a
is compiled with -fvisibility=hidden.
Now, I can put together a hack in our local source tree to remove this
... but why is this the case at all? It might make sense for
libgcc_s.so, but that's compiled with default visibility (and the set
of explicitly visible symbols is broken)? The only other use case I
can think of is for shared libraries which (for some reason) want to
embed private copies of these libraries, but on x86_64, libgcc*.a get
compiled by default without -fPIC, so that doesn't even work.
So ... is there a valid reason for this, or is this just an accident
of history? AFICT, this behavior dates back to 2007 as of r120429
(http://gcc.gnu.org/viewcvs/trunk/libgcc/static-object.mk?view=markup&pathrev=120429).
If no one knows a valid reason for this, I'll submit a patch to remove
it from trunk. Otherwise, I'll just modify it locally.
Thanks,
Ollie
More information about the Gcc
mailing list