"Gary Funck" <[EMAIL PROTECTED]> writes: > Does the -static switch play any role during compilation, or is it > a link-only switch?
It is 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. */ That comment is above LINK_COMMAND_SPEC, which is how gcc invokes the linker. It means that if the target does not provide any handling for -static in the target specific LINK_SPEC, gcc will simply ignore -static. It doesn't affect code-generation, only how the linker is invoked. > 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. In fact many targets compile code differently depending upon whether the code is to be put into a shared library or not, but this is controlled via options like -fpic, not -static. Ian