This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: about -fpic/-fPIC option for gcc
- From: Lin George <george4academic at yahoo dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 18 Sep 2006 01:47:44 -0700 (PDT)
- Subject: Re: about -fpic/-fPIC option for gcc
Thank you Ian,
You have answered most of my question. What materials
are stored in GOT? Any documents describe it in a
simple/clear/brief way? :-)
regards,
George
--- Ian Lance Taylor <iant@google.com> wrote:
> Lin George <george4academic@yahoo.com> writes:
>
> > Do you mean -fpic and -fPIC will make GOT and PLT
> > different? If yes, what are the differences?
>
> I quote the documentation about -fPIC:
>
> If supported for the target machine, emit
> position-independent
> code, suitable for dynamic linking and avoiding
> any limit on the
> size of the global offset table. This option
> makes a difference
> on the m68k, PowerPC and SPARC.
>
> The difference is that with -fPIC there is no limit
> on the size of the
> GOT. The precise details depend on the platform.
>
> Ian
>
> > --- Ian Lance Taylor <iant@google.com> wrote:
> >
> > > Lin George <george4academic@yahoo.com> writes:
> > >
> > > > Could you provide a little more information
> > > please? I
> > > > mean what is the different things generated by
> > > -fpic
> > > > and -fPIC in a shared library?
> > >
> > > To make the code position independent and to
> permit
> > > the executable to
> > > override symbols defined in the shared library,
> all
> > > global variables
> > > are accessed via a table of addresses (the
> Global
> > > Offset Table, or
> > > GOT) and all functions are called via a table of
> > > branches (the
> > > Procedure Linkage Table, or PLT). The dynamic
> > > linker initializes the
> > > GOT and PLT at runtime. The precise details
> depend
> > > on the platform.
> > >
> > > Ian
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com