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

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

 



hi , there ,
i 've asked some questions on darwin list but i haven't a good and real answer about it ( forward: bottom of this email ) it's a general question about or pic or non pic objects stored inside a static archive

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

see - 1-

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

see - 2-

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

see -3-

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

ar rc libMy.a *.pic.o


 it will be cool :) if someone could answer


Best Regards, {Plum}


i have an another question about pic or non pic objects stored inside a library archive

if i do something like this :

gcc \
-dynamiclib \
-undefined suppress \
-flat_namespace \
-single_module \
-all_load ./libMy.a \
-install_name /usr/local/lib/libMy.1.dylib \
-compatibility_version 1
-current_version 1.3
-o libMy.1.0.dylib \
-lz

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

because the "normal" way is

gcc -dynamiclib *.pic.o \
-install_name /usr/local/lib/libMy.1.dylib \
-compatibility_version 1
-current_version 1.3
-o libMy.1.0.dylib \
-lz

and

ar rc libMy.a *.non-pic.o

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



GCC 2.95.2

When building a shared library, gcc will compile additional code to be included in the library. That additional code must also be compiled with the proper PIC option.

	gcc -c -fPIC myfile.c
	gcc -shared -o libmyfile.so -fPIC myfile.o




http://developer.apple.com/releasenotes/DeveloperTools/GCC4.html


gcc3 gcc2 gcc4 ? and -fPIC

this has an importance under Linux
but for a mach-o archive ?
this case can be found ?

prelink: /usr/bin/mybin: Cannot prelink against non-PIC shared library
/usr/lib/libMy.dylib

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

gcc -dynamiclib *.pic.o \
-install_name /usr/local/lib/ libMyOther.1.dylib \
-compatibility_version 1
-current_version 1.3
-o libMyOther.1.0.dylib \
-lz ./libMy.a

Best Regards, {Plum}


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux