This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Is -static a link-only switch?
- From: "Gary Funck" <gary at intrepid dot com>
- To: "Gcc Mailing List" <gcc at gcc dot gnu dot org>
- Date: Thu, 12 May 2005 08:37:54 -0700
- Subject: Is -static a link-only switch?
Does the -static switch play any role during compilation, or is it
a link-only switch? A quick review of gcc.c, indicates that -static
may play a role on some targets:
/* %{static:} simply prevents an error message if the target machine
doesn't handle -static. */
However, the info documentation shows the following:
*Note Options for Linking: Link Options.
OBJECT-FILE-NAME -lLIBRARY
-nostartfiles -nodefaultlibs -nostdlib
-s -static -static-libgcc -shared -shared-libgcc -symbolic
-Wl,OPTION -Xlinker OPTION
-u SYMBOL.
I can think of target OS's that might define a different ABI for procedure calls
for programs compiled with -static asserted, than when compiled for a dynamic
linking environment, but can't quite tell if in fact -static has any effect
during compilation.