📄 code-gen-options.html
字号:
<html lang="en"><head><title>Using the GNU Compiler Collection (GCC)</title><meta http-equiv="Content-Type" content="text/html"><meta name="description" content="Using the GNU Compiler Collection (GCC)"><meta name="generator" content="makeinfo 4.6"><!--Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. <p>Permission is granted to copy, distribute and/or modify this documentunder the terms of the GNU Free Documentation License, Version 1.2 orany later version published by the Free Software Foundation; with theInvariant Sections being "GNU General Public License" and "FundingFree Software", the Front-Cover texts being (a) (see below), and withthe Back-Cover Texts being (b) (see below). A copy of the license isincluded in the section entitled "GNU Free Documentation License". <p>(a) The FSF's Front-Cover Text is: <p>A GNU Manual <p>(b) The FSF's Back-Cover Text is: <p>You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.--><meta http-equiv="Content-Style-Type" content="text/css"><style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller }--></style></head><body><div class="node"><p>Node: <a name="Code%20Gen%20Options">Code Gen Options</a>,Next: <a rel="next" accesskey="n" href="Environment-Variables.html#Environment%20Variables">Environment Variables</a>,Previous: <a rel="previous" accesskey="p" href="Submodel-Options.html#Submodel%20Options">Submodel Options</a>,Up: <a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking%20GCC">Invoking GCC</a><hr><br></div><h3 class="section">Options for Code Generation Conventions</h3><p>These machine-independent options control the interface conventionsused in code generation. <p>Most of them have both positive and negative forms; the negative formof <code>-ffoo</code> would be <code>-fno-foo</code>. In the table below, onlyone of the forms is listed--the one which is not the default. Youcan figure out the other form by either removing <code>no-</code> or addingit. <dl><dt><code>-fbounds-check</code> <dd>For front-ends that support it, generate additional code to check thatindices used to access arrays are within the declared range. This iscurrently only supported by the Java and Fortran 77 front-ends, wherethis option defaults to true and false respectively. <br><dt><code>-ftrapv</code> <dd>This option generates traps for signed overflow on addition, subtraction,multiplication operations. <br><dt><code>-fwrapv</code> <dd>This option instructs the compiler to assume that signed arithmeticoverflow of addition, subtraction and multiplication wraps aroundusing twos-complement representation. This flag enables some optimizationsand disables other. This option is enabled by default for the Javafront-end, as required by the Java language specification. <br><dt><code>-fexceptions</code> <dd>Enable exception handling. Generates extra code needed to propagateexceptions. For some targets, this implies GCC will generate frameunwind information for all functions, which can produce significant datasize overhead, although it does not affect execution. If you do notspecify this option, GCC will enable it by default for languages likeC++ which normally require exception handling, and disable it forlanguages like C that do not normally require it. However, you may needto enable this option when compiling C code that needs to interoperateproperly with exception handlers written in C++. You may also wish todisable this option if you are compiling older C++ programs that don'tuse exception handling. <br><dt><code>-fnon-call-exceptions</code> <dd>Generate code that allows trapping instructions to throw exceptions. Note that this requires platform-specific runtime support that doesnot exist everywhere. Moreover, it only allows <em>trapping</em>instructions to throw exceptions, i.e. memory references or floatingpoint instructions. It does not allow exceptions to be thrown fromarbitrary signal handlers such as <code>SIGALRM</code>. <br><dt><code>-funwind-tables</code> <dd>Similar to <code>-fexceptions</code>, except that it will just generate any neededstatic data, but will not affect the generated code in any other way. You will normally not enable this option; instead, a language processorthat needs this handling would enable it on your behalf. <br><dt><code>-fasynchronous-unwind-tables</code> <dd>Generate unwind table in dwarf2 format, if supported by target machine. Thetable is exact at each instruction boundary, so it can be used for stackunwinding from asynchronous events (such as debugger or garbage collector). <br><dt><code>-fpcc-struct-return</code> <dd>Return "short" <code>struct</code> and <code>union</code> values in memory likelonger ones, rather than in registers. This convention is lessefficient, but it has the advantage of allowing intercallability betweenGCC-compiled files and files compiled with other compilers, particularlythe Portable C Compiler (pcc). <p>The precise convention for returning structures in memory dependson the target configuration macros. <p>Short structures and unions are those whose size and alignment matchthat of some integer type. <p><strong>Warning:</strong> code compiled with the <code>-fpcc-struct-return</code>switch is not binary compatible with code compiled with the<code>-freg-struct-return</code> switch. Use it to conform to a non-default application binary interface. <br><dt><code>-freg-struct-return</code> <dd>Return <code>struct</code> and <code>union</code> values in registers when possible. This is more efficient for small structures than<code>-fpcc-struct-return</code>. <p>If you specify neither <code>-fpcc-struct-return</code> nor<code>-freg-struct-return</code>, GCC defaults to whichever convention isstandard for the target. If there is no standard convention, GCCdefaults to <code>-fpcc-struct-return</code>, except on targets where GCC isthe principal compiler. In those cases, we can choose the standard, andwe chose the more efficient register return alternative. <p><strong>Warning:</strong> code compiled with the <code>-freg-struct-return</code>switch is not binary compatible with code compiled with the<code>-fpcc-struct-return</code> switch. Use it to conform to a non-default application binary interface. <br><dt><code>-fshort-enums</code> <dd>Allocate to an <code>enum</code> type only as many bytes as it needs for thedeclared range of possible values. Specifically, the <code>enum</code> typewill be equivalent to the smallest integer type which has enough room. <p><strong>Warning:</strong> the <code>-fshort-enums</code> switch causes GCC to generatecode that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. <br><dt><code>-fshort-double</code> <dd>Use the same size for <code>double</code> as for <code>float</code>. <p><strong>Warning:</strong> the <code>-fshort-double</code> switch causes GCC to generatecode that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. <br><dt><code>-fshort-wchar</code> <dd>Override the underlying type for <code>wchar_t</code> to be <code>shortunsigned int</code> instead of the default for the target. This option isuseful for building programs to run under WINE. <p><strong>Warning:</strong> the <code>-fshort-wchar</code> switch causes GCC to generatecode that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. <br><dt><code>-fshared-data</code> <dd>Requests that the data and non-<code>const</code> variables of thiscompilation be shared data rather than private data. The distinctionmakes sense only on certain operating systems, where shared data isshared between processes running the same program, while private dataexists in one copy per process. <br><dt><code>-fno-common</code> <dd>In C, allocate even uninitialized global variables in the data section of theobject file, rather than generating them as common blocks. This has theeffect that if the same variable is declared (without <code>extern</code>) intwo different compilations, you will get an error when you link them. The only reason this might be useful is if you wish to verify that theprogram will work on other systems which always work this way. <br><dt><code>-fno-ident</code> <dd>Ignore the <code>#ident</code> directive. <br><dt><code>-finhibit-size-directive</code> <dd>Don't output a <code>.size</code> assembler directive, or anything else thatwould cause trouble if the function is split in the middle, and thetwo halves are placed at locations far apart in memory. This option isused when compiling <code>crtstuff.c</code>; you should not need to use itfor anything else.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -