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

📄 code-gen-options.html

📁 gcc手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<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.3">

<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">

<!--

Copyright &copy; 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,

1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.



   <p>Permission is granted to copy, distribute and/or modify this document

under the terms of the GNU Free Documentation License, Version 1.2 or

any later version published by the Free Software Foundation; with the

Invariant Sections being "GNU General Public License" and "Funding

Free Software", the Front-Cover texts being (a) (see below), and with

the Back-Cover Texts being (b) (see below).  A copy of the license is

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

</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 conventions

used in code generation.



   <p>Most of them have both positive and negative forms; the negative form

of <code>-ffoo</code> would be <code>-fno-foo</code>.  In the table below, only

one of the forms is listed--the one which is not the default.  You

can figure out the other form by either removing <code>no-</code> or adding

it.



     <dl>

<dt><code>-fbounds-check</code>

     <dd>For front-ends that support it, generate additional code to check that

indices used to access arrays are within the declared range.  This is

currently only supported by the Java and Fortran 77 front-ends, where

this 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>-fexceptions</code>

     <dd>Enable exception handling.  Generates extra code needed to propagate

exceptions.  For some targets, this implies GCC will generate frame

unwind information for all functions, which can produce significant data

size overhead, although it does not affect execution.  If you do not

specify this option, GCC will enable it by default for languages like

C++ which normally require exception handling, and disable it for

languages like C that do not normally require it.  However, you may need

to enable this option when compiling C code that needs to interoperate

properly with exception handlers written in C++.  You may also wish to

disable this option if you are compiling older C++ programs that don't

use 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 does

not exist everywhere.  Moreover, it only allows <em>trapping</em>

instructions to throw exceptions, i.e. memory references or floating

point instructions.  It does not allow exceptions to be thrown from

arbitrary 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 needed

static data, but will not affect the generated code in any other way. 

You will normally not enable this option; instead, a language processor

that 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.  The

table is exact at each instruction boundary, so it can be used for stack

unwinding 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 like

longer ones, rather than in registers.  This convention is less

efficient, but it has the advantage of allowing intercallability between

GCC-compiled files and files compiled with other compilers, particularly

the Portable C Compiler (pcc).



     <p>The precise convention for returning structures in memory depends

on the target configuration macros.



     <p>Short structures and unions are those whose size and alignment match

that 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 is

standard for the target.  If there is no standard convention, GCC

defaults to <code>-fpcc-struct-return</code>, except on targets where GCC is

the principal compiler.  In those cases, we can choose the standard, and

we 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 the

declared range of possible values.  Specifically, the <code>enum</code> type

will be equivalent to the smallest integer type which has enough room.



     <p><strong>Warning:</strong> the <code>-fshort-enums</code> switch causes GCC to generate

code 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 generate

code 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>short

unsigned int</code> instead of the default for the target.  This option is

useful for building programs to run under WINE.



     <p><strong>Warning:</strong> the <code>-fshort-wchar</code> switch causes GCC to generate

code 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 this

compilation be shared data rather than private data.  The distinction

makes sense only on certain operating systems, where shared data is

shared between processes running the same program, while private data

exists in one copy per process.



     <br><dt><code>-fno-common</code>

     <dd>In C, allocate even uninitialized global variables in the data section of the

object file, rather than generating them as common blocks.  This has the

effect that if the same variable is declared (without <code>extern</code>) in

two 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 the

program 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>-fno-gnu-linker</code>

     <dd>Do not output global initializations (such as C++ constructors and

destructors) in the form used by the GNU linker (on systems where the GNU

linker is the standard method of handling them).  Use this option when

you want to use a non-GNU linker, which also requires using the

<code>collect2</code> program to make sure the system linker includes

constructors and destructors.  (<code>collect2</code> is included in the GCC

distribution.)  For systems which <em>must</em> use <code>collect2</code>, the

compiler driver <code>gcc</code> is configured to do this automatically.



     <br><dt><code>-finhibit-size-directive</code>

     <dd>Don't output a <code>.size</code> assembler directive, or anything else that

would cause trouble if the function is split in the middle, and the

two halves are placed at locations far apart in memory.  This option is

used when compiling <code>crtstuff.c</code>; you should not need to use it

for anything else.



     <br><dt><code>-fverbose-asm</code>

     <dd>Put extra commentary information in the generated assembly code to

make it more readable.  This option is generally only of use to those

who actually need to read the generated assembly code (perhaps while

⌨️ 快捷键说明

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