From: Armin Brauns via Gcc-patches Date: Tue, 17 Nov 2020 00:14:31 +0000 (-0700) Subject: Update documentation for spec files X-Git-Tag: upstream/12.2.0~11886 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a019766f996f57e53a8d1a9e72033e1e1487a150;p=platform%2Fupstream%2Fgcc.git Update documentation for spec files gcc * gcc.c: Document %T spec file directive. * doc/invoke.texi: Remove %p, %P spec file directives. Add %M, %R, %V, %nSTR, %>S, %S +Similar to @samp{% [] +@end smallexample + +It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't. +The supported @code{comparison-op} values are: + +@table @code +@item >= +True if @code{switch} is a later (or same) version than @code{arg1} + +@item !> +Opposite of @code{>=} + +@item < +True if @code{switch} is an earlier version than @code{arg1} + +@item !< +Opposite of @code{<} + +@item >< +True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2} + +@item <> +True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later +@end table + +If the @code{switch} is not present at all, the condition is false unless the first character +of the @code{comparison-op} is @code{!}. + +@smallexample +%:version-compare(>= 10.3 mmacosx-version-min= -lmx) +@end smallexample + +The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was +passed. + +@item @code{include} +The @code{include} spec function behaves much like @code{%include}, with the advantage +that it can be nested inside a spec and thus be conditionalized. It takes one argument, +the filename, and looks for it in the startfile path. It always returns NULL. + +@smallexample +%@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@} +@end smallexample + @item @code{pass-through-libs} The @code{pass-through-libs} spec function takes any number of arguments. It finds any @option{-l} options and any non-options ending in @file{.a} (which it @@ -31957,6 +32023,25 @@ Use "-Wa,OPTION" to pass "OPTION" to the assembler. It is used to separate compiler options from assembler options in the @option{--target-help} output. + +@item @code{gt} +The @code{gt} spec function takes two or more arguments. It returns @code{""} (the +empty string) if the second-to-last argument is greater than the last argument, and NULL +otherwise. The following example inserts the @code{link_gomp} spec if the last +@option{-ftree-parallelize-loops=} option given on the command line is greater than 1: + +@smallexample +%@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@} +@end smallexample + +@item @code{debug-level-gt} +The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the +empty string) if @code{debug_info_level} is greater than the specified number, and NULL +otherwise. + +@smallexample +%@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@} +@end smallexample @end table @item %@{S@} @@ -31971,6 +32056,10 @@ and outputs the command-line option @option{-foo}. Like %@{@code{S}@} but mark last argument supplied within as a file to be deleted on failure. +@item %@@@{S@} +Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes +@code{@@FILE} if an @code{@@file} argument has been supplied. + @item %@{S*@} Substitutes all the switches specified to GCC whose names start with @code{-S}, but which also take an argument. This is used for @@ -32053,6 +32142,12 @@ jim.d -bar -boggle -d jim.d -bar -baz -boggle @end smallexample +@item %@{%:@var{function}(@var{args}):X@} + +Call function named @var{function} with args @var{args}. If the +function returns non-NULL, then @code{X} is substituted, if it returns +NULL, it isn't substituted. + @item %@{S:X; T:Y; :D@} If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is diff --git a/gcc/gcc.c b/gcc/gcc.c index cdf4d4f..766bfc1 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -542,6 +542,12 @@ or with constant text in a single argument. %s current argument is the name of a library or startup file of some sort. Search for that file in a standard list of directories and substitute the full name found. + %T current argument is the name of a linker script. + Search for that file in the current list of directories to scan for + libraries. If the file is located, insert a --script option into the + command line followed by the full path name found. If the file is + not found then generate an error message. + Note: the current working directory is not searched. %eSTR Print STR as an error message. STR is terminated by a newline. Use this when inconsistent options are detected. %nSTR Print STR as a notice. STR is terminated by a newline.