⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spec-files.html

📁 gcc手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
current target machine.  Use this when running <code>cpp</code>.



     <br><dt><code>%P</code>

     <dd>Like <code>%p</code>, but puts <code>__</code> before and after the name of each

predefined macro, except for macros that start with <code>__</code> or with

<code>_</code><var>L</var><code></code>, where <var>L</var> is an uppercase letter.  This is for ISO

C.



     <br><dt><code>%I</code>

     <dd>Substitute a <code>-iprefix</code> option made from <code>GCC_EXEC_PREFIX</code>.



     <br><dt><code>%s</code>

     <dd>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.



     <br><dt><code>%e</code><var>str</var><code></code>

     <dd>Print <var>str</var> as an error message.  <var>str</var> is terminated by a newline. 

Use this when inconsistent options are detected.



     <br><dt><code>%|</code>

     <dd>Output <code>-</code> if the input for the current command is coming from a pipe.



     <br><dt><code>%(</code><var>name</var><code>)</code>

     <dd>Substitute the contents of spec string <var>name</var> at this point.



     <br><dt><code>%[</code><var>name</var><code>]</code>

     <dd>Like <code>%(...)</code> but put <code>__</code> around <code>-D</code> arguments.



     <br><dt><code>%x{</code><var>option</var><code>}</code>

     <dd>Accumulate an option for <code>%X</code>.



     <br><dt><code>%X</code>

     <dd>Output the accumulated linker options specified by <code>-Wl</code> or a <code>%x</code>

spec string.



     <br><dt><code>%Y</code>

     <dd>Output the accumulated assembler options specified by <code>-Wa</code>.



     <br><dt><code>%Z</code>

     <dd>Output the accumulated preprocessor options specified by <code>-Wp</code>.



     <br><dt><code>%v1</code>

     <dd>Substitute the major version number of GCC. 

(For version 2.9.5, this is 2.)



     <br><dt><code>%v2</code>

     <dd>Substitute the minor version number of GCC. 

(For version 2.9.5, this is 9.)



     <br><dt><code>%v3</code>

     <dd>Substitute the patch level number of GCC. 

(For version 2.9.5, this is 5.)



     <br><dt><code>%a</code>

     <dd>Process the <code>asm</code> spec.  This is used to compute the

switches to be passed to the assembler.



     <br><dt><code>%A</code>

     <dd>Process the <code>asm_final</code> spec.  This is a spec string for

passing switches to an assembler post-processor, if such a program is

needed.



     <br><dt><code>%l</code>

     <dd>Process the <code>link</code> spec.  This is the spec for computing the

command line passed to the linker.  Typically it will make use of the

<code>%L %G %S %D and %E</code> sequences.



     <br><dt><code>%D</code>

     <dd>Dump out a <code>-L</code> option for each directory that GCC believes might

contain startup files.  If the target supports multilibs then the

current multilib directory will be prepended to each of these paths.



     <br><dt><code>%M</code>

     <dd>Output the multilib directory with directory separators replaced with

<code>_</code>.  If multilib directories are not set, or the multilib directory is

<code>.</code> then this option emits nothing.



     <br><dt><code>%L</code>

     <dd>Process the <code>lib</code> spec.  This is a spec string for deciding which

libraries should be included on the command line to the linker.



     <br><dt><code>%G</code>

     <dd>Process the <code>libgcc</code> spec.  This is a spec string for deciding

which GCC support library should be included on the command line to the linker.



     <br><dt><code>%S</code>

     <dd>Process the <code>startfile</code> spec.  This is a spec for deciding which

object files should be the first ones passed to the linker.  Typically

this might be a file named <code>crt0.o</code>.



     <br><dt><code>%E</code>

     <dd>Process the <code>endfile</code> spec.  This is a spec string that specifies

the last object files that will be passed to the linker.



     <br><dt><code>%C</code>

     <dd>Process the <code>cpp</code> spec.  This is used to construct the arguments

to be passed to the C preprocessor.



     <br><dt><code>%c</code>

     <dd>Process the <code>signed_char</code> spec.  This is intended to be used

to tell cpp whether a char is signed.  It typically has the definition:

     <pre class="smallexample">          %{funsigned-char:-D__CHAR_UNSIGNED__}

          </pre>



     <br><dt><code>%1</code>

     <dd>Process the <code>cc1</code> spec.  This is used to construct the options to be

passed to the actual C compiler (<code>cc1</code>).



     <br><dt><code>%2</code>

     <dd>Process the <code>cc1plus</code> spec.  This is used to construct the options to be

passed to the actual C++ compiler (<code>cc1plus</code>).



     <br><dt><code>%*</code>

     <dd>Substitute the variable part of a matched option.  See below. 

Note that each comma in the substituted string is replaced by

a single space.



     <br><dt><code>%:</code><var>function</var><code>(</code><var>args</var><code>)</code>

     <dd>Call the named function <var>function</var>, passing it <var>args</var>. 

<var>args</var> 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.



     <p>The following built-in spec functions are provided:



          <dl>

<dt><code>if-exists</code>

          <dd>The <code>if-exists</code> spec function takes one argument, an absolute

pathname to a file.  If the file exists, <code>if-exists</code> returns the

pathname.  Here is a small example of its usage:



          <pre class="smallexample">               *startfile:

               crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s

               </pre>



          <br><dt><code>if-exists-else</code>

          <dd>The <code>if-exists-else</code> spec function is similar to the <code>if-exists</code>

spec function, except that it takes two arguments.  The first argument is

an absolute pathname to a file.  If the file exists, <code>if-exists-else</code>

returns the pathname.  If it does not exist, it returns the second argument. 

