OSDN Git Service

* gcc.c (The Specs Language): Document spec functions.
[pf3gnuchains/gcc-fork.git] / gcc / doc / invoke.texi
index 1df52de..45fee6f 100644 (file)
@@ -4967,6 +4967,27 @@ Substitute the variable part of a matched option.  See below.
 Note that each comma in the substituted string is replaced by
 a single space.
 
+@item %:@var{function}(@var{args})
+Call the named function @var{function}, passing it @var{args}.
+@var{args} is first processed as a nested spec string, then split
+into an argument vector in the usual fashion.  The function returns
+a string which is processed as if it had appeared literally as part
+of the current spec.
+
+The following built-in spec functions are provided:
+
+@table @code
+@item @code{if-exists}
+The @code{if-exists} spec function takes one argument, an absolute
+pathname to a file.  If the file exists, @code{if-exists} returns the
+pathname.  Here is a small example of its usage:
+
+@smallexample
+*startfile:
+crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
+@end smallexample
+@end table
+
 @item %@{@code{S}@}
 Substitutes the @code{-S} switch, if that switch was given to GCC@.
 If that switch was not specified, this substitutes nothing.  Note that