This usage of a null substitution came up while I was trying to use this form of spec. for a different switch, but the following illustrates the problem using the existing gcc compiler as built for Redhat Linux running on an SGI Altix:
Given a spec of this form, %{S:X} substitutes X, if the -S switch was given to CC. And a switch definition for -static: /* %{static:} simply prevents an error message if the target machine doesn't handle -static. */ And the resulting link command spec: *link_command: %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %{pie:-pie} %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov} %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}} % gcc --version gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-34) then the command "gcc -static t.c" ultimately yields the following collect2 command: /usr/lib/gcc-lib/ia64-redhat-linux/3.2.3/collect2 -static /usr/lib/gcc-lib/ia64-redhat-linux/3.2.3/../../../crt1.o /usr/lib/gcc-lib/ia64-redhat-linux/3.2.3/../../../crti.o /usr/lib/gcc-lib/ia64-redhat-linux/3.2.3/crtbegin.o -L/usr/lib/gcc-lib/ia64-redhat-linux/3.2.3 -L/usr/lib/gcc-lib/ia64-redhat-linux/ 3.2.3/../../.. /tmp/ccc2ISqV.o --start-group -lgcc -lgcc_eh -lc --end-group /usr/lib/gcc-lib/ia64-redhat-linux/3.2.3/crtend.o /usr/lib/gcc-lib/ia64-redhat-linux/3.2.3/../../../crtn.o I haven't followed the logic in detail, but should the spec. %{static:} above erase the explicit -static switch that was passed to gcc?