[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Don't use -fpic if library is too specialized?

From: Paul Pluzhnikov
Subject: Re: Don't use -fpic if library is too specialized?
Date: Thu, 28 Sep 2006 15:36:48 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

Paul Pluzhnikov <> 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

$ 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

In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]