Paul Pluzhnikov <[EMAIL PROTECTED]> writes:

> I forgot exactly how glibc achieves that, but I know that in newer
> versions of glibc, fopen() calls mmap() directly (instead of
> calling through PLT):

The glibc avoids PIC overhead by using
 __attribute__((visibility("hidden"))):

$ cat junk.c
int foo() ATTR;
int bar() { return foo(); }

$ gcc -c -DATTR -fPIC junk.c && objdump -dr junk.o
...
   d:   81 c3 03 00 00 00       add    $0x3,%ebx
                        f: R_386_GOTPC  _GLOBAL_OFFSET_TABLE_
  13:   e8 fc ff ff ff          call   14 <bar+0x14>
                        14: R_386_PLT32 foo
...

$ gcc -DATTR='__attribute__((visibility ("hidden")))' -c -fPIC junk.c && 
  objdump -dr junk.o 
...
   6:   e8 fc ff ff ff          call   7 <bar+0x7>
                        7: R_386_PC32   foo
...

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to