This way, <code>if-exists-else</code> can be used to select one file or another,

based on the existence of the first.  Here is a small example of its usage:



          <pre class="smallexample">               *startfile:

               crt0%O%s %:if-exists(crti%O%s) \

               %:if-exists-else(crtbeginT%O%s crtbegin%O%s)

               </pre>

          </dl>



     <br><dt><code>%{S}</code>

     <dd>Substitutes the <code>-S</code> switch, if that switch was given to GCC. 

If that switch was not specified, this substitutes nothing.  Note that

the leading dash is omitted when specifying this option, and it is

automatically inserted if the substitution is performed.  Thus the spec

string <code>%{foo}</code> would match the command-line option <code>-foo</code>

and would output the command line option <code>-foo</code>.



     <br><dt><code>%W{S}</code>

     <dd>Like %{<code>S</code>} but mark last argument supplied within as a file to be

deleted on failure.



     <br><dt><code>%{S*}</code>

     <dd>Substitutes all the switches specified to GCC whose names start

with <code>-S</code>, but which also take an argument.  This is used for

switches like <code>-o</code>, <code>-D</code>, <code>-I</code>, etc. 

GCC considers <code>-o foo</code> as being

one switch whose names starts with <code>o</code>.  %{o*} would substitute this

text, including the space.  Thus two arguments would be generated.



     <br><dt><code>%{^S*}</code>

     <dd>Like %{<code>S</code>*}, but don't put a blank between a switch and its

argument.  Thus %{^o*} would only generate one argument, not two.



     <br><dt><code>%{S*&amp;T*}</code>

     <dd>Like %{<code>S</code>*}, but preserve order of <code>S</code> and <code>T</code> options

(the order of <code>S</code> and <code>T</code> in the spec is not significant). 

There can be any number of ampersand-separated variables; for each the

wild card is optional.  Useful for CPP as <code>%{D*&amp;U*&amp;A*}</code>.



     <br><dt><code>%{&lt;S}</code>

     <dd>Remove all occurrences of <code>-S</code> from the command line.  Note--this

command is position dependent.  <code>%</code> commands in the spec string

before this option will see <code>-S</code>, <code>%</code> commands in the spec

string after this option will not.



     <br><dt><code>%{S*:X}</code>

     <dd>Substitutes <code>X</code> if one or more switches whose names start with

<code>-S</code> are specified to GCC.  Note that the tail part of the

<code>-S</code> option (i.e. the part matched by the <code>*</code>) will be substituted

for each occurrence of <code>%*</code> within <code>X</code>.



     <br><dt><code>%{S:X}</code>

     <dd>Substitutes <code>X</code>, but only if the <code>-S</code> switch was given to GCC.



     <br><dt><code>%{!S:X}</code>

     <dd>Substitutes <code>X</code>, but only if the <code>-S</code> switch was <em>not</em> given to GCC.



     <br><dt><code>%{|S:X}</code>

     <dd>Like %{<code>S</code>:<code>X</code>}, but if no <code>S</code> switch, substitute <code>-</code>.



     <br><dt><code>%{|!S:X}</code>

     <dd>Like %{!<code>S</code>:<code>X</code>}, but if there is an <code>S</code> switch, substitute <code>-</code>.



     <br><dt><code>%{.S:X}</code>

     <dd>Substitutes <code>X</code>, but only if processing a file with suffix <code>S</code>.



     <br><dt><code>%{!.S:X}</code>

     <dd>Substitutes <code>X</code>, but only if <em>not</em> processing a file with suffix <code>S</code>.



     <br><dt><code>%{S|P:X}</code>

     <dd>Substitutes <code>X</code> if either <code>-S</code> or <code>-P</code> was given to GCC.  This may be

combined with <code>!</code> and <code>.</code> sequences as well, although they

have a stronger binding than the <code>|</code>.  For example a spec string

like this:



     <pre class="smallexample">          %{.c:-foo} %{!.c:-bar} %{.c|d:-baz} %{!.c|d:-boggle}

          </pre>



     <p>will output the following command-line options from the following input

command-line options:



     <pre class="smallexample">          fred.c        -foo -baz

          jim.d         -bar -boggle

          -d fred.c     -foo -baz -boggle

          -d jim.d      -bar -baz -boggle

          </pre>



   </dl>



   <p>The conditional text <code>X</code> in a %{<code>S</code>:<code>X</code>} or

%{!<code>S</code>:<code>X</code>} construct may contain other nested <code>%</code> constructs

or spaces, or even newlines.  They are processed as usual, as described

above.



   <p>The <code>-O</code>, <code>-f</code>, <code>-m</code>, and <code>-W</code>

switches are handled specifically in these

constructs.  If another value of <code>-O</code> or the negated form of a <code>-f</code>, <code>-m</code>, or

<code>-W</code> switch is found later in the command line, the earlier switch

value is ignored, except with {<code>S</code>*} where <code>S</code> is just one

letter, which passes all matching options.



   <p>The character <code>|</code> at the beginning of the predicate text is used to indicate

that a command should be piped to the following command, but only if <code>-pipe</code>

is specified.



   <p>It is built into GCC which switches take arguments and which do not. 

(You might think it would be useful to generalize this to allow each

compiler's spec to say which switches take arguments.  But this cannot

be done in a consistent fashion.  GCC cannot even decide which input

files have been specified without knowing which switches take arguments,

and it must know which input files to compile in order to tell which

compilers to run).



   <p>GCC also knows implicitly that arguments starting in <code>-l</code> are to be

treated as compiler output files, and passed to the linker in their

proper position among the other output files.



   </body></html>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -