GCC Chinese Manual - Excerpt from Pure C Forum

xiaoxiao2021-03-06  43

GCC

Section: gnu Tools (1) Updated: 2003/12 / 05IDEX RETURN To Main Contents

Name

GCC, G - GNU

Engineering

C

with

C

translater

(EGCS-1.1.2)

Overview (Synopsis)

GCC [option | filename] ... G [option | filename] ...

WARNING

This handbook content is taken from

GNU C

Full documentation for the compiler

,

Only in the meaning of explanation options

.

This book page is no longer updated unless someone voluntarily maintained. If there is any contradiction between man page and software, check the Info file, the Info file is an authoritative document.

If we find that the content of this handbook causes obvious chaos and complaints due to outdated, we stop posting it. It is impossible to have other options, and the information updated in the INFO file is updated at the same time, because other maintenance GNU CC does not leave We do this. The GNU project believes that the Man's manual is an outdated product, and the time should be used in other places.

If you need full and up-to-date documentation, review info files `GCC 'or use and porting gnu cc (for version 2.0) (for Version 2.0) manual. Both are from Texinfo original file gcc.texinfo.

Description (Description)

C

with

C

The compiler is integrated

.

They all use one or more of the four steps to input files.

:

Pretreatment

PreProcessing,

Compile

(Compilation)

compilation

(askSSEMBLY)

Connection

Linking.

Source file after the hypermination name logo source file language

,

But for the compiler

,

The suffix name controls the default setting

:

GCC

Think pre-processed files

(.i)

Yes

C

file

,

And set

C

Form connection

.

G

Think pre-processed files

(.i)

Yes

C

file

,

And set

C

Form connection

.

Source file suffix name indicates the language type and the later operation:

.C C source program; pretreatment, compilation, compilation

.C C source program; pretreatment, compilation, compilation

.CC C source program; pretreatment, compilation, compilation

.cxx C source program; pretreatment, compilation, compilation

.m Objective-C source program; pretreatment, compilation, compilation

.i pre-treated C file; compile, compilation

C files after pre-treatment; compile, compilation

.S assembly language source program; compilation

.S assembly language source program; pretreatment, compilation

.h preparation instrument file; usually do not appear on the command line

The files of other hyperfoxes are passed to the connector

Linker.

Usually included

:

.o target file (Object file)

.a archive library file (Archive file)

Unless the -c, -s, or -e option (or compiling errors blocked the complete process), the connection is always the final step. In the connection phase, all the .o files, -l library corresponding to the source program Files, unrecognized file names (including specified .o target files and .a library files) are passed to the connector in the order in the command line.

Options (options)

Options must be given separately

: `-dr '

Completely different from

`-d -r '.

Most `-f 'and` -w' options have two opposite formats: -fname and -fno-name (or -wname, and -wno-name). Only in the format that is not the default option.

Below is a summary of all options, groups, explains in the later chapter.

Overall Option

-c -s -e -o file -pipe -v -x loguage

Language Option

-ansi -fall-virtual -fcond-mismatch -fdollars-in-identifiers -fenum-int-equiv -fexternal-templates -fno-asm -fno-builtin -fhosted -fno-hosted -ffreestanding -fno-freestanding -fno-strict -Prototype -fsigned-bitfields -fsigned-char -fthis-is-variable -funsigned-bitfields -funsigned-char -fwritable-strings -traditional -traditional-cpp -trigraphs warning option (WARNING OPTION)

-fsyntax-only -pedantic -pedantic-erroate -w -w -wall -waggregate-return -wcast-align -wcast-qal -wchar-subscript -wcomment -wconversion -wenum-clamp -wrror -wformat -wid-coplash-len -Wimplicit -Wimplicit-int -Wimplicit-function-declaration -Winline -Wlong-long -Wmain -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-import -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow -wstrict-prototypes -wswitch -wtemplate-debugging -wuninitial -wtrigraphs -wuninitialized -wunused -wwrite-strings

Debugging option (DEBUGGING OPTION)

-dletters -fpretend-float -g -glevel -gcoff -gxcoff -gxcoff -gdwarf -gdwarf -Gstabs -gstabs -ggdb -p -pg -save-temps -Print-file-name = library -print-libgcc-file -Name -Print-prog-name = program

Optimization option (Optimization Option)

-fcaller-saves -fcse-follow-jumps -fcse-skip-blocks -fdelayed-branch -felide-constructors -fexpensive-optimizations -ffast-math -ffloat-store -fforce-addr -fforce-mem -finline-functions -fkeep -inline-functions -fmemoize-lookups -fno-default-inline -fno-defer-pop -fno-function-cse -fno-inline -fno-peephole -fomit-frame-pipe -freun-cse-frame-pipe -fschedule -ins - -fschedule-insns2 -fstrength-redument -fthread-jumps -funroll-all-loops -funroll-loops -o -o2 -o3

Preprocessor Option

-Aassertion -c -dd -dm -dn -dmacro [= defn] -e -idirafter dir -include file -imacros file -iprefix file -iwithprefix dir -m -md -mm -mmd -nostdinc -p -umacro - Undef assembler options (Assembler Option)

-WA, Option

Connector Option (Linker Option)

-LLIBRARY -NOSTARTFILES -NOSTDLIB -STATIC -SHARED -SYMBOLIC -XLINKER OPTION -WL, OPTION -U SYMBOL

Directory Option (Directory Option)

-BPREFIX -IDIR -I---LDir

Target Options (Target Option)

-B Machine -V Version

Configuration Related Option (Configuration Dependent Option)

M680x0 option

-M68000 -M68020 -M68020-40 -M68030 -M68040 -M68881 -MBITFIELD -MC68000 -MC68020 -MFPA -MNOBITFIELD-MRTD -MSHORT -MSOFT-FLOAT

VAX option-mgnu -munix

SPARC option -mepilogue -mfpu -mhard-float -mno-fpu-mno-epilogue -msoft-float-msparclite -mv8 -Msupersparc-MCyPRESS

ConveX options - MARGCOUNT -MC1 -MC2 -MNOARGCOUNT

AMD29K options - M29000 -M29050 -MBW -MDW -MKERNEL-Registers -mlarge -Mnbw -Mnodw -msmall -Mstack-Check -Muser-Registers

M88K Options - MNO-LARGE-SHIFT - MNO-OCS-OCS-DEBUG-INFO-MNO-OCS-FRAME -POSition -Mno-Optimize-arg-alla-mno-serialize-Volatile -Mno-undrees -mocs-debug-info -mocs-frame-position -moptimize-arg-alla-mSerialize-Volatile -Mshort-data-num -MSVR3 -msvr4 -mtrap-large-shift -muse-div-instruction -mversion-03.00 -mwarn-passed-structs

RS6000 Options - Mfp-in-Toc-Mno-Fop-in-TOC

RT option-mcall-lib-mul-mfp-arg-in-fpregs -mfp-arg-in-gregs -mFull-fp-block-MHC-STRUCT-RETURN -MIN-line-mul-mminimum-fp-block-mminohc -Struct-Return

MIPS Options - MCPU = CPU TYPE -MIPS2 -MIPS3-MINT64 -MLONG64 -MMIPS-AS -MGAS -MRNAMES -MNO-RNAMES -MGPOPT -MNO-GPOPT -MSTATS -MNO-STATS -MMEMCPY -MNO-MNO-STATS -MMEMCPY-MNO-MEMCPY -MNO-MIPS- TFILE-MMIPS-TFILE-MSOFT-FLOAT -MHARD-FLOAT-MABICALLS -MNO-ABICALLS -MHALF-PIC -MNO-HALF-PIC -G NUM -NOCPPI386 Options -M486 -Mno-486 -Msoft-float-Mno-FP- RET-IN-387

HPPA Options - MPA-RISC-1-0 -MPA-RISC-1-1 -Mkernel -Mshared-Libs -Mno-Shared-Libs -mlong-Calls -Mdisable-fpregs-Mdisable-Indexing -mtrailing-Colon

I960 Options-MnUMTAIL-MNODE-TAIL-CALL-MNODE - MNO-CALL-MNODE - MNO-CALL-MNO-MNO - MNO-code -Align -Mic-compat -Mic2.0-compat -Mic3.0-compat -masm-compat -mintel-asm-mstrict-align-mno-strict-align -mold-align-mald-align

DEC Alpha option - mfp-regs-malo-fp-regs-maloat-float-msoft-float

SYSTEM V option -g -qy -qn -yp, paths -ym, dir

Code Generation Option (Code Generation Option)

-fcall-saved-reg-call-buy-reg -ffixed-reg-definhibit-size-directive -fnonnull-objects -fno-common -fno-ident -fno-gnu-linker -fpcc-struct-return-fpic -fpic -freg-struct-return -fshared-data -fshort-enums -fshort-double -fvolatile -fvolatile-global -fverbose-asm

Overall Option

-x Language

Clearly point out the language of the backup file

LANGUAGE

Instead of obtaining the default selection from the file name suffix

).

This option is applied to all of the input files later

,

Until in the next one

`-x '

Option

Language

Optional value

`c ',` Objective-c', `c-header ',` C ', `cpp-output ',` Assembler',

with

`assembler-with-cpp '.

-x none

Close any clear explanation of language species

,

So according to the files behind the file name suffix

(

As is like never used

`-x '

Option

).

If you only operate some of the four phases (preprocessing, compile, assembly, connection), you can use the `-x 'option (or file name suffix) to tell where to start, using` -c', `-s', Or `-e 'option tells the GCC where to end. Note that some options are combined (for example,` -x cpp-outprut -e') makes GCC do nothing.

-C

Compile or assemble source files

,

But do not connect

.

The compiler outputs the target file corresponding to the source file

.

By default, GCC generates a target file name by replacing the source file name suffix`c ', `.i',` .s', and so on. You can use the -o option to select another name.

