Is -static a link-only switch?
Gary Funck
gary@intrepid.com
Thu May 12 15:46:00 GMT 2005
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.
More information about the Gcc
mailing list