effect of -fPIC on code speed

Ian Lance Taylor iant@google.com
Mon Sep 20 21:13:00 GMT 2010

Miles Bader <miles@gnu.org> writes:

> Sure, then the gcc doc can say "(see <all-about-pic> for details)"... :)

OK, so first write that document....

> Are symbols in a shared object loaded with e.g. dlopen "visible" (in the
> sense of being unified with symbols in the executable, not visible via a
> special lookup like dlsym)?

When a library is opened by dlopen the executable has already been
dynamically linked, and in any case the dlopen'ed library comes last in
the symbol lookup order.  So the question is only meaningful with regard
to what happens to symbol references in the dlopen'ed library.  The
answer to that question depends on the RTLD_DEEPBIND flag to dlopen (and
of course on whether the library has the DT_SYMBOLIC tag or DF_SYMBOLIC
flag).  The RTLD_GLOBAL flag controls whether the dlopen'ed shared
library's symbols are available for linking with subsequent dlopen'ed


More information about the Gcc-help mailing list