The GCC ignores the -c option, any unrecognized input file (they don't need to be compiled or assembled).

-S

Stop after compiling

,

Not compile

.

For each input non-assembly language file

,

Output file is a compilation language file

.

By default, GCC generates a target file name by replacing the source file name suffix`c ', `.i', and so on. You can use the -o option to select another name.

GCC ignores any input files that do not need to be compiled.

-E

Stop after pre-treatment

,

Not compile

.

Pretreatment code sent to standard output

.

GCC ignores any input files that do not require pre-processing.

-o file

Specify output file

File.

This option is not

GCC

What output is generated?

,

Whether it is an executable

,

Target file

,

Compilation files are still pretreated

C

Code

.

Since only one output file can only be specified, it is not meaningless when compiling multiple input files, unless an executable is output unless an executable file is output.

If you do not use the `-o 'option, the default output result is: the executable file is` a.out', `source.suffix 'target file is` source.o', assembled file is `Source.s', and The pre-processed C source code is sent to the standard output.

-V

(

In standard error

)

Show commands in executing compilation phase

.

Conframe driver at the same time

,

Prepaid

,

The version number of the compiler

.

-pipe

Communication is used in different stages of the compilation process rather than temporary files

.

This option is unable to work in some systems

,

Because those system assemblers cannot read data from pipelines

GNU

Assembler does not have this problem

.

Language Options

The following options control the compiler to accept

C "

dialect

":

-ansi

Support

ANSI

standard

C

program

.

This will close some of the GNU C, such as ASM, Inline, and TypeOf keywords, as well as a predefined macro, such as UNIX and VAX indicating the current system type. At the same time, open unopened and very small use. ANSI TRIGRAPH features, and disabled `$ 'part of the identifier.

Although the `-ansi 'option is used, the following optional keywords, __asm__, __extension____inline__ and __typeof__ are still valid. Of course, you will not use them in the ANSI C program, but you can put them on the head In the file, because compiling programs containing these header files, you may specify the `-ansi 'option. Other predefined macros, such as __unix__ and __vax__, no matter whether there is a` -ansi' option, always valid.

Using the `-ansi 'option does not automatically reject the non-ANSI program unless added to the` -pedant' option as a supplement to the `-ansi 'option.

When using the `-ansi 'option, the preprocessor will preview a __strict_ansi__ macro. Some headers pay attention to this macro to avoid declaring certain functions, or avoid defining certain macros, these functions and macro are not called by ANSI standards This will not interfere with the programs that use these names elsewhere.

-FNO-ASM

Not to

ASM, Inline

or

Typeof

As a keyword

,

So these words can be used to make an identifier

.

use

__ASM__, __inline__

with

__typeof__

Ability to replace them

. `-ansi '

Implicit declaration

`-fno-asm '.

-fno-builtin

Do not accept built-in functions that are not two underscores

Built-in function.

Currently affected functions

_exit, Abort, ABS, Alloca, Cos, Exit, Fabs, Labs, Memcmp, Memcpy, Sin, SQRT, STRCMP, STRCPY,

with

Strlen.

`-ansi 'options prevent alloca and _exit from built-in functions.

-fhosted

Compile according to host environment

;

He implies the statement

`-fbuiltin '

Option

,

And the warning is incorrect

main

Function declaration

.

-freeestanding

Compile by independent environment

;

He implies the statement

`-fno-builtin '

Option

,

But also

main

There is no special request

.

(Translation: Host Environment, all standard libraries are available, the main function returns an int value, typical examples are almost all programs other than the kernel. The corresponding independent environment does not exist in standard libraries, the program entry is also It is not necessarily main, the most obvious example is the operating system core. Details reference information recent in the GCC website)

-fno-strict-prototype

Declaration for function without parameters

,

E.g

`Int foo (); ',

press

C

Style treatment

---

That is, no number of parameters or types

(

Only

C ).

Under normal circumstances

,

Such a function

foo

in

C

Meaning the parameters empty

.

-Trigraphs

stand by

ANSI C Trigraphs. `-Ansi '

Option implies declaration

`-trigraphs'.

-traditional

Try to support the tradition

C

Some aspects of the compiler

.

See

GNU C

manual

,

We have removed the details from here

,

This is when the content is outdated

,

People will not blame us

.

In addition to one thing: For C programs (not c), `-traditional 'options bring an additional effect, allowing this assignment. His effect is the same as the` -fthis-is-variable' option.

-Traditional-CPP

Try to support the tradition

C

Some aspects of the preparation

.

In particular, the content of the pre-processor is mentioned above.

,

But not included

`-traditional '

Other effects of options

.

-fdollars-in-identifiers

Allowed in the identifier

(Identifier)

In use

`$ '

character

(

Only

C ).

You can specify

`-fno-dollars-in-identifiers'

Options showed disabled use

`$ '

symbol

(GNU C

By certain target system

`$ '

symbol

,

But not all systems

.)

-fenum-int-equiv

allow

int

Type to enumeration type

(ENUMERATION)

Implicit conversion

(

Be limited to

C ).

Under normal circumstances

GNU C

Allowance

ENUM

Until

int

Conversion

,

It is not possible.

.

-fexternal-templates

Declaration for template

(Template Declaration)

Produce smaller code

(

Be limited to

C ),

The method is for each template function

(Template function),

Generate a copy only in their place

.

I want to successfully use this option

,

You must be in all files that use templates

,

mark

`#pragma impLementation '

definition

)

or

`#pragma interface '(

statement

).

When the program is compiled with `-fexternal-templates', all the template instances are all external types. You must make the required instance appear in the implementation file. You can implement this with TypeDef, and he references each instance of the required Comparison, if you use the default options `-fno-external-templates', all template instances are clearly set to built-in.-Fall-Virtual

All possible member functions default to virtual functions

.

All member functions

(

In addition to the constructor and

New

or

Delete

Member operator

)

Deverse virtual functions

.

This does not indicate that each call member function will pass through the internal virtual function table. In some cases, the compiler can determine that you can call a virtual function directly; then call it directly.

-fcond-mismatch

Allow the type of the second and third parameters of the conditional expression without match

.

This expression of this expression is

Void.

-fthis-is-variable

Allow

THIS

Value

(

Only

C ).

Merged user-defined free storage management mechanisms

C

Rear

,

Assignable

`THIS '

Appetite

.

therefore

,

by default

,

Internal pair of class member functions

THIS

Assignment is invalid

.

However, in order to backward compatibility

,

You can pass

`-fthis-is-variable '

Option makes this operation valid

.

-funsigned-char

Put

charr

Defined as unsigned type

,

as

Unsigned char.

Various machines have their own default char types. It may be unsigned char or Signed Char.

Ideally, a portable program always uses signed char or unsigned char. But many programs have been written as only simple char, and look forward to this is the number of symbols (or no sign) The specific situation depends on the target machine of the program. This option, and its antisense option, so that the program works on the corresponding default value.

Char types should always be explicitly defined as signed char or unsigned char, even if it is exactly the same.

-fsigned-char

Put

charr

Defined as a symbol type

,

as

Signed char.

This option is equivalent to `-fno-unsigned-char ', he is the opposite option of The Negative Form of` -funsigned-char'. Similarly, `-fno-signed-char 'is equivalent to` -funsigned-char'.

-fsigned-bitfields

-funsigned-bitfields

-fno-signed-bitfields

-fno-unsigned-bitfields

If there is no clear statement

`signed '

or

`unsigned '

Modifier

,

These options are used to define a symbolic domain

(Bitfield)

Or unsigned bit

.

Default

,

The bit field is symbolic

,

Because of their inherited basic integer type

,

Such as

Int,

Is the number of symbols

.

However, if the `-traditional 'option is specified, the bit field is always unsigned.

-fwritable-strings

Store string constants to optional data segments

,

And don't do special treatments

.

This is to be compatible with some old procedures

,

They assume that string constants can be writable

. `-traditional '

Option also has the same effect

.

Tampering string constant is a very bad idea; `` constant '' should be constant.

Preprocessor Option

The following options are for

C

Prepaid

,

Preprocessors used before formal compilation

,

Correct

C

Source file for some processing

.

If you specify the `-e 'option, the GCC is only preprocessing. Some options must be made together with the` -e' option because their output results cannot be used to compile.-Include file

Before processing the regular input file

,

First process file

File,

the result is

,

file

File

Content first get compiled

.

Command line

`-D '

with

`-U '

Option forever

`-include file '

Previous process

,

Whether they are in the order in the command line?

.

however

`-include '

with

`-imacros'

Options handles sequentially

.

-imacros file

Before processing the regular input file

,

First process file

File,

But ignore the output result

.

Due to the discardment

File

Output content

, `-imacros file '

The only effect of the option is to make the file

File

Macro definition

,

Can be used for other input files

.

Handle

`-imacrosfile '

Option before

,

Preparation rulers first proceed

`-D '

with

`-U '

Option

,

Don't care about their order on the command line

.

however

`-include '

with

`-imacros'

Options handles sequentially

.

-idirafter Dir

Put the catalog

DIR

Add to the second included path

.

If a header is included in the main included path

(

use

`-I '

Added path

)

Not found

,

Preprocessor search the second included path

.

-IPRefix Prefix

Specify

Prefix

Follow-up

`-iwithprefix '

Option prefix

.

-iwithPRefix Dir

Add the directory to the second included path

.

Directory name

Prefix

with

DIR

Incorporate

,

Here

Prefix

Previously

`-iprefix '

Option specified

.

-nostdinc

Don't look for headers in the standard system directory

.

Search only

`-I '

Option specified directory

(

And current catalog

,

If appropriate

).

In combination with the `-nostdinc 'and` -i-' option, you can limit the contents of the included file to the explicit specified directory.

-nostdinc

a

C

Find header files in the special standard directory

,

But still search other standard catalogs

