This is the mail archive of the gcc@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]

Shared library compilation


I can't find this in the faq, but maybe someone knows....

Is there a particular reason why gcc -shared calls ld with all the
crt*.o files?  What happens is that when I build a shared library this
way, even on a 900 byte .o file, the shared library is 32 K. 
If I build the shared library with ld -shared (gnu linker, btw), it doesn't
bring in these files.

There is also an (IMHO) undesirable side effect that if I link a program
with a .so built with gcc -shared, then replace it with one built with
ld -shared, the executable no longer can resolve the startup code
from the crt*.o files, since they were in the shared library, the linker
never brought them into the executable!

---
Doug Semler                       | doug@seaspace.com
SeaSpace Corporation              | Garbage In -- Gospel Out
Least Senior Software Developer;  | Minister of things to do Next Quarter
Low Man on the Totem Pole         | (but will Never Be Done) DNRC  O-
A closed mind is a terrible thing | Bus Error (passengers dumped)
  
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/M d---(pu) s++:- a-- C++ UILSH+++$ P--- L++ E--- W+
N++ o-- K? w--(++$) O- M-- V- PS+ !PE Y PGP t(+) 5+++ X+
R- tv+(-) b+(++) DI++++ D G e++>++++ h!>--- r% y+>+++++**
------END GEEK CODE BLOCK------




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