This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc question : pic or non-pic objects stored inside a static archive (not a spam)


Hi Plum,

> 1 - is there an importance that stored objects have been built with
> the pic or non-pic option ?

If you need PIC (position independent code), then the answer is yes: it is
important that you build your objects with PIC.

If you do not need PIC, then the answer is yes:  it is important that you
build your objects non-PIC.

> 2 - is it normal that the lib archive has a bigger size than the
> shared archive ( +15% ) ?

Library archives (.a) are a container storage format.  Think of them as akin
to a .zip (albeit without compression).

Shared objects (.so) are a binary executable format, used as SSO or DSO.

They are different animals with different purposes.

> 3  - is there an importance that stored objects have been built with
> the pic option in a library archive ?

Yes.  If you need PIC, then it is important that you build with PIC.  If you
do not need PIC, then it is important that you do not build with PIC.

> 4  -  if question 3 why the default format is not  pic.o ( in shared
> and static lib ? libtool  compatibility with gcc < 4 ) ?

You can designate the output format with a .pic.o extension, if you so
choose.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]