(

Be established

`libg '

Use this option when

.)

-undef

Don't predefine any non-standard macros

(

Includes system structure logo

).

-E

Run only

C

Prepaid

.

Prerequisites all specified

C

Source File

,

The result is sent to standard output or designated output files

.

-C

Tell the pre-processor not to discard the comment

.

Cooperation

`-E '

Options

.

-P

Tell the pre-processor not to produce

`#Line '

command

.

Cooperation

`-E '

Options

.

-M [-mg]

Tell the pre-processor output a suitable

Make

the rule of

,

Dependency relationship used to describe each target file

.

For each source file

,

Preprocessor outputs one

Make

rule

,

Target item for this rule

(Target)

Is the target file name corresponding to the source file

,

Dependency

(dependence)

Source file

`#include

All files referenced

.

The rules that are generated can be a single line

,

But if it is too long

,

then apply

`/ '-

Renewal is multi-line

.

Rule is displayed in standard output

,

Do not produce pretreated

C

program

.

`-M 'implies the` -e' option.

`-Mg 'requires the missing header file to be treated, and assumes that they and source files are in the same directory. Must be used with` -m' options.-Mm [-mg]

with

`-M '

Options Similar

,

However, the output is only related to user header files.

,

Like this

`#include file" '.

Ignore the system header file such as

`#include '.

-Md

with

`-M '

Options Similar

,

But put the dependency information output in the file

,

The file name is at the end of the output file name

`.o '

Replace

`.d '

produce

.

Continue the designated compilation

--- `-md '

Not like

`-M '

That block normal compilation tasks

.

Mach Utility Tools `MD 'Ability to merge the` .d' file, generate a single dependency file that applies to `make 'commands.

-Mmd

with

`-Md '

Options Similar

,

However, the output is only related to user header files.

,

Ignore the system header file

.

-H

In addition to other ordinary operations

, GCC

Show referenced header names

.

-Aquestion (Answer)

If the pre-processor does condition test

,

Such as

`#if #question (Answer) ',

This option can be asserted

(Ask) Question

The answer is

Answer. -a- '

Turn off standard assertions generally used to describe target machines

.

-Dmacro

Define macro

Macro,

The content of the macro is defined as a string

`1 '.

-Dmacro = DEFN

Define macro

Macro

Content

DEFN.

Command line

`-D '

Option

`-U '

Option before processing

.

-Umacro

Cancel the macro

Macro. `-u '

Options in all

`-D '

After the option

,

But take priority

`-include '

or

`-imacros'

Option

.

-dm

Tell the pre-processor output a valid macro definition list

(

Macro definition still is still effective at the end of the pre-processing

).

This option needs to be combined

`-E '

Options

.

-DD

Tell the pre-processor to pass all macro definitions to the output

,

Display in the order of appearance

.

-DN

with

`-dd '

Options Similar

,

But ignore macro parameters or content

.

Only displayed at the output

`#define name.

Assembler Option

-WA, Option

Put the options

Option

Pass to the assembler

.

in case

Option

Contain a comma

,

Just divide multiple options in a comma

.

Connector Option (Linker Option)

The following options are used for compiler connection destination files

,

When outputting executable files

.

If the compiler does not connect

,

They are meaningless

.

Object-file-name

If some files do not have a particularly clear suffix

A Special Recognized SUFFIX, GCC

I think they are target documents or library files.

(

According to the content

,

Connectors can distinguish between target files and library files

).

in case

GCC

Perform connection operation

,

These target files will become input files for connectors

.

-llibrary

Connection name

Library

Library file

.

The connector finds this library file in the standard search directory, the real name of the library file is `liblibrary.a '. The connector will reference this file as a file name get an accurate description.

Search Directory In addition to some system standard directories, the path specified by the user in `-l 'option is included.

Generally speaking, the file found by this method is the library file - that is, the archive file consisting of the target file. The method of connecting the archive file is: Scan the archive, find some members, the symbols of these members It has been referenced, but it has not been defined. However, if the connector finds a normal target file, not the library file, connect this target file in a usual way. Specify the uniqueness of the `-l 'option and the specified file name The difference is that the `-l option uses` lib 'and `.a' to wrap the library, and search some directories.-Lobjc

This one

-L

Special form for options for connectivity

Objective C

program

.

-NostartFiles

Not connected system standard startup file

,

Standard library files are still using

.

-nostdlib

Do not connect system standard launch files and standard library files

.

Just pass the specified file to the connector

.

-static

Dynamically connected

Dynamic Linking

System

,

Block connectivity libraries

.

This option is invalid on other systems

.

-shared

Generate a shared target file

,

He can connect to other target files to generate executables

.

Only some system support this option

.

-symbolic

When establishing a shared target file

,

Bind the reference to the global symbol

.

Warning for all unable to resolve reference

(

Unless the connection editing option

`-Xlinker -z -xlinker defs'

replace

).

Only some system support this option

.

-XLINKER Option

Put the options

Option

Pass to the connector

.

You can use him to transfer system-specific connection options

, GNU CC

Unable to identify these options

.

If you need to pass the parameters, you must use two `-xlinker ', one pass option, and pass his parameters again. For example, if you pass the` -assert definitions', you must write into `-xlinker -assert-xlinker definitions ', You can't write a `-xlinker" -assert definitions "', because this will pass the entire string as a parameter, obviously this is not the connector looks forward.

-WL, Option

Put the options

Option

Pass to the connector

.

in case

Option

There is a comma

,

Just divide multiple options in a comma

.

-u symbol

Cause the connector to cancel

Symbol

Symbol definition

,

Thus connect the library module to achieve the definition

.

You can use multiple

`-u '

Option

,

Each keep up with different symbols

,

Make the connector to the additional library module

.

Directory Option (Directory Option)

The following options specify the search path

,

Used to find head files

,

Library file

,

Or some members of the compiler

:

-IDIR

Add in the search path list of header files

DIR

table of Contents

.

-I-

Anything

`-I- '

In front

`-I '

Option specified search path only

`#include" file "'

This situation

;

They can't be used to search

`#include '

Head file included

.

If the search path specified by `-i 'option is behind the` -i-' option, you can search all `#include 'instructions in these paths. (Generally, the -i option is useful.)

Also, `-i- 'option prevents the current directory (where to store the current input file) becomes the first choice for search` #include "file"'. There is no way to overcome the effect of `-i- 'option. You can Specify the `-i. 'Search that directory, it is the current directory when calling the compiler. This is not exactly exactly the default behavior of the preprocessor, but the result is usually satisfactory.

`-I- 'does not affect the use of system standard catalog, so` -i-' and `-nostdinc 'is different options. -LDIR

in

`-l '

Add in the search path list of options

DIR

table of Contents

.

-BPREFIX

This option points to where to find executable

,

Library file

,

And compiler their own data files

.

The compiler driver needs to perform some of the subroutines below: `CPP ',` CC1' (or C `cc1plus'),` as' and `ld '. He put Prefix prefixed the prefix of the program that is executed, It may include also include `Machine / Version / '.

For subroutines to be run, the compiler driver first tries to add the `-b 'prefix (if present). If the file is not found, or if you do not specify the` -b' option, the compiler will then test two standard prefixes` / usr / lib / gcc / 'and `/ usr / local / lib / gcc-lib /'. If you still haven't find the required file, the compiler is looking for any prefix in the path specified by` path 'environment variable. File name.

If there is a need, run-time support file `libgcc.a 'is also within the search range of` -b' prefix. If you are not found here, you are looking for the two standard prefix mentioned above, only This is not. If the above method does not find this file, it will not connect to him. Most of the machines, `libgcc.a 'is not a little less.

You can get an approximation effect through environment variables, gcc_exec_prefix; if this variable is defined, its value is prefixed as above. If you specify the `-b 'option and GCC_EXEC_PREFIX variable, the compiler first uses` -b' Options, and then try the environment variable.

WARNING OPTION

Warning is a diagnostic information for program structure

,

The program does not necessarily have an error

,

But there is a risk

,

Or may exist errors

.

The following options control the number and type of warning generated by the GNU CC:

-fsyntax-only

Check the syntax error in the program

,

But do not produce output information

.

-w

Prohibit all warning information

.

-Wno-import

Prohibition of all

#import

Warning information

.

-pedantic

Open complete suit

ANSI C

All warning diagnosis required by the standard

;

Refused to accept procedures with prohibited grammar expansion

.

Regardless of this option, the program that meets the ANSI C standard should be able to be properly compiled (although the very few programs need a `-ansi 'option). However, if this option is not available, some GNU extensions and traditional C features are also supported. Use This option can reject these programs. There is no reason to use this option, and he exists just to meet some nerd (PEDANT).

For alternative keywords (they start and end with `__ ')` -pedant' does not generate warning information. Pedantic does not warn the expression behind __extension__. But only use this in the system header file. Semicament measures, the application is best to avoid.

-pedantic-errors

This option is

`-pedant

similar

,

But display mistakes rather than warning

.

-W

Show additional warning information for the following events

:

*

Non-volatile automatic variable

(Nonvolatile Automatic Variable)

May be called

Longjmp

Changing

.

These warnings occur only when optimizing compile

.

The compiler only knows the call to SetJMP. He cannot know where to call Longjmp, in fact, a signal processing routine can call him anywhere in the program. The result is that even if the program is no problem, you may get a warning. Because you cannot call Longjmp in places that may have problems.

*

Cannot return value

,

Can also not return a function of the value

(

The lack of the end of the function body is considered to not return a function value

)

E.g

,

The following functions will cause this warning:

Foo (a)

{

IF (a> 0)

Return A;

}

due to

GNU CC

I don't know if some functions never return.

(

contain

Abort

with

Longjmp),

Therefore, there may be a false warning

.

*

There is no effect on the left side of the expression statement or comma expression.

Side Effect.

If you want to prevent this warning

,

The unused expression should be forced to convert to

Void

Types of

.

E.g

,

Such expressions

`x [i, j] '

Will lead to warning

,

and

`x [(void) i, j] '

No

.

*

No symbolic number

`> '

or

`<= '

Comparison of zero

.

-WIMPLICIT-INT

WARNING No specified statement

.

-WIMPLICIT-FUNCTION-DECLAration

Warning functions used before the declaration

.

-WIMPLICIT

with

-WIMPLICIT-INT

with

-WImplicit-function-declaration.

-Wmain

If

main

Function declaration or definition into a strange type

,

Warning

.

Typical case

,

This function is used for external connections

,

return

int

Numerical value

,

No parameters

,

Or specify two parameters

.

-Wreturn-Type

If the function defines the return type

,

And the default type is

int

type

,

Warning

.

At the same time, warned those who do not return

Return

Statement

,

If the function they belong is not

Void

Types of

.

-Wunused

If a part variable is not used in addition to the statement

,

Or declare static functions but no definition

,

Or obviously do not use the calculation results of a statement

,

Warning

.

-WSwitch

If a piece

Switch

The parameters of the statement are enumerated types

,

But there is no corresponding

Case

Statement use enumeration elements

,

Warning

(Default

The appearance of statements can prevent this warning

.)

Beyond the scope of enumeration

Case

The statement also causes this warning

.

-Wcomment

If you comment start sequence

`/ * '

In the comment

,

Warning

.

-Wtrigraphs

Warning any appearance

Trigraph (TRIGRAPH)

Suppose they are allowed

).

-Wformat

Check

PRINTF

with

Scanf

Call for functions

,

Confirm the consistency of each parameter type and format string

.

-Wchar-subscripts

WARNING type is

charr

Array subscript

.

This is a common mistake

,

Programmers often forget on some machines

charr

Symbolic

.

-Wuninitialized

Automatic variables before initialization

.

These warnings may only do optimize compilation, because they need data stream information, only to estimate data flow information when optimizing. If you do not specify the `-o 'option, these warnings will not appear.

These warnings are only for variables of the allocated register. Therefore, there is no such thing as the variable that is declared as Volatile, and the variable that has been acquired, or the length is not equal to 1, 2, 4, and 8 bytes. Also also Will not occur on the structure, a combination or array, even if they are in the register.

Note that if a variable only calculates a value that has never been used, this may not be warned. Because such computing has been deleted by data stream analysis before displaying a warning.

These warnings are optional because the GNU CC has not smart to discriminate all the cases, knowing some of the code that looks wrong is actually correct. The following is an example:

{

INT X;

Switch (Y)

{

Case 1: x = 1;

Break;

Case 2: x = 4;

Break;

Case 3: x = 5;

}

Foo (x);

}

in case

y

Always

1, 2

or

3,

Then

x

Will always be initialized

,

but

GNU CC

I don't know this.

.

Below is another universal case

:

{

Int save_y;

IF (change_y) save_y = y, y = new_y;

...

IF (change_y) y = save_y;

}

There is no mistake here

,

Because only set

Save_y

Use him

.

Defining all the functions returned as Volatile avoids some similarities and not warnings.

-Wparentheses

In some cases, if you ignore the brackets

,

Warning

.

-WTemplate-Debugging

In

C

Used in the program

Template

when

,

If debugging

(Debugging)

Not completely effective

,

Warning

(

only use for

C ).

-Wall

Combined with all of the above

`-W '

Option

.

Usually we recommend to avoid these warned usage, we believe

,

The use of proper combination of macros can easily avoid these usage.

The remaining `-w ... 'option is not included in` -wall', because we believe that these compiler warned program structures can be reasonably used in the "clean" program.

-Wtraditional

If some program structure is in a tradition

C

Performance and

ANSI C

different

,

Warning

.

*

Macro ginseng appears in a string constant in the macro body

.

Tradition

C

Alternative macro

,

and

ANSI C

Then depend on part of a constant

.

*

A function in block

(Block)

Declaration is external

,

But call after the end of the block

.

*

Switch

The operability type of the statement is

Long.

-Wshadow

Once some local variables are blocked, another part variable

,

Warning

.

-WID-CLASH-LEN

Once the two determined identifiers have the same top

Len

Character

,

Warning

.

He can help you develop some obsolete

,

Procedure compiled on the compiler of the brain

.

-Wpointer-Arith

Any statement relies on the size of the function type

(size)

or

Void

Type size

,

Warning

GNU C

For convenience of calculation

Void *

Pointer and function pointer

,

That is defined as the size of these types

1.

-WCAST-QAL

Once a pointer is forced to transform, when the type modifier is removed

,

Warning

.

E.g

,

If

Const char *

Forced to convert to ordinary

Char *

Time

,

Warning will appear

.

-WCAST-ALIGN

Once a pointer type is forced to convert

,

Alignment to the address required for the target

(Alignment)

increase

,

Warning

.

E.g

,

Some machines can only be

2

or

4

Access integer on the byte boundary

,

If you put on this model

Char *

Forced conversion

Int *

Types of

,

Warning

.

-WWRITE-STRINGS

The type of string constant is specified is

Const char [length],

therefore

,

Copy this address to

Non-const char *

The pointer will produce a warning

.

These warnings can help you find out the code that is trying to write a critical quantity during compilation.

,

But you must use very carefully in the statement and intra shape

CONST,

Otherwise they can only bring trouble

;

So we didn't let

`-Wall '

Provide these warnings

.

-WConversion

If the type conversion caused by a function is different, the type conversion is different when there is no function.

,

Warning

.

Here, the mutual conversion of the fixed point and floating point number

,

Change the width or symbol of the fixed point number

,

Unless they and default statements

(Default Promotion)

the same

.

-Waggregate-return

If you define or call the return structure or a combined function

,

Warning

(

From language perspective you can return an array

,

However, it will cause warnings

.)

-Wstrict-prototypes

If the function's declaration or definition does not point out parameter types

,

Warning

(

If the forward reference description of the function points to the parameter type

,

Allows the use of old-style function definitions

,

Can't produce warning

.)

-Wmissing-prototypes

If there is no pre-declare function, the full-term function is defined.

,

Warning

.

Even if the function defines the original shape, it will generate this warning.

.

His purpose is to check the global function that is not declared in the header file.

.

-Wmissing-declarations

If there is no pre-declaration, it defines a full-class function.

,

Warning

.

Even if the function defines the original shape, it will generate this warning.

.

The purpose of this option is to check the global function that is not declared in the header file.

.

-Wredundant-decls

If you define multiple declarations in the same visible domain

,

Warning

,

Even if these repetitive declarations are valid and have no difference

.

-Wnested-externs

If a certain

Extern

Declaration appears inside the function

,

Warning

.

-Wenum-Clash

A warning for the conversion between different enumeration types

(

Only applies to

C ).

-Wlong-long

If used

Long Long

Types issued a warning

.

This warning is the default

.

use

`-Wno-long-long '

Options to prevent this warning

. `-Wlong-long '

with

`-Wno-long-long '

only at

`-pedant

Under the way

.

-WOverLoaded-Virtual

(

Only applies to

C .)

In inheritance

,

Definition of virtual functions must match the type feature declared in the virtual function in the base class

(TYPE SIGNATURE).

When the inheritance is declared a function

,

It may be a wrong attempt to define a virtual function

,

Use this option to generate warnings

:

that is

,

When a function and the virtual function in the base class are the same name

,

However, the type characteristics do not meet any virtual functions of the base class.

,

The compiler will issue a warning

.

-Winline

If a function cannot embed inner

(inline),

Whether it is a statement

inline

Or is it specified

-finline-functions

Option

,

The compiler will issue a warning

.

-Wrror

Vision warning is wrong

;

Any warning will give up compilation

.

Debugging option (DEBUGGING OPTION)

GNU CC

Have a lot of special options

,

Can debug users' programs

,

Can also

GCC

Tired

:

-g

Local format in operating system

(Stabs, Coff, XCoff,

or

DWARF).

Generate debugging information

GDB

Can use these debugging information

.

On most of the system using the Stabs format, `-g 'option launches additional debugging information that only GDB is used; this information makes the GDB debugging effect, but it is possible to cause other debugger crashes, or refuse to read the program. If You determine if you want to generate additional information, use `-gstabs ',` -gstabs', `-gxcoff ',` -gxcoff', `-gdwarf ', or` -gdwarf' (see below).

Unlike most C compilers, the GNU CC allows for use in the `-g 'and` -o' option. Optimized code occasionally manufactures some surprises: some declared variables do not exist at all; the control flow directly to It is expected that some statements are not executed because the calculation results are constant or have been determined; some statements are executed elsewhere because they have been moved outside.

However, it proves that the output of debug optimization is possible. It is reasonable to use an optimizer to use an optimizer that may contain errors.

If the GNU CC supports outputting multiple debugging information, the following options are very useful.

-ggdb

Local format

(

If supported

)

Output debugging information

,

As much as possible

GDB

Expand

.

-gstabs

In

Stabs

format

(

If supported

)

Output debugging information

,

Not included

GDB

Expand

.

This is most

BSD

System

DBX

Use format

.

-gstabs

In

Stabs

format

(

If supported

)

Output debugging information

,

Use only

Gnu

Debugger

(GDB)

Understandable

Gnu

Expand

.

Using these extensions may result in other debuggers crashing or refusing to read

.

-gcoff

In

Coff

format

(

If supported

)

Output debugging information

.

This is at

System v

Most of the fourth edition

System v

System

SDB

Use format

.

-gxcoff

In

XCOFF

format

(

If supported

)

Output debugging information

.

this is

IBM RS / 6000

System

DBX

Format used by the debugger

.

-gxcoff

In

XCOFF

format

(

If supported

)

Output debugging information

,

Use only

Gnu

Debugger

(GDB)

Understandable

Gnu

Expand

.

Using these extensions may result in other debuggers crashing or refusing to read

.

-gdwarf

In

DWARF

format

(

If supported

)

Output debugging information

.

This is most

System v

Fourth edition system

SDB

Use format

.

-gdwarf

In

DWARF

format

(

If supported

)

Output debugging information

,

Use only

Gnu

Debugger

(GDB)

Understandable

Gnu

Expand

.

Using these extensions may result in other debuggers crashing or refusing to read

.

-glevel -ggdblevel -gstabslevel -gcofflevel -gxcofflevel

-gdwarflevel

Request to generate debugging information

,

At the same time

Level

Point out how much information

.

default

Level

Value

2.

Level 1 outputs the minimum amount of information, only enough in the program that does not plan to debug, include the description of the function and external variable, but there is no local variable and line number information.

Level 3 contains more information, such as all macro definitions that appear in the program. When you use the `-g3 'option, some debuggers support macro expansion.

-p

Generate additional code

,

Output

Profile

information

,

Analysis program

PROF

use

.

-pg

Generate additional code

,

Output

Profile

information

,

Analysis program

GPROF

use

.

-A

Generate additional code

,

Used to output basic blocks

(Basic Block)

of

Profile

information

,

It records the number of executions of each basic block

,

For example

TCOV

Program analysis of this class

.

But pay attention

,

This data format is not

TCOV

expected

.

finally

GNU Gprof

These data will be processed

.

-AX

Generate additional code

,

Use

'bb.in'

Document reading basic block

Profile

parameter

,

Put

Profile

The result is written

'bb.out'

file

. `bb.in '

Contains a list of functions

.

Once a function in the list is entered

, PROFILE

Operation begins

,

After leaving the outermost function

, PROFILE

End of operation

.

In

`- '

Exclude the function of the preceded name

Profile

Outside operation

.

If the function name is not unique

,

It can write

`/path/filename.d:functionname '

Come to clarify

. `bb.out '

Will list some valid file names

.

These four function names have special meaning

: `__BB_JUMPS__ '

Lead to jump

(JUMP)

Frequency writing

`bb.out '.` __bb_trace__' causes the basic block sequence to pass through the pipeline

`gzip ',

Output

`bbtrace.gz '

file

. `__BB_HIDECALL__ '

Leading from tracking

(Trace)

Exclude

Call

instruction

. `__BB_SHOWRET__ '

Resulting in tracking instructions

.

-dletters

Compile

,

in

letters

Specified timing

(DUMP).

Used to debug compiler

.

Most dump file names add words to the source file name

(

E.g

`foo.c.rtl '

or

`foo.c.jump ').

-dm

Dump all macro definitions at the end of the pretreatment

,

No output to the file

.

-DN

Dump all macro names at the end of the pretreatment

.

-DD

Dump all macro definitions at the end of the pretreatment

,

Eat on normal output

.

-dy

Parsing

(PARSE)

Time to transfer debugging information in standard error

.

-dr

RTL

Dump after the stage

`file.rtl '.

-DX

Generate only the function

RTL,

Not compiling

.

Usually and

`r '

Join

.

-dj

After the first jump optimization

`file.jump '.

-DS

CSE

Including sometimes following

CSE

Rear jump optimization

)

After dump

`file.cse '.

-DL

Recurns and then dump

`file.loop '.

-dt

the second time

CSE

deal with

(

Including sometimes following

CSE

Rear jump optimization

)

After dump

`file.cse2 '.

-DF

Process analysis

(Flow Analysis)

After dump

`file.flow '.

-DC

Instruction combination

(Instruction Combination)

After dump

`file.combine '.

-DS

First instruction arrangement

(instruction schedule)

After dump

`file.sched '.

-DL

Dump after the local register is allocated

`file.lreg '.

-dg

The global register is allocated after dump

`file.greg '.

-dr

Second command arrangement

(instruction schedule)

After dump

`file.sched2 '.

-dj

The last jump optimization is dump

`file.jump2 '.

-DD

Postpone branch schedule

Delayed Branch Scheduling

After dump

`file.dbr '.

-DK

register

-

The stack is transferred after transition to

`file.stack '.

-DA

Generate all dumps

.

-dm

After running

,

In standard error display memory usage statistics

.

-DP

What models are used in assembly output filling

(Pattern)

And alternative mode

.

-fpretend-float

Cross-compilation

,

Assume that the target machine and the host use the same floating point format

.

It causes floating point constants for output errors

,

But when running on the target machine

,

Real instruction sequences are likely to

GNU CC

Hopeful

.

-SAVE-TEMPS

Save those usually

``

temporary

'' '

Intermediate file

;

Place in the current directory

,

And naming according to the source file

.

therefore

,

use

`-c -save-temps'

Option compilation

`foo.c '

Generate

`foo.cpp '

with

`foo.s'

as well as

`foo.o '

file

.

-Print-file-name = library display library file

Library

Full path name

,

Use this library when connecting

---

What else is not

.

According to this option

, GNU CC

Neither compilation

,

Nor connected

,

Only display the file name

.

-Print-libgcc-file-name

with

`-Print-file-name = libgcc.a '

same

.

-Print-prog-name = program

Similar

`-Print-file-name ',

But find the program

PROGRAM

Such as

`CPP '.

Optimization option (Optimization Option)

These options control a variety of optimization measures

:

-O

-O1

optimization

.

For large functions

,

Optimize compilation to occupy a slight time and quite large memory

.

When not using the `-o 'option, the compiler's goal is to reduce the compilation overhead, so that the compile results can be debugged. Statement is independent: If you use a breakpoint abort from two statements, you can re-assign any variables. Or point the program counter to other statements in the function body, and accurately obtain the results you expect from the source program.

When you don't use the `-o 'option, you only declare that the REGISTER variable is allocated to use the register. The compile result is slightly inferior to the PCC that does not need to be` -o' option.

Using the `-o 'option, the compiler will try to reduce the size and execution time of the target code.

If you specify the `-o 'option,` -fthread-jumps' option will be opened. On the machine with DELAY SLOT, `-fdelayed-branch' option will be opened. Even if there is no frame Frame Pointer also supports debugging machines, `-fomit-frame-pointer 'option will be opened. Some machines may also open other options.

-O2

More optimization

.

In addition to optimization options involving spatial and speed exchange

,

Execute almost all optimization

.

For example, do not loop

(loop unrolling)

And functions

Inline.

with

-O

Option comparison

,

This option adds both compilation time

,

Also improve the operation of generating code

.

-O3

More more

.

Except

-O2

All

,

It is also open

-finline-functions

Option

.

-O0

Non-optimization

.

If you specify multiple -O options, no matter how the belt does not have a number, the last option is an option to take effect.

Options such as `-fflag 'describe some of the machine-independent switches. Most switches have affirmative and negation two formats; the negative format of` -ffoo' switch option should be `-fno-foo '. The following list is only displayed A format --- that is not a default option. You can construct another format by removing or adding `NO- '.

-ffloat-store

Do not store floating point variables in registers

.

This prevents unwanted high precision on some machines

,

Such as

68000

Floating point register

(

From

68881)

The precision saved exceeded

Double

Accuracy should have

.

For most programs, only high precision is only good. However, some procedures are strictly dependent on the definition of the IEEE floating point number. You can use the `-ffloat-store 'option for such programs.

-fmemoize-lookups

-fsave-memoized

Exploration method

(HEURISTIC)

Make faster compilation

(

Only

C ).

Discovery is not used by default

.

Since the exploration method is only valid for some input files

,

Compiling speeds of other programs will become slower

.

The first compiler must establish a call to the member function (or reference to member data). It must (1) to determine if this class implements the member function of that name; (2) Decide which member function of the call (involved) Specifies which type of conversion you need to do); (3) Check if the member function is visible to the caller. All of these constitute a slower compilation. General circumstances, the second to member functions (or reference to member data), It must be processed again. This means like this code cout << "this" << p << "HAS" << n << "LEGS./N";

It is necessary to do six traverses for the entire three steps. By using software cache, `` hit '' can significantly reduce this price. However, unfortunately, using this kind of cache must implement other mechanisms, bringing its own overhead. `-fmemoize-lookups' option Opens the software cache.

Because the function of the function is different, the function of the function on the member and member function may also be different. G may need to refresh the cache. Use the `-fmemoize-lookups' option, each compiled a function refreshes the cache. And` -fsave-memoized 'option also enables the same cache, but when the compiler finds the access rights generated by the final compiled function and the next function to be compiled, the compiler reserves the cache content. This is defined for a class Many member functions are very useful: In addition to some other classes of friends, each member function has exactly the same access as other member functions, so there is no need to refresh the cache.

-fno-default-inline

Silently do not embed the member function

,

Because they define within the scope of the class

(

only

C ).

-fno-defer-pop

Once the function returns

,

The parameter is immediately popped up

.

Machines that must be popped up after the call function

,

The compiler generally allows the parameters that call several functions to stack on the stack

,

Then pop up all times

.

-FFORCE-MEM

Before making mathematical operations, send the memory operand to use into the register

.

Convert memory to a potential public sub-expression

,

It may produce a better target code

.

If they are not public sub-expressions

,

Instruction combinations should eliminate their respective registers

.

I am happy to listen to different opinions.

.

-FFORCE-ADDR

Before making mathematical operations, send memory address constants to use into the register

.

It may be

`-fforce-mem '

A good target code

.

I am happy to listen to different opinions.

.

-FOMIT-FRAME-POINTER

For no frame pointer

Frame Pointer

The function

,

Do not save the frame pointer in the register

.

This avoids preservation

,

Setting and recovering the instruction of the frame pointer

;

Also provide an additional register for many functions

.

But in most machines will not be debugged

.

Some machines, such as VAX, this option is invalid because the standard call sequence automatically processes the frame pointer, and does not save anything by pretending to exist without saving anything. Machine Description Macro Frame_Pointer_Required Controls whether the target is supported.

-finline-functions

Integrate all simple functions into invigoors

.

The compiler explores what functions are simple enough

,

Worth this integration

.

If all the calls of all given functions are integrated, and the function declares that it is static, then the GCC has the right to not follow the assembly code output function.

-fcaller-saves

Allows value in the register

,

But this scheme is usually used by each function called

,

therefore

GCC

Generate additional code

,

Save and restore register content before and after the function call

.

Such assignments are achieved only when the generated code looks better than the anti-the results.

.

Some machines This option defaults to allow, usually these machines do not call the protection register instead of use.

-fkeep-inline-functions

Even if all calls are integrated

,

And the function is declared

STATIC,

Still output this function a separate

,

Releaseable version

.

-fno-function-cse

Do not store the function address into the register

;

Let the instruction to call the fixed function explicitly give the function address.

This option generates a low efficiency target code, but if this option is not used, some unusual HACK, change the output of the handup, may be confused due to optimization.

-fno-peephole

Prohibit any machine

Peephole

optimization

.

-FFAST-MATH

This option is for speed optimization

,

allow

GCC

Violate certain

ANSI

or

IEEE

rule

/

specification

.

E.g

,

It allows compiler to assume

SQRT

The parameters of the function are non-negative numbers

.

This option is not opened by any `-o 'option, because for mathematics functions implemented strictly on IEEE or ANSI rules / specifications, the program may generate an error result.

The following options control a specific optimization. `-O2 'option Open the following optimization items, in addition to` -funroll-loops' and `-funroll-all-loops' items.

The `-o 'option typically opens the` -fthread-jumps' and `-fdelayed-branch' optimization item, but the default optimization item on a particular machine is possible to change.

If you are very needed in special case, you can use the following options.

-fstregth-reduuce

Reduce loop strength

(Loop Stregth Reduction)

optimization

,

And eliminate repeating variables

.

-fthread-jumps

The location where the optimization is

,

If there is another condition of the destination of a jump branch

,

And this condition is included within the previous comparative statement

,

So implement optimization

.

According to the conditions

True

or

False,

The front branch redirects to the second branch or followed behind the second branch

.

-funroll-loops

Perform loop

(loop unrolling)

optimization

.

Only the number of cycles can be implemented at the time of compile or when the runtime is compiled.

.

-funroll-all-loops

Perform loop

(loop unrolling)

optimization

.

Implement all loops

.

Usually make the program run slower

.

-fcse-follow-jumps

In public sub-expression

(Common SubExpression Elimination)

when

,

If there is no other path to reach a destination of a jump

,

Sweake this

JUMP

instruction

.

E.g

,

in case

CSE

Encounter

Else

Squeaky

IF

Statement

,

When the condition is tested

False

Time

CSE

Follow

JUMP

Behind

.

-fcse-skip-blocks

It is similar to

`-fcse-follow-jumps'

Option

,

but

CSE

Back behind the condition

,

Condition jump skipping statement block

(Block).

in case

CSE

A simple

IF

Statement

,

Without

Else

Clause

, `-fcse-skip-blocks'

Option will result

CSE

follow

IF

Generated jump behind

.

-freun-cse-after-loop

After performing loop optimization

,

Return public sub-expression

.

-felide-constructionors

If you look reasonably, you will omit the omnifier.

(

only

C ).

According to this option

,

For the following code

, GNU C

Directly call

foo

initialization

Y,

No need to pass temporary variables

:

A foo (); a y = foo ();

If there is no such option, GNU C first initializes Y, then assigns Y; then the result of the FOO is assigned to the temporary variable; finally, replace the initial value of `Y 'with a temporary variable.

The ANSI C standard specifies the default behavior (`-fno-elide-constructors '). If the program is constructed,` -felide-constructors' option can make the program different performance, because some constructs may be ignored Call. -FexPensive-Optimizations

Execute some relative overhead a secondary optimization

.

-FDELAYED-BRANCH

If you support the target machine

,

It tries to rearrange the instruction

,

To use delay branch

(Delayed Branch)

Instruction void behind the instruction

.

-fschedule-insns

If you support the target machine

,

It tries to rearrange the instruction

,

In order to eliminate the execution pause caused by data

.

This can help floating point operations or memory access slower machines

,

Allow other instructions to be executed

,

Until the instruction or floating point operation is completed

.

-fschedule-insns2

Similar

`-fschedule-insns'

Option

,

But after the register is allocated

,

Need an additional instruction scheduling process

.

Relatively fewer registers

,

Moreover, the memory command is greater than one cycle machine.

,

This option is especially useful

.

Target Options (Target Option)

Default

, GNU CC

Compile the target code of this type

.

However, you can also install him into a cross compiler.

,

Compiler for other models

.

In fact

,

Different target machines

,

Can be installed at the same time

GNU CC

Corresponding configuration

.

Then

`-b '

Option Specify the target machine

.

By the way, the new version and the old version of the GNU CC can coexist. One version (which may be the latest) is the default version, but sometimes you want to use other versions.

-B Machine

parameter

Machine

Point out the compiled target model

.

This option is used to install the cross-compiler

GNU CC.

The value of the parameter Machine is the same as the machine type set when the GNU CC cross-compiler is configured. For example, if the cross-compiler is configured with `Configure i386v ', meaning compiling the System V target code on 80386, then you can pass` -b i386v 'Run the cross compiler.

If you do not specify a `-b 'option, you usually refer to compiling the native target code.

-V Version

parameter

Version

Point out which version is running

GNU CC.

This option is used to install multiple versions

GCC.

E.g

,

in case

Version

Yes

`2.0 ',

Mean operation

GNU CC 2.0

Version

.

If there is no designated `-v 'option, the default version depends on the installation of GNU CC, which is generally recommended to use universal versions.

Machine Related Option (Machine Dependent Option)

Every target model has its own special options

,

These options are used

`-m '

Switch guidance

,

Select different hardware models or configuration

---

E.g

, 68010

still is

68020,

Is there a floating point coprocessor

.

By specifying options

,

One version of the installation compiler can compile all models or configurations

.

In addition, some configuration of the compiler supports additional special options, usually in order to compatibility with this platform on the command line.

Below is a `-m 'option for 68000 series:

-m68000

-mc68000

Output

68000

Target code

.

If the compiler is based on

68000

System configuration

,

This option is the default option

.

-M68020

-mc68020

Output

68020

Target code

(

Instead of

68000).

If the compiler is based on

68020

System configuration

,

This option is the default option

.

-M68881

Output included

68881

Target code for floating point instructions

.

For most

68020

System This is the default option

,

Specified unless the compiler is set

-NFP.

-M68030

Output

68030

Target code

.

If the compiler is based on

68030

System configuration

,

This option is the default option

.

-m68040

Output

68040

Target code

.

If the compiler is based on

68040

System configuration

,

This option is the default option

.

-M68020-40

Output

68040

Target code

,

But don't use new instructions

.

The generated code can be

68020/68881

on

,

Can also

68030

or

68040

Upper effect

.

-MFPA

Output included

Sun FPA

Target code for floating point instructions

.

-MSoft-float

The output contains a target code that is called floating point library.

.

caveat:

The reserved library is not

GNU CC

Part

.

Generally say

GCC

Use this model

C

Compiler

,

But when you cross-compile, you can't use it directly.

.

You must manage your own function library for cross-compilation

.

-mshort

think

int

Type is

16

Bit wide

,

Equivalent

Short Int.

-Mnobitfield

Do not use the domain

(Bit-Field)

instruction

. `-m68000 '

Implicit specified

`-mnobitfield '.

-Mbitfield

Use bitmap

. `-m68020 '

Implicit specified

`-mbitfield '.

If you use unmarkable

GCC,

This is the default option

.

-mrtd

Adopt another function call

,

Function accepts fixed number of parameters

,

use

RTD

Command returns

,

This command returns the parameters in the stack when the instruction is returned.

.

This method enables the caller to save one instruction

,

Because he does not need to pop up parameters

.

This call agreed is not compatible with UNIX normal calls. So if you need to call the library function compiled by the UNIX compiler, you cannot use this option.

In addition, all parameters variable functions must provide a function prototype (including Printf); otherwise the compiler generates an error call code.

Also, if you carrier too much parameters while calling a function, the compiler will generate a serious error code. (Under normal circumstances, excess parameters are ignored safely.)

68010 and 68020 processors support RTD instructions, but 68000 does not support.

Here is the `-m 'option for VAX definitions:

-munix

No output some jump instructions

(AOBLEQ

and many more

), VAX

of

Unix

Assembler cannot span long range

(Long Ranges)

Process

.

-MGNU

If used

Gnu

Assembler

,

Output those jump instructions

,

-mg

Output

G-Format

Floating point number

,

replace

D-Format.

Here is the `-m 'option switch supported by SPARC:

-MFPU

-mhard-float

Output a target code containing floating point instructions

.

This is the default option

.

-Mno-fpu

-MSoft-float

The output contains a target code that is called floating point library.

.

caveat:

Not

Sparc

provide

Gnu

Floating point library

.

Generally speaking, using this model

C

Compiler

,

But you can't use it directly for cross-compilation

.

You must arrange yourself

,

Provide libraries for cross-compilation

.

-msoft-float changes the call agreement in the output file; therefore only use this option to compile the entire program.

-Mno-Epilogue

-mepilogue

use

-mepilogue

default

)

Option time

,

The compiler always places the exit code of the function in the tail of the function.

.

Any exit statement in the middle of a function

(

E.g

C

middle

Return

Statement

)

The jump instruction will result in the end of the function

.

When using the -Mno-epilogue option, the compiler is as used to extract the exit code at each function exit point.

-MNO-V8

-MV8

-MspARCLITE

These three options choose different kinds of

Sparc

system

.

By default (unless specifically for Fujitsu SparClite configuration), the GCC generates the SPARC V7 target code.

-MV8 generates a SPARC V8 target code. The only difference between his and V7 target code is that the compiler generates an integer multiplication and integer division instructions, and the SPARC V8 supports the instruction, and the V7 system does not support.-mspARCLite generates a sparclite target code. Add sparclite Supported integer multiplication, integer division single step scan (FFS) instruction. The V7 system does not support these instructions.

-MCyPress

-MSUPERSPARC

These two options selection processor model

,

Code optimization for the processor

.

-mcypress option (default) Enables the compiler to optimize the CyPress CY7C602 chip, the SparcStation / Sparcserver 3xx series uses this chip. This option also applies to vintage SparcStation 1, 2, IPX and other models..

The -msupersPARC option uses this chip to the SUPERSPARC processor optimized code, SparcStation 10, 1000, and 2000 Series. At this point, the option enables a complete SPARC V8 instruction set.

Here is the `-m 'option for Convex definitions:

-mc1

Output

C1

Target code

.

Compiler

C1

Moderate

,

This is the default option

.

-mc2

Output

C2

Target code

.

Compiler

C2

Moderate

,

This is the default option

.

-Margcount

Place a parameter count in front of each parameter list

Argument Count Word.

Some irreplaceable

Convex

with

VAX

Program requires this parameter number

(

The debugger doesn't need him

,

Unless the function comes with a list of viable parameters

;

This information is stored in the symbol table

.)

-Mnoargcount

Ignore parameter counting

.

If you use unmarkable

GCC,

This is the default option

.

Below is the `-m 'option defined for the AMD AM29000:

-mdw

The generated target code is considered

DW

Position

,

that is

,

Bytes and half-word operations are supported by hardware

.

This option is the default option

.

-MNODW

The generated target code is considered

DW

Unsettled

.

-MBW

The generated target is considered to support bytes and half-word write operations.

.

This option is the default option

.

-MNBW

The generated target code considers that the system does not support bytes and half-word write operations

.

This option is hidden.

`-mnodw '

Option

.

-msmall

Use small memory mode

,

Small memory mode assumes that all functions of all functions are located in one

256 kB

Segment

,

Or all the absolute addresses are less than

256K.

This can be used

Call

Instruction

Const, Consth, Calli

Instruction sequence

.

-mlarge

Assume that you can't use

Call

instruction

;

This is the default option

.

-M29050

Output

AM29050

Target code

.

-M29000

Output

AM29000

Target code

.

This is the default option

.

-Mkernel-registers

Generated target code reference

GR64-GR95

Register instead of

GR96-GR127

register

.

This option can be used to compile kernel code

,

The kernel needs a set of global registers

,

These global registers and registers used by user mode are completely unrelated

.

Note that when using this option, the register name in the `-f 'option must be Normal, User-Mode, Names.

-muser-registers

Use ordinary global register set

GR96-GR127.

This is the default option

.

-MSTACK-CHECK

Insert one after each stack adjustment

__MSP_CHECK

transfer

.

This option is often used for kernel code

.

Here is the `-m 'option defined for the Motorola 88K system:

-m88000

The generated target code can be

M88100

with

M88110

Normal work

.

-m88100

The generated target code is

M88100

The best work

,

But

M88110

Run on

.

-m88110 generated target code

M88110

The best work

,

May not be in

M88100

Run on

.

-midentify-revision

In the output of the assembler contains one

Ident

instruction

,

Record source file name

,

Compiler name and version

,

Time standard

,

And useful compilation options

,

-Mno-underscores

Output of the assembler

,

No next line does not add a next line in front of the symbol name

.

The default is to increase the underscore prefix in front of each name

.

-Mno-Check-Zero-Division

-MCHECK-ZERO-DIVISION

Early model

88K

System in addition to zero operation

,

Many machines cannot be saved in a specific situation

.

Use these options to avoid inclusion

(

Or you can clearly include

)

Additional code

,

These codes can check

,

Send exception signal

GCC

all

88K

Configuration default

`-mcheck-zero-division '

Option

.

-MOCS-Debug-Info

-Mno-OCS-Debug-Info

contain

(

Ignore

)

Additional debugging information

(

About the use of registers in each stack structure

88Open Object Compatibility Standard, `` OCS '',

Due to this information

GDB

No need for these extra information

DG / UX, SVR4,

with

Delta 88 SVR3.2

The default configuration is to include debugging information

,

other

88K

The default configuration of the model is to ignore this information

.

-MOCS-FRAME-POSITION

-Mno-OCS-Frame-Position

Mandatory

(

Not required

)

Store register values ​​to the specified location in the stack frame structure

(

press

OCS

instruction of

DG / UX, Delta88 SVR3.2

with

BCS

Default configuration

`-mocs-frame-position '

Option

;

other

88K

The default configuration of the model is

`-mno-ivs-frame-position '.

-Moptimize-arg-area

-Mno-Optimize-Arg-area

Control how to store function parameters in a stack structure

. `-moptimize-arg-area '

save space

,

But it is likely to drop some debugger

(

Not

GDB). `-Mno-Optimize-arg-area '

Calve better than standard options

.

by default

GCC

Non-optimization parameter domain

.

-mshort-data-

Num

Pass and

r0

Association

,

Send smaller data reference

(Data Reference),

This allows you to transfer a value with a single instruction.

(

Not a normal dual directive

).

Users in the options

Num

Which data reference control changes?

.

E.g

,

If you specify

`-mshort-data-512 ',

Then the affected data is less than

512

Byte data movement

. -MSHORT-DATA-NUM

Option pair is greater than

64K

of

Num

invalid

.

-Mserialize-Volatile

-Mno-Serialize-Volatile

produce

,

Or do not generate code to ensure consistent consistency of volatility

.

For commonly used processor sub-models, the GNU CC always guarantees such consistency by default. How to implement the results consistently depend on the processor sub-model.

The M88100 processor does not rearrange the memory reference, so the access results are always consistent. If you are using the `-m88100 'option, the GNU CC does not produce special instructions consistent with the results.

The memory reference order of the M88110 processor does not always comply with the order of the instruction request. In particular, a read instruction may be executed before the previous storage instruction. Under the multiprocessor environment, the charter access to disturb the variable memory access Consistency. Therefore, when using `-m88000 'or` -m88110' option, the GNU CC produces special instructions when appropriate, forcing the execution order correct. These additional code used to ensure consistency may affect the performance of the program. If you Confirm that you can safely abandon this guarantee, you can use the `-Mno-serialize-volatile 'option.

If you use a `-m88100 'option, you need to match the results of the M88110 processor, you should add the` -mserialize-volatile' option.

-msvr4

-msvr3

turn on

(`-msvr4 ')

Or close

(`-msvr3 ')

with

System v

Fourth edition

(SVR4)

Related compiler extensions

.

The effect is as follows

:

*

Which compilation syntax is output?

(

you can use

`-mversion-03.00 '

Options separately

).

*

`-msvr4 '

Make

C

Preparation instrument identification

`#pragma weak '

instruction

*

`-msvr4 '

Make

GCC

Output extra declaration instructions

(Declarative Directive),

Use

SVR4.

In addition to SVR4 configuration, `-msvr3 'is the default option for all M88K configurations.

-mtrap-large-shift

-MHandle-large-shift

Contains some instructions

,

Used to detect greater than

31

Bit shift

Bit-shift;

According to the corresponding option

,

Delicate such a displacement

(Trap)

Or perform proper processing code

.

by default

, GCC

Do not do special treatment for large dishes

.

-Muse-div-instructionion

Very early

88K

Model

(DIV)

Division directive

,

So by default

GCC

Avoid producing this directive

.

And this option tells

GCC

This instruction is safe

.

-MVersion-03.00

in

DG / UX

There are two styles in configuration

SVR4.

This option is modified

-msvr4,

select

Hybrid-coff

or

Real-Elf

style

.

Other configurations ignore this option

.

-Mwarn-Passed-Structs

If a function is used as a parameter or result

, GCC

warning

.

along with

C

Development of language

,

People have changed the convention for the conveying structure

,

It often leads to the problem of transplantation

.

by default

, GCC

Will not warn

.

The following option is used for IBM RS6000:

-MFP-in-TOC

-MNO-FP-IN-TOC

Control whether floating point constant is placed in the content table

(TOC)

in

,

Content table storage all global variables and function addresses

.

by default

, GCC

Put the floating point constant here

;

in case

TOC

overflow

, `-Mno-fp-in-Toc '

Option can reduce

TOC

the size of

,

This will avoid overflow

.

The following `-m 'option is used for IBM RT PC:

-min-line-mul

Embedded code for integer multiplication

.

This is the default option

.

-mcall-lib-mul

For integer multiplication

Lmul $$.

-mfull-fp-blocks

Generate full-size floating point data blocks

,

include

IBM

Suggested minimum number of activity space

Scratch space.

This is the default option

.

-MMINIMUM-FP-Blocks

Do not include additional activity spaces in floating point data blocks

.

This creates a smaller but slightly slow executable program.

,

Because the activity space must be dynamically allocated

.

-MFP-Arg-in-fpregs

Incompatible

IBM

Call the agreed call sequence

,

Transfer floating point parameters via floating point registers.

note

,

If this option is specified

, Varargs.h

with

stdargs.h

Floating point unit will not be supported

.

-MFP-Arg-in-GREGS

Process floating point parameters using normal call

.

This is the default option

.

-MHC-STRUCT-RETURN

Return the structure greater than one word via memory

,

Not through the register

.

Compatibility

MetaWare Highc (HC)

translater

.

use

`-fpcc-struct-return '

Options can be compatible

Portable C

translater

(PCC).

-Mnohc-struct-return

if it is possible

,

Returns some of the structures greater than one word through the register

.

This is the default option

.

If intended

IBM

Provided compiler

,

please use

`-fpcc-struct-return '

or

`-mhc-struct-return '

Option

.

The following `-m 'option is used for the MIPS family:

-mcpu = CPU-TYPE

When the command is generated

,

Suppose the default machine type is

CPU-TYPE.

By default

CPU-Type

Yes

DEFAULT, GCC

The command will be selected for the longest cycle time

,

This will make the code in all

MIPS

Processor runs with reasonable speed

CPU-Type

Other options are

R2000, R3000, R4000,

with

R6000.

Although a certain one

CPU-Type

Rear

, GCC

Arrange the selected chip to arrange the corresponding work

,

But if not specified

?? -Mips2

or

-MIPS3

Option

,

The compiler does not output any inconsistent

MIPS ISA (Instruction Set Architecture)

First class code

.

-MIPS2

Output

MIPS ISA

Secondary command

(

Possible extension

,

Square root instruction

). -mcpu = r4000

or

-mcpu = r6000

Option must be

-MIPS2

Join

.

-MIPS3

Output

MIPS ISA

Three-level directive

(64

Bit command

). -mcpu = r4000

Option must be

-MIPS2

Join

(

Translation

:

Suspected

-MIPS3)

-mint64

-mlong64

-mlonglong128

These options are currently inadvertent

.

-MMIPS-AS

Generate

MIPS

Compiler code

,

use simultaneously

MIPS-TFILE

Add ordinary debugging information

.

For most platforms, this is the default option

,

apart from

OSF / 1

Reference platform

,

It uses

OSF / ROSE

Target format

.

If you open any one

-ggdb, -gstabs,

or

-gstabs

Option switch

MIPS-TFILE

Proceed

Stab

Encapsulate

MIPS ECOFF

inside

.

-mgas

Generate

Gnu

Compiler code

.

in

OSF / 1

This is the default option on the reference platform

,

It uses

OSF / ROSE

Target format

.

-mrnames

-Mno-RNames

-mrnames

Switch option tells the output code to use

MIPS

Software Name Description Register

,

Instead of hardware name

(

that is

,

use

A0

instead

$ 4). GNU

Assembler does not support

-mrnames

Option

,

and

MIPS

Assembler runs

MIPS C

Preprocessor processing source file

. -MNO-RNAMES

Is the default option

.

-MgPopt

-Mno-gpopt

-MgPopt

The switch option requires writing all the data declarations in front of the text section.

,

Make various

MIPS

Compilers for short types or static data items

SHORT GLOBAL or Static Data Items

Output single-word memory access rather than double word memory access

.

When the compilation optimization is opened,

This is the default function

.

-mstats

-Mno-Stats

Dedicated to the embedded function each time

(non-inline function)

Rear

, -mstats

Switch options make the compiler to the standard error file to output a line about the statistics about the program

(

Save the number of registers

,

Stack size

,

and many more

).

-mmemcpy

-Mno-memcpy

-mmemcpy

Switch options make all block mobile operations call appropriate

String

function

(Memcpy)

or

bcopy,

Instead of generating embedded code

.

-MMIPS-TFILE

-Mno-MIPS-TFILE

when

MIPS

Assembler generation

MIPS-TFILE

file

(

Used to help debug

)

Rear

, -Mno-MIPS-TFILE

Switch Options Block Compiler

MIPS-TFILE

Later processing

(PostProcess)

Target file

.

Do not run

MIPS-TFILE

There is no local variable for the debugger

.

In addition

STAGE2

with

STAGE3

The target file will pass the temporary file name to the assembler

,

Embed in the target file

,

This means that the target file is not compared

.

-MSoft-float

Output contains floating point library calls

.

caveat:

Required library is not

GNU CC

a part of

.

Generally speaking, using this model

C

Compiler

,

But you can't use it directly for cross-compilation

,

You must arrange yourself

,

Provide cross-compilation applicable library functions

.

-mhard-float

Output contains floating point instructions

.

If the compiler is not changed

,

This is the default option

.

-mfp64

The compiler considers the status word

FR

Position

(ON),

That is to say

32 64-bit

Floating point register

,

Instead of

32 32-bit

Floating point register

.

At the same time, you must open

-mcpu = r4000

with

-MIPS3

switch

.

-mfp32

Be considered

32 32-bit

Floating point register

.

This is the default option

.

-mabicalls

-Mno-Abicalls

Output

(

No output

) .abicalls, .cpload,

with

.cprestore

Pseudo-instruction

,

some

System v.4

Version for location-independent code

.

-mhalf-pic

-Mno-Half-Pic

-mhalf-pic

Switch options require the external reference pointer to the data segment

,

And load memory

,

Do not put it in a text section

.

This option does not work

.

-G Num

Put less than or equal

Num

The global or static data of bytes is placed in a small data segment or

BSS

segment

,

Not ordinary data segments or

BSS

segment

.

Such a assembler can output a global pointer

(GP

or

$ 28),

Single word memory access instruction instead of document double word instruction

.

by default

,

use

MIPS

Assembler

Num

Yes

8,

and

Gnu

Assembler is

0.

In addition

-Gnum

Options are also passed to the assembler and connector

.

All modules must be the same

-Gnum

Character compilation

.

-NOCPP

Compilation user assembly file

(

Have

`.s'

suffix

)

Time

,

tell

MIPS

Assembler does not run a pre-processor

.

The following `-m 'option is used for Intel 80386 computers: -m486

-MNO-486

Controls whether to generate

486

Optimized code

.

-MSoft-float

Output contains floating point library calls

.

caveat:

Required library is not

GNU CC

a part of

.

Generally speaking, using this model

C

Compiler

,

But you can't use it directly for cross-compilation

,

You must arrange yourself

,

Provide cross-compilation applicable library functions

.

Place the floating point return value on the 80387 register stack machine, even if the `-msoft-float 'option is set, some floating point opcode may be issued.

-MNO-FP-RET-IN-387

No need to

FPU

The register returns a function value.

Usually the function call agreement places the return value of Float and Double in the FPU register, even if there is no FPU. This kind of practice is that the operating system should simulate the FPU.

The `-Mno-fp-Ret-IN-387 'option returns the floating point value through a normal CPU register.

The following `-m 'option is used for HPPA computers:

-MPA-RISC-1-0

generate

PA 1.0

Processor's Target Code

.

-MPA-RISC-1-1

generate

PA 1.1

Processor's Target Code

.

-Mkernel

Generate a target code suitable for kernel

.

Special avoidance

Add

instruction

,

It has a parameter is

DP

register

;

use

Addil

instead

Add

instruction

.

This can be avoided

HP-UX

A seriousness of the connector

Bug.

-MShared-Libs

Generate

HP-UX

Shared library target code

.

This option has not implemented all functions

,

Correct

PA

Target default is closed

.

Using this option can cause the compiler to generate an error target code

.

-Mno-shared-libs

Do not generate connections

HP-UX

Shared library target code

.

this is

PA

Default option for the target

.

-mlong-calls

The resulting target code allows the function call in the same source file

,

The distance between the calling point and the modulated function can exceed

256K

Far away

.

No need to open this switch option

,

Unless the connector gives out

`` Branch out of range errors``

Such error

.

-mdisable-fpregs

Prevent any case use floating point register

.

Compiled kernel requires this option

,

The execution environment of the kernel switch floating point register is very slow

.

If this switch option is opened, it tries to float operation.

,

Compiling will fail

.

-mdisable-indexing

Prevent compiler from using index address mode

Indexing Address Mode.

In this way

Mach

Compile

MIG

Generated code

,

Can avoid some very embarrassed issues

.

-mtrailing-color

Definition in tag

(label definition)

Add a colon at the end

(

Use

ELF

Assembler

).

The following `-m 'option is used for Intel 80960 computers:

-MCPU-TYPE

The default machine type is

CPU-Type,

Enable the compiler to generate the corresponding instruction

,

Address mode and memory

.

default

CPU-Type

Yes

KB;

Other options

KA, MC, CA, CF, SA,

with

SB.

-MNUMERICS

-MSoft-float

-MNUMERICS

The switch option indicates that the processor does not support floating point instructions.

. -MSoft-float

Switch options point out that it should not be considered to support floating point operations

.

-mleaf-procedures

-Mno-Leaf-Procedures

attempt

(

Or prevent

)

Change the leaf process

(Leaf Procedure),

Make it

BAL

Instructions and

Call

Instruction call

.

For direct function calls

,

in case

BAL

The instruction can be replaced by the assembler or connector

,

This can produce more effective code

,

But in other cases produce less low-efficiency code

,

For example, by function pointer call function

,

Or use connector that does not support this optimization

.

-mtail-call

-Mno-Tail-Call

carried out

(

Do not execute

)

More attempts

(

In addition to compilers

),

Optimize the end of the branch

(Tail-Recursive)

transfer

.

You may not need this

,

Because the detection is invalid, there is no completion

.

The default switch is

-MNO-Tail-Call.

-MCOMPLEX-ADDR

-MNO-Complex-Addr

think

(

Or not

)

In the current

I960

Device

,

It is worth using the composite address mode

Complex Addressing Mode.

Composite address mode may not be worth it to use

series

,

But must be used in

C

series

.

Except

CB

with

CC

processor

,

Other processors

-MCOMPLEX-ADDR

Is the default option

.

-mcode-align

-Mno-code-align

Align the target code

8

Byte boundary

(

Or not

),

This will be read like this.

.

Currently only

C

Series Open by default

.

-Mic-compat

-Mic2.0-compat

-Mic3.0-Compat

compatible

IC960 V2.0

or

V3.0.

-Masm-compat

-Mintel-ASM

compatible

IC960

Assembler

.

-mstrict-align

-MNO-STRICT-ALIGN

Not allowed

(

Or permission

)

Boundary is not aligned

.

-mold-align

Structure alignment

Structure-alignment)

compatible

Intel

of

GCC

Release

1.3 (

based on

GCC 1.37).

This option is a bit problem

,

because

#pragma align 1

Always do the same setting

,

And can't turn off

.

The following `-m 'option is used for Dec Alpha devices:

-MNO-Soft-Float

-MSoft-float

use

(

Not use

)

Hardware floating point instructions for floating point operations

.

turn on

-MSoft-float

Time

,

Use

`libgcc1.c '

The function of the function performs floating point operations

.

Unless they are replaced by routines they are simulated floating point operations

,

Or similar

,

They are compiled into call simulation routines

,

These routines will issue floating point operations

.

If you don't have floating point

Alpha

Compiler

,

You must ensure that this library is established

,

In order to not adjust the simulation routine

.

Note that Alpha without floating point operation also requires a floating point register.

-mfp-reg

-Mno-fp-regs

Generate

(

Not use

)

Target code for floating point register group

. -MNO-fp-regs

Contain

-MSoft-float

Switch option

.

If you do not use floating point registers

,

Floating point operands are transmitted through integer register like integers

,

Putting the floating point operation

$ 0

Instead of

$ F0.

This is a non-standard call

,

So any function with floating point parameters or return values

,

If

-Mno-fp-regs

Switch compiled target code call

,

It must also compile this option

.

Typical usage of this option is to create kernels, the kernel does not use any floating point registers, so there is no need to save and restore these registers.

The following additional options appear in the SYSTEM V fourth edition, used to compatible with other compilers in these systems:

-G

In the SVR4 system, GCC is compatible with the `-g 'option (and then passed to the connector). But we recommend using the` -symbolic' or `-shared 'option, not the connection option on the GCC command line.

-Qy

Verify the version of the tool for the compiler, output to .IDENT assembly instruction.

-QN

Stop the .IDENT command (default option).

-Yp, DIRS

For `-l 'specified library files, you only search DIRS. You can use the colon from DIRS to separate all directory items.

-YM, DIR

Look for M4 preprocessors in the DIR directory. The assembler uses this option.

Code Generation Option (Code Generation Option)

The following options and platforms are independent of controlling the interface convention generated by the target code.

Most options begin with `-f '. These options have two formats that determine and negate;` -ffoo''s negative format is `-fno-foo '. The following description will only list one of these formats --- Non-default Format. You can speculate another format by adding or removing `NO- '.

-fnonnull-objects

Assume that the object obtained by reference (Reference) is not NULL (C ).

In general, GNU C is conservatively assumed by reference to the object obtained by reference. For example, the compiler will check A is not NULL: OBJ & A = g (); A.f (2);

Check that similar references require additional code, but for many programs are unnecessary. If your program does not require this check, you can ignore it with the `-fnonnull-objects' option.

-FPCC-STRUCT-RETURN

When the function returns the Struct and UNION values, the same parameters as the local compiler are adopted. For smaller structures, this agreed efficiency is low, and many machines cannot be reached; its advantage is to allow GCC to compile target code The target code compiled with the PCC is called each other.

-freg-struct-return

It is possible to return Struct and UNION function values ​​through registers. For smaller structures, it is more efficient than -fpcc-struct-return.

If neither -fpcc-struct-return, no -freg-struct-return, GNU CC defaults to use the standard convention for the target machine. If there is no standard convention, the GNU CC uses -fpcc-struct-return.

-fshort-enums

Give the enum type only the number of bytes of the value domain range it declared. That is to say, the ENUM type is equal to the minimum integer type of size.

-fshort-double

The size of the Double type and float.

-fshared-data

Data and non-const variables that require compilation results are shared data, not private data. This difference is only meaningful above some operating systems, where shared data is shared between several processes of the same program, while private data is in each There is a one in the process.

-fno-common

Even if the global variables that are not initialized are also assigned to the target file BSS segment, instead of setting them as a common block (COMMON block). Such results are, if the same variable is declared in two different compilation results (no use EXTERN), incorrectly generated when connecting them. The only case where this option is useful is that you want to confirm that the program can run on other systems, while other systems always do.

-fno-ident

Ignore the `#ident 'instruction.

-fno-gnu-linker

Do not output global initialization components (such as C constructs sub-recipes) to output the format used for GNU connector (on the GNU connector is a standard method). When you plan to use non-GNU connector, you can use this option Non-GNU connector also requires a Collect2 program to ensure that the system connector is placed in a constructor and a CONSTRUctor. (The Collect2 program is included in the GNU CC.) For systems that must be used, compiler drivers The program GCC is automatically configured to do this.

-finhibit-size-directive

Do not output .Size assembly instructions, or other similar instructions, when a function is divided into two, two parts can cause problems in the middle distance. When compiling `crtstuff.c ', this option is required; Should not be used.

-FVERBOSE-ASM

Place additional annotation information when you output assembly code. This option is only used to read the assembly output (it may debug the compiler yourself).

-fvolatile

Make the compiler that all memory accessible by the pointer is viable memory.

-fvolatile-global

Make the compiler that all external and global variables are variable memory.

-fpic

If this target machine is supported, the compiler generates a location-independent target code. Suitable for shared library.

-fpic

If this target machine is supported, the compiler is independent of the output location. Suitable for dynamic linking, even if the branch requires a wide range of shifts.

-FFIXED-REG

Take a register named register to see the fixed register; the generated target code should not reference it (except as a stack pointer, frame pointer, or other fixed role).

The REG must be the name of the register. The register name depends on the machine and describes the register_names macro definition of the macro file with the machine.

This option has no negation format because it lists the three selection.

-fcall-useed-reg

Treat the registers named REG Press the Assignable Registers and cannot be used between function calls. You can use or use it as a variable, the survival period does not exceed a function. This function does not need to save and restore the REG register. If you can execute modules In, the register for this option is used as a fixed role will generate catastrophic results, such as stack pointers or frame pointers.

This option has no negation format because it lists the three selection.

-fcall-saved-reg

Treat the register named REG by function. You can use or use or be used as a variable, which can even survive between functions. This compiled function saves and resumes the REG register in use.

If in the executable module, the register described in this option is used as a fixed role will produce catastrophic results, such as stack pointers or frame pointers.

Another disaster is used to return a function value with the register description of this option.

This option has no negation format because it lists the three selection.

Pragmas

GNU C supports two `#pragma 'instructions to make the same header files two uses: Object class interface definition, object class complete content definition.

#pragma interface

(C only) In the header file of the target class, use this instruction to save most of the size of the target file that adopts the class. Generally, some information (backup of the embedded member function, debug information, " Realizing the internal table of virtual functions, etc.) The local subscribers must be saved in each target file that contains class definitions. Use this PRAGMA instruction to avoid such replication. These auxiliary information will not be generated (unless the entered primary file uses the `#pragma impLementation 'instruction). Instead, the target file will contain references that can be parsed when connected.

#pragma importation

#pragma importation "Objects.h"

(Only C ) If a complete output is required from the header file (and globally visible), you should use this pragma in the primary input file. The `#pragma interface 'instruction should be used in turn. In the Implementation file, it will be generated The backup, debugging information of all embedded member functions, the internal table of virtual functions, and the like.

If `#pragma importation 'does not with parameters, it refers to containing files with the same basic name as the source file; for example,` #pragma importation' is equal to `#pragma importation allClass.h '. If This string parameter should be used by an Implementation file to introduce code from multiple header files.

It is impossible to divide the contents of a header file to multiple implementation files.

File (file)

File.c C Source File

File.h C header file (preprocessing)

File.i C source file after pre-dealing

FILE.C C Source File

FILE.CC C Source File

File.cxx C source file

File.m Objective-C source file

File.s assembly language file

File.o target file

A.out connection output file

TMPDIR / CC * Temporary file

LIBDIR / CPP Preprocessor

LibDIR / CC1 C compiler

LibDIR / CC1PLUS C compiler

LibDIR / Collect Some Connector Front End (Front End) Programs

Libdir / libgcc.a gcc subroutine library

/LIB/CRT [01N].O startup routine (START-UP)

Additional startup routine /lib/libc.a standard C library, see INTRO (3)

/ usr / include #include file standard directory

Standard GCC directory for libdir / include #include file

LibDIR / G - Additional g directory for the include #include file

Libdir

Usually / usr / local / lib / machine / version. Tmpdir comes from environment variables Tmpdir (if present, default is / usr / TMP, otherwise / tmp).

See also (See Also)

CPP (1), AS (1), LD (1), GDB (1), ADB (1), DBX (1), SDB (1). Info `GCC ',` CPP', `as',` LD ', and `GDB' entry. Using and porting gnu cc (for version 2.0), Richard M. Stallman; The C Preprocessor, Richard M. Stallman; Debugging with GDB: The GNU Source-Level Debugger, Richard M. Stallman .

Bugs

Check out the GCC manual for the guidance of reporting error.

Copying

Copyright 1991, 1992, 1993 Free Software Foundation, Inc.

Permission is granted to make and distribute Verbatim Copies of this Manual Province The Copyright Notice and this Permission Notice Are Preserved on All Copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English.

Authors

Please check the Gun CC Manual for GNU CC.

[Chinese version of the maintenance person]

Xu Ming

[Chinese version latest update]

2003/05/13 first edition

"China Linux Forum MAN Handbook Translation Plan"

http://cmpp.linuxforum.net/

Index

Name

Overview (Synopsis) Warning

Description (Description)

Options (options)

Overall Option

Language Options

Preprocessor Option

Assembler Option

Connector Option (Linker Option)

Directory Option (Directory Option)

WARNING OPTION

Debugging option (DEBUGGING OPTION)

Optimization option (Optimization Option)

Target Options (Target Option)

Machine Related Option (Machine Dependent Option)

Code Generation Option (Code Generation Option)

Pragmas

File (file)

See also (See Also)

Bugs

Copying

Authors

[Chinese version of the maintenance person]

[Chinese version latest update]

"China Linux Forum MAN Handbook Translation Plan"

THIS Document Was Created by man2html, using the manual pages.time: GMT, January 14, 2004

转载请注明原文地址:https://www.9cbs.com/read-78942.html

New Post(0)