Use syntax: GCC [option | filename] ... G [option | filename] ... where option is the option when using GCC (will be detailed later), and FileName is a file description to the GCC: this C Compiler with C has been integrated with related programs that produce new programs. Generating a new procedure requires four phases: pretreatment, compile, assembly, link, and these two compilers can process the input files different stages. Although the extension of the original program can be used to distinguish the language used by the original program code, the different compiler, its preset handler is different: the GCC presets via the pre-processed (extended names .i) The C language is handled in C's linking. G defaults to the C language via the pre-processed (extension .i) and processes the program linkage. The extension of the original program code indicates the language used by the written program used, and the corresponding processing method: .c C original program; pretreatment, compile, assembly .C C original program; pre-processing, compilation, assembly .cc C original program ; Pretreatment, compilation, assembly .cxx C original program; pretreatment, compile, compilation .m Objective-C original program; pre-processing, compilation, assembly .I has passed the pre-processed C original program; compilation, assembly .ii already C original program for pre-processing; compile, assembly. S-combined language original program; assembly. S-combined language original program; pre-processing, assembly .h pre-processing file (header file); (not often in the instruction line) The extension file is processed by the link, usually: .o Object File .a Archive File unless the compilation process has an error, "link" must be the final stage of generating a new program. However, you can also stop one of the four phases in four phases of options such as -c, -s or -e. In the coupling phase, all the .o files, libraries, and other files that cannot be identified from the original code (including the Object File that are not extended, as well as the extension .a), including .a .a archive file) Both will be handed over (in the instruction line as the parameter passing to the connection program). Options: Different options must be separated:, for example, `-dr 'This option is not the same as` -d -r'. Most of the larger `-f 'and` -w' options have two forms: -fname and -fno-name (or -wname and -wno-name). The following is only listed in the non-preset form. The following is a summary of all options. Classified in the form. The meaning of the option will also make another section.
General (rough, commonly used) option -c -s -e -o file -pipe -v -x language programming language options -ansi -fall-virtual -fcond-mismatch -fdollars-in-IdentifierS -fenum-int-equiviV -fexternal-templates -fno-asm -fno-builtin -fno-strict-prototype -fsigned-bitfields -fsigned-char -fthis-is-variable -funsigned-bitfields -funsigned-char -fwritable-strings -traditional -traditional-cpp -trigraphs compile time warning option -FSYNTAX-Only -pedantic -pedantic-errotes -w -w -wall -waggregate-return -wcast-align -wcast-qual -wchar-subscript -wcomment -wconversion -wenum-clamp -wconversion -wenum-clamp -werror- wformat -Wid-clash-len -Wimplicit -Winline -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 debug option -a -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 options -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-Pointer -Frerun-CSE- After-loop -fschedule-insns -fschedule-insns2 -fstrength-reduuce -ft-jumps -funroll-all-loops -funroll-loops -o-ods pre-processing option -aAsSERTION -C -DD -DM -DN-DMACRO [= DEFN] -E -H -IDIRAFTER DIR -IPREFIX FILE-IWITHPREFIX DIR -M -MD -MM -MMD -NOSTDINC -P -UMACRO -UNDEF assembler option -wa, Option link program - LLIBRARY - Nostartfiles -nostdlib -static -shared -symbolic -xlinker option -wl, option -u symbol
Directory Options - BPREFIX -IDIR -I- -LDIR TARGET OPTIONS -B MACHINE -V Version and Machine (Platform) Related options M680x0 options -m68000 -m68020 -m68020-40 -M68030 -M68040 -M68881 -Mbitfield -MC68000 -MC68020 mfpa -mnobitfield -mrtd -mshort -msoft-float VAX Options -mg -mgnu -munix SPARC Options -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 -m88000 -m88100 -m88110 -mbig- PIC-MCHECK-ZERO-DIVISION -MHANDLE-LARGE-SHIFT -MIDENTIFY-REVISION-MNO-CHECK-ZERO-DIVISITION -MNO-OCS-DEBUG-INFO-MNO-OCS-FRAME-POSITION -MNO-OPTIMIZE-ARG-AREA - Mno-Serialize-Volatile-Mno-underscores -mocs-debug-info -mocs-frame-position -moptimize-arg-area -m SERIALIZE-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 OPTIONS -MCALL-LIB-MUL-MFP-Arg-in-fpregs -mfp-arg-in-gregs -mfull-fp-block-MHC-STRUCT-RETURN -MIN-LINE-MUL-MMINIMUM-FP-Blocks - Mnohc-struct-return mips options -mcpu =
CPU TYPE -MIPS2 -MIPS3 -MINT64 -MLONG64-MLONGLONG128-MMIPS-AS -MGAS -MRNAMES-MNO-RNAMES -MGPOPT -MNO-GPOPT-MNO-MNO-Stats -Mmemcpy-Mno-MNO-Mno-MIPS-TFILE-MMIPS -TFILE-MSOFT-FLOAT-MNO-FLOAT-MABICALLS -MNO-ABICALLS-MNO-HALF-PIC -G NUM-NOCPP I386 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-MCPU-TYPE-MNUMERICS-MSOFT-FLOAT-MLEAF-PROCEDURES-MNO-LEAF-PROCEDURES -MTAIL-CALL -MNO-TAIL-CALL-MNODED - MNO-COMPLEX-ADDR-MCODE-Align-Mno-code- Align -Mic-Compat -Mic 2.0-Compat -Mic3.0-Compat -Masm-Compat -mintel-Asm-MStrict-align-mno-strict-align-mold-align-mald-align Dec alpha Options -mfp -regs-malo-fp-regs-malo-soft-float-msoft-float system v options -g -Qy-qn -yp, paths -ym, dir code generation option option Options -fcall-saved-reg-finhibit-size-directive -fnonnull-ibjects -fno-common -fno-identification fno-gnu-linker -fpcc-struct-return -fpic -fPIC -freg-struct-returno -fshared-data -fshort-enums -fshort-double -fvolatile -fvolatile-global -fverbose-asm pRAGMAS Two `#pragma 'directives are supported for GNU C , to permit using the same header file for two purposes: as a definition of interfaces to a given object class, and as the full definition of the contents of that object class #pragma interface (C .
only.) Use this directive in header files that define object classes, to save space in most of the object files that use those classes. Nor- mally, local copies of (backup copies certain information of inline member functions, debugging information, and the internal tables that implement vir- tual functions) must be kept in each object file that includes class definitions. You can use this pragma to avoid such duplication. When a header file containing `#pragma interface 'is included in a compilation, this auxiliary information will not be generated (unless the main input source file it- self uses `#pragma implementation '). Instead, the object files will contain references to be resolved at link time. #pragma implementation #pragma implementation" objects.h " (C only.) Use this pragma in a main input file, when you want! Output from include Header Files T o be generated (and made globally visible). The included header file, in turn, should use `#pragma interface '. Backup copies of inline mem- ber functions, debugging information, and the in- ternal tables used to implement virtual functions are all generated in implementation files If you use `#pragma implementation 'with no argu- ment, it applies to an include file with the same basename as your source file; for example, in` allclass.cc'., `#pragma implementation ' ITself Is Equivalent to `#pragma importation" allclass.h "'
. Use the string argument if you want a single implementation file to include code from multiple header files. There is no way to split up the contents of a single header file into multiple implementation files. File Description file.c C source file file .h C Header (Preprocessor) File file file File 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 object file a.out link edited output TMPDIR / cc * temporary files LIBDIR / cpp preprocessor LIBDIR / cc1 compiler for C LIBDIR / cc1plus compiler for C LIBDIR / collect linker front end needed on some machines LIBDIR / libgcc.a GCC Subroutine library /lib/crt[01n].o start-up routine libdir / ccrt0 Additional start-up routine for c /lib/libc.a Standard C Library, see Man Page Intro (3) / USR / Include standard directory for #include files LIBDIR / include standard gcc directory for #include files LIBDIR / g -. include additional g directory for #include LIBDIR is usually / usr / local / lib / machine / version TMPDIR comes from the environment variable TMPDIR (default / USR / TMP if Available, ELSE / TMP). GCC Best Compilation Parameters Abstract This article focuses on which parameters specify to GCC in different hardware environments can be optimally achieved. This article is separated from a programming manual named Gentoo Linux, I hope to help everyone compiler.
-------------------------------------------------- ----------------------------- 1, 1.2 (GCC 2.9.x) i386 (Intel), Do you really want TO INSTALL GENTOO ON THAT? Chost = "I386-PC-Linux-GNU" cflags = "- march = i386 -o3 -pipe -fomit-frame-pointer" cxxflags = "- MARCH = I386 -O3 -Pipe -Fomit-Frame -pointer "I486 (Intel), Do you real Want to install geentoo on what chost =" i486-pc-linux-gnu "cflags =" - march = i486 -o3 -pipe -fomit-frame-pointer "cxxflags =" -March = I486 -O3 -PIPE -FOMIT-FRAME-POINTER "Pentium, Pentium MMX , Celeron (Intel) Chost =" I586-PC-Linux-GNU "cflags =" - march = pentium -o3 -pipe - Fomit-frame-pointer "cxxflags =" - march = pentium -o3 -pipe -fomit-frame-pointer "Pentium Pro / II / III / 4, Celeron (Coppermine), Celeron (Intel) Chost =" i686 -pc-linux-gnu "cflags =" - MARCH = I686 -O3 -Pipe -Fomit-frame-pointer "cxxflags =" - march = i686 -o3 -pipe -fomit-frame-point "Eden C3 / EZRA (VIA) ChOST = "I586-PC-Linux-GNU" cflags = "- march = i586 -o3 -pipe -fomit-frame-pointer" cxxflags = "- march = i586 -o 3 -pipe -fomit-frame-pointer "Quote: I Did the Original Gentoo Install Using 1.2, with GCC 2.95 USING -MARCH = I586. I686 Won't work. K6 or beyond (AMD) Chost =" i586-PC-Linux -gnu "cflags =" - march = k6-^ "cxxflags =" - march = k6 -o3 -pipe -fomit-frame-power "(A duron will report" Athlon "in ITS / Proc / cpuinfo) Athlon (AMD) Chost = "I686-PC-Linux-GNU" cflags = "- march = k6-^ Pipe -Fomit-frame-Pointer" cxflags =
"-March = k6 -o3 -pipe -fomit-frame-pointer" for the stocking, I don't know the any flag thing enhance performances ..., do you? PowerPC chost = "powerpc-unknown-linux-gnu" Cflags = "- O3 -PIPE -FOMIT-FRAME-POINTER" cxxflags = "- O3 -PIPE -FOMIT-FRAME-POINTER" sparc chost = "sparc chost =" sparc chost = "sparc-unknown-linux-gnu" cflags = "- O3 -PIPE -FOMIT- Frame-Pointer "cxxflags =" - O3 -PIPE -FOMIT-FRAME-POINTER "SPARC 64 Chost =" sparc 64 chost = "sparc 64 chost =" cflags = "- O3 -PIPE -FOMIT-FRAME-POINTER" cxxflags = "- O3 -pipe -fomit-frame-point "II, 1.4 (GCC 3.x): I386 (Intel), Do you really want to install geentoo on what? chovet =" i386-pc-linux-gnu "cflags =" -march = i386 -o3 -pipe -fomit-frame-pointer "cxxflags =" - march = i386 -o3 -pipe -fomit-frame-pointer "i486 (intel), do you real want to install geentoo on what? chost = "I486-PC-Linux-GNU" cflags = "- march = i486 -o3 -pipe -fomit-frame-pointer" cxxflags = "- march = i486 -o3 -pipe -fomit-frame-pointer" Pentium 1 (Intel) Chost = "i586-pc-linux-gnu" cflags = "- march = pentium -o3 -pipe -fomit-frame-pointer" CX XFlags = "- march = pentium -o3 -pipe -fomit-frame-pointer" pentium mmx (intel) chost = "i586-pc-linux-gnu" cflags = "- march = pentium-mmx -o3 -pipe -fomit- Frame-Pointer "cxflags =" - march = pentium-mmx -o3 -pipe -fomit-frame-pointer "Pentium Pro (Intel) chost =" i686-pc-linux-gnu "cflags =" - march = pentiumpro -o3 - Pipe -Fomit-frame-Pointer "cxxflags =" - march = pentiumpro -o3 -pipe -fomit-frame-pointer "
Pentium II (Intel) Chost = "I686-PC-Linux-GNU" cflags = "- march = pentium2 -o3 -pipe -fomit-frame-pointer" cxxflags = "- march = pentium2 -o3 -pipe -fomit-frame- Pointer "Celeron (Intel), Aka Celeron1 (Intel) Chost =" I686-PC-Linux-GNU "cflags =" - march = pentium2 -o3 -pipe -fomit-frame-pointer "cxxflags =" - march = pentium2 -o3 -pipe -fomit-frame-point "Pentium III (Intel) Chost =" I686-PC-Linux-GNU "cflags =" - march = pentium3 -o3 -pipe -fomit-frame-pointer "cxxflags =" - march = pentium3 -O3 -PIPE -FOMIT-FRAME-POINTER "Celeron (Coppermine) Aka Celeron2 (Intel) Chost =" I686-PC-Linux-GNU "cflags =" - march = pentium3 -o3 -pipe -fomit-frame-point "CXXFLAGS = "- march = pentium3 -o3 -pipe -fomit-frame-pointer" Celeron (intel) chost = "i686-pc-linux-gnu" cflags = "- march = pentium4 -o3 -pipe -ft- Frame-Pointer "cxxflags =" - march = pentium4 -o3 -pipe -fomit-frame-pointer "Pentium 4 (Intel) chost =" i686-pc-linux-gnu "cflags =" - MARCH = Pentium4 -o3 -PIPE - Fomit-frame-pointer "cxxflags =" - march = pentium4 -o3 -pipe -fomit-fram E-POINTER "Eden C3 / EZRA (VIA) Chost =" I586-PC-Linux-GNU "cflags =" - MARCH = I586 -M3DNOW -O3 -PIPE -FOMIT-FRAME-POINTER "CXXFLAGS =" - MARCH = I586 - M3DNOW -O3 -PIPE -FOMIT-FRAME-POINTER "Quote: The Ezra Doesn't Have Any Special Instructions That You Could Optimize For, Just Consider IS A K6-3 ... Basical A P2 with 3Dnow K6 (AMD) Chost = "I586-PC-Linux-GNU" cflags = "- march = k6 -o3 -pipe -fomit-frame-pointer"
Cxxflags = "- march = k6 -o3 -pipe -fomit-frame-pointer" K6-2 (AMD) chost = "i586-pc-linux-gnu" cflags = "- march = k6-2 -o3 -pipe -fomit -frame-pointer "cxxflags =" - march = k6-2 -o3 -pipe -fomit-frame-pointer "K6-3 (AMD) chost =" i586-pc-linux-gnu "cflags =" - march = k6- 3 -O3 -PIPE -FOMIT-FRAME-POINTER "cxxflags =" - march = k6-3 -o3 -pipe -fomit-frame-pointer "Athlon (AMD) chost =" i686-pc-linux-gnu "cflags =" -March = Athlon -O3 -Pipe -Fomit-frame-Pointer "cxxflags =" - march = Athlon -O3 -Pipe -Fomit-frame-Pointer "Athlon-Tbird, Aka K7 (AMD) Chost =" i686-PC-Linux -gnu "cflags =" - march = Athlon-tbird -o3 -pipe -fomit-frame-pointer "cxxflags =" - march = Athlon-tbird -o3 -pipe -fomit-frame-pointer "Athlon-Tbird XP (AMD) Chost = "i686-pc-linux-gnu" cflags = "- march = Athlon-xp -o3 -pipe -fomit-frame-pointer" cxxflags = "- march = atthlon-xp -o3 -pipe -fomit-frame-pointer "Athlon 4 (AMD) Chost =" I686-PC-Linux-GNU "cflags =" - march = Athlon-4 -O3 -Pipe -Fomit-frame-Pointer "cxxflags =" - march = atthlon-4 -o3 -pipe -FOTIMIT-FRAME-POINTER "Athlon XP (AMD) Chos T = "i686-pc-linux-gnu" cflags = "- march = Athlon-xp -o3 -pipe -fomit-frame-pointer" cxxflags = "- march = Athlon-xp -o3 -pipe -fomit-frame-Pointer "Athlon MP (AMD) Chost =" I686-PC-Linux-GNU "cflags =" - march = Athlon-mp -O3 -Pipe -Fomit-frame-Pointer "cxxflags =" - march = attlon-mp -O3 -pipe -FOMIT-FRAME-POINTER "603 (PowerPC) Chost =" PowerPC-Unknown-Linux-GNU "cflags ="
-O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR "CXXFLAGS =" - O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR "603E (PowerPC) Chost =" PowerPC-Unknown-Linux-gnu "cflags = "-O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR" CXXFLAGS = "- O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR" 604 (PowerPC) Chost = "PowerPC-Unknown-Linux-GNU" cflags = "- O3 -PIPE -FOMIT-FRAME-POINTER-FSigned-CHAR" CXXFLAGS = "- O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR" 604E (PowerPC) Chost = "PowerPC-Unknown-Linux-GNU" Cflags = "- O3 -PIPE -FOMIT-FRAME-POINTER -FSigned-char" cxxflags = "- o3 -pipe -fomit-frame-pointer -fsigned-char" 750 AKA AS G3 (PowerPC) Chost = "PowerPC-Unknown- Linux-gnu "cflags =" - mcpu = 750 -o3 -pipe -fomit-frame-pointer -fsigned-char "cxxflags =" - mcpu = 750-3 -pipe -fomit-frame-point -fsigned-char "NOTE: Do Not Use -March = 7400, AKA G4 (PowerPC) Chost = "PowerPC-Unknown-Linux-GNU" cflags = "- MCPU = 7400 -O3 -PIPE-FOMIT-FRAME-POINTER -FSIGNED-CHAR -MALTIVEC" CXXFLAGS = "-MCPU = 7400 -O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR -MALTIVEC" Note: Do Not Use -March = 7450, Aka G4 Second Generation (PowerPC) Chost = "PowerPC-Unknown-Linux-GNU" cflags = "- MCPU = 7450 -O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR - Maltivec "cxxflags =" - mcpu = 7450 -o3 -pipe -fomit-frame-pointer -fsigned-char -maltivec "NOT: do not use -march = PowerPC (if you do't know which one) chost =" PowerPC- Unknown-linux-gnu "cflags =" - O3 -PIPE -FOMIT-FRAME-POINTER -FSIGNED-CHAR "cxxflags ="