ld -static option.
lrtaylor@micron.com
lrtaylor@micron.com
Tue Nov 18 18:26:00 GMT 2003
-static tells the compiler to link all libraries following that option
statically. If you don't tell the linker to link dynamically by default
at some point after using this option (using -Bdynamic or something
similar), then it will link _all_ libraries listed after -static
statically, including libraries that normally get linked in by default,
such as the C library, etc. Generally, if you only want a specify
library linked in statically, you would do something like this:
gcc -o a.out a.o -static -L. -lmylib -Wl,-Bdynamic
The actual argument to use to tell the linker to link dynamically may be
different depending on the platform you're building on.
Cheers,
Lyle
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Bansidhar Arvind Deshpande - CTD, Chennai.
Sent: Tuesday, November 18, 2003 4:05 AM
To: gcc-help@gcc.gnu.org
Subject: ld -static option.
Hi all,
I am using gcc 2.96. I am wondering the working of -static option given
for
ld. What is the exact functionality of this.
e.g
ld a.o -static -L./ -lmylib -o a.out
In above example does the -static option apply only for mylib which is
specified
by -l or it is applied for all of the libraries to generated a.out.
Generically
does -static controls only to the libraries specified by -l or all of
the
libraries
taken by ld to generate the executable ?
I am also interested in hidden functionality of -static if exists.
Thanks,
--Bansidhar
More information about the Gcc-help
mailing list