GCC:由GNU之父Stallman所开发的linux下的编译器,全称为GNU Compiler Collection, 目前可以编译的语言包括:C, C++, Objective-C, Fortran, Java以及Ada。
GCC 4.3.0是一个大的版本,包含了大量GCC 4.2.x以及之前的GCC版本所不具备的功能。
long double
as having the same format as double
. In earlier versions of GCC, they used the 68881 long double
format instead.m68k-uclinux
target now uses the same calling conventions as m68k-linux-gnu
. You can select the original calling conventions by configuring for m68k-uclinuxoldabi
instead. Note that m68k-uclinuxoldabi
also retains the original 80-bit long double
on ColdFire targets.-fforce-mem
option has been removed because it has had no effect in the last few GCC releases.-msvr3-shlib
option has been removed since it is no longer used.Fastcall
for i386 has been changed not to pass aggregate arguments in registers, following Microsoft compilers.arm-semi-aof
and armel-semi-aof
, which are no longer recognized. We removed these targets without a deprecation period because we discovered that they have been unusable since GCC 4.0.0.c4x-*
and tic4x-*
) has been removed. This support had been deprecated since GCC 4.0.0.Support for a number of older systems and recently unmaintained or untested target ports of GCC has been declared obsolete in GCC 4.3. Unless there is activity to revive them, the next release of GCC will have their sources permanently removed.
All GCC ports for the following processor architectures have been declared obsolete:
crx-*
)mt-*
)The following aliases for processor architectures have been declared obsolete. Users should use the indicated generic target names instead, with compile-time options such as -mcpu
or configure-time options such as --with-cpu
to control the configuration more precisely.
strongarm*-*-*
, ep9312*-*-*
, xscale*-*-*
(use arm*-*-*
instead).parisc*-*-*
(use hppa*-*-*
instead).m680[012]0-*-*
(use m68k-*-*
instead).All GCC ports for the following operating systems have been declared obsolete:
*-*-beos*
)*-*-kaos*
)*-*-linux*aout*
)*-*-linux*libc1*
)*-*-solaris2.[0-6]
, *-*-solaris2.[0-6].*
)*-*-sysv*
)*-*-windiss*
)Also, those for some individual systems on particular architectures have been obsoleted:
alpha*-*-unicosmk*
)cris-*-aout
)hppa1.1-*-bsd*
)hppa1.1-*-osf*
)hppa1.1-*-pro*
)i[34567]86-sequent-ptx4*
, i[34567]86-sequent-sysv4*
)i[34567]86-*-sco3.2v5*
)i[34567]86-*-uwin*
) (support for UWIN as a host was previously removed in 2001, leaving only the support for UWIN as a target now being deprecated)powerpc-*-chorusos*
)vax-*-bsd*
, vax-*-sysv*
, vax-*-ultrix*
)-Wconversion
option has been modified. Its purpose now is to warn for implicit conversions that may alter a value. This new behavior is available for both C and C++. Warnings about conversions between signed and unsigned integers can be disabled by using -Wno-sign-conversion
. In C++, they are disabled by default unless -Wsign-conversion
is explicitly requested. The old behavior of -Wconversion
, that is, warn for prototypes causing a type conversion that is different from what would happen to the same argument in the absence of a prototype, has been moved to a new option -Wtraditional-conversion
, which is only available for C.-m386, -m486, -mpentium
and -mpentiumpro
tuning options have been removed because they were deprecated for more than 3 GCC major releases. Use -mtune=i386
, -mtune=i486
, -mtune=pentium
or -mtune=pentiumpro
as a replacement.-funsafe-math-optimizations
option now automatically turns on -fno-trapping-math
in addition to -fno-signed-zeros
, as it enables reassociation and thus may introduce or remove traps.acos
, acosh
, asin
, asinh
, atan2
, atan
, atanh
, cbrt
, cos
, cosh
, drem
, erf
, erfc
, exp10
, exp2
, exp
, expm1
, fdim
, fma
, fmax
, fmin
, gamma_r
, hypot
, j0
, j1
, jn
, lgamma_r
, log10
, log1p
, log2
, log
, pow10
, pow
, remainder
, remquo
, sin
, sincos
, sinh
, tan
, tanh
, tgamma
, y0
, y1
and yn
. The float
and long double
variants of these functions (e.g. sinf
and sinl
) are also handled. The sqrt
and cabs
functions with constant arguments were already optimized in prior GCC releases. Now they also use MPFR. -frecord-gcc-switches
has been added to GCC, although it is only enabled for some targets. The switch causes the command line that was used to invoke the compiler to be recorded into the object file that is being created. The exact format of this recording is target and binary file format dependent, but it usually takes the form of a note section containing ASCII text. The switch is related to the -fverbose-asm
switch, but that one only records the information in the assembler output file as comments, so the information never reaches the object file. --param large-stack-frame
and --param large-stack-frame-growth
can be used to limit stack frame size growth caused by inlining.memcpy
, memset
and bzero
functions operate on is discovered and for cases of commonly used small sizes, specialized inline code is generated.__builtin_expect
no longer requires its argument to be a compile time constant.-finstrument-functions-exclude-function-list
and -finstrument-functions-exclude-file-list
. They provide more control over which functions are annotated by the -finstrument-functions
option.int
may not be implicitly converted to a vector type with element type unsigned int
.) This restriction, which is in line with specifications for SIMD architectures such as AltiVec, may be relaxed using the flag -flax-vector-conversions
. This flag is intended only as a compatibility measure and should not be used for new code. -Warray-bounds
has been added and is now enabled by default for -Wall
. It produces warnings for array subscripts that can be determined at compile time to be always out of bounds. -Wno-array-bounds
will disable the warning. constructor
and destructor
function attributes now accept optional priority arguments which control the order in which the constructor and destructor functions are run. -Wtype-limits
, -Wold-style-declaration
, -Wmissing-parameter-type
, -Wempty-body
, -Wclobbered
and -Wignored-qualifiers
have been added for finer control of the diverse warnings enabled by -Wextra
. alloc_size
has been added to mark up malloc
style functions. For constant sized allocations this can be used to find out the size of the returned pointer using the __builtin_object_size()
function for buffer overflow checking and similar. This supplements the already built-in malloc
and calloc
constant size handling. 0b
or 0B
, followed by a sequence of 0 and 1 digits. __COUNTER__
has been added. It expands to sequential integral values starting from 0. In conjunction with the ##
operator, this provides a convenient means to generate unique identifiers. -fdirectives-only
has been added. It enables a special preprocessing mode which improves the performance of applications like distcc and ccache. -Wc++0x-compat
has been added and is now enabled by default for -Wall
. It produces warnings for constructs whose meaning differs between ISO C++ 1998 and C++0x.-Wparentheses
option now works for C++ as it does for C. It warns if parentheses are omitted when operators with confusing precedence are nested. It also warns about ambiguous else statements. Since -Wparentheses
is enabled by -Wall
, this may cause additional warnings with existing C++ code which uses -Wall
. These new warnings may be disabled by using -Wall -Wno-parentheses
.-Wmissing-declarations
now works for C++ as it does for C.-fvisibility-ms-compat
flag was added, to make it easier to port larger projects using shared libraries from Microsoft's Visual Studio to ELF and Mach-O systems.__attribute__((aligned(T)));
works for C++ types.what
implementations give more elaborate exception strings for bad_cast
, bad_typeid
, bad_exception
, and bad_alloc
. std::accumulate
, std::for_each
, std::transform
, or std::sort
, to give but four examples. These algorithms can be substituted for the normal (sequential) libstdc++ algorithms on a piecemeal basis, or all existing algorithms can be transformed via the -D_GLIBCXX_PARALLEL
macro.#include <ext/hash_set>Can be transformed (in order of preference) to:
__gnu_cxx::hash_set<int> s;
#include <tr1/unordered_set>or
std::tr1::unordered_set<int> s;
#include <backward/hash_set>Similar transformations apply to
__gnu_cxx::hash_set<int> s;
__gnu_cxx::hash_map
, __gnu_cxx::hash_multimap
, __gnu_cxx::hash_set
, __gnu_cxx::hash_multiset
. -fexternal-blas
option has been added, which generates calls to BLAS routines for intrinsic matrix operations such as matmul
rather than using the built-in algorithms.-fbacktrace
or environment variable GFORTRAN_ERROR_BACKTRACE
; on glibc systems only) or a core dump (-fdump-core
, GFORTRAN_ERROR_DUMPCORE
) when a run-time error occured.__GFORTRAN__
when it runs the C preprocessor (CPP).-finit-local-zero
, -finit-real
, -finit-integer
, -finit-character
, and -finit-logical
options have been added, which can be used to initialize local variables.GAMMA
and LGAMMA
have been added, which calculate the Gamma function and its logarithm. Use EXTERNAL gamma
if you want to use your own gamma function.-fbackslash
GNU Fortran interprets backslashes as C-style escape characters.ISO_ENV_FORTRAN
jv-scan
tool has been removed. This tool never really worked properly. There is no replacement. gcjh
has been rewritten. Some of its more obscure options no longer work, but are still recognized in an attempt at compatibility. gjavah
is a new program with similar functionality but different command-line options. grmic
and grmiregistry
have been rewritten. grmid
has been added. gjar
replaces the old fastjar
. gjarsigner
(used for signing jars), gkeytool
(used for key management), gorbd
(for CORBA), gserialver
(computes serialization UIDs), and gtnameserv
(also for CORBA) are now installed. gc-analyze
tool. They may be generated on out-of-memory conditions or on demand and are controlled by the new run time class gnu.gcj.util.GCInfo
. java.util.TimeZone
can now read files from /usr/share/zoneinfo
to provide correct, updated, timezone information. This means that packagers no longer have to update libgcj when a time zone change is published. -mtune=core2
and -march=core2
.-mtune=geode
and -march=geode
.memcpy
) and block set (memset
) was rewritten. GCC can now pick the best algorithm (loop, unrolled loop, instruction with rep
prefix or a library call) based on the size of the block being copied and the CPU being optimized for. A new option -minline-stringops-dynamically
has been added. With this option string operations of unknown size are expanded such that small blocks are copied by in-line code, while for large blocks a library call is used. This results in faster code than -minline-all-stringops
when the library implementation is capable of using cache hierarchy hints. The heuristic choosing the particular algorithm can be overwritten via -mstringop-strategy
. Newly also memset
of values different from 0 is inlined.cld
instruction before string operations. Both i386 and x86-64 ABI documents mandate the direction flag to be clear at the entry of a function. It is now invalid to set the flag in asm
statement without reseting it afterward.-mssse3
.-msse4.1
.-msse4.2
.-msse4
.-mpc32
, -mpc64
and -mpc80
have been added to allow explicit control of x87 floating point precision.__float128
(TFmode) IEEE quad type and corresponding TCmode IEEE complex quad type is available via the soft-fp library on x86_64
targets. This includes basic arithmetic operations (addition, subtraction, negation, multiplication and division) on __float128
real and TCmode complex values, the full set of IEEE comparisons between __float128
values, conversions to and from float
, double
and long double
floating point types, as well as conversions to and from signed
or unsigned
integer, signed
or unsigned long
integer and signed
or unsigned
quad (TImode) integer types. Additionally, all operations generate the full set of IEEE exceptions and support the full set of IEEE rounding modes.-mveclibabi=acml
is specified and you link to an ACML ABI compatible library.cris-*-elf
target now includes support for CRIS v32, including libraries, through the -march=v32
option.crisv32-*-elf
target defaults to generate code for CRIS v32.crisv32-*-linux*
target defaults to generate code for CRIS v32.cris-*-aout
target has been obsoleted.lz
and swapwbr
instructions to implement the __builtin_clz
, __builtin_ctz
and __builtin_ffs
family of functions.__builtin_bswap32
is now implemented using the swapwb
instruction, when available.-mcpu
option.m68k-uclinux
targets have improved support for C++ constructors and destructors, and for shared libraries.mov3q
instruction.__builtin_clz
is now implemented using the ff1
ColdFire instruction, when available.-m68010
option. 68010 code now uses clr
rather than move
to zero volatile memory.symbol(index.size*scale)
addresses for indexed array accesses. Earlier compilers would always load the symbol into a base register first.--with-cpu
.--with-arch
configuration option has been added. This option allows you to restrict a target to ColdFire or non-ColdFire processors.__mcfv*__
macro is now defined for all ColdFire targets. (Earlier versions of GCC only defined __mcfv4e__
.)__mcf_cpu_*
, __mcf_family_*
and __mcffpu__
macros have been added.__mc68010
and __mc68010__
when generating 68010 code.-march
, -mcpu
, -mtune
and -mhard-float
have been added. These options apply to both m68k and ColdFire targets.-mno-short
, -mno-bitfield
and -mno-rtd
are now accepted as negative versions of -mshort
, etc.-fforce-addr
has been removed. It is now ignored by the compiler.m68k-uclinux
targets now try to avoid situations that lead to the load-time error: BINFMT_FLAT: reloc outside program
.libffi
and libjava
now support all three GNU/Linux ABIs: o32, n32 and n64. Every GNU/Linux configuration now builds these libraries by default.-mno-shared
code unless overridden by -fpic
, -fPIC
, -fpie
or -fPIE
.mipsisa32*-linux-gnu
configurations now generate hard-float code by default, just like other mipsisa32*
and mips*-linux-gnu
configurations. You can build a soft-float version of any mips*-linux-gnu
configuration by passing --with-float=soft
to configure
.mips-wrs-vxworks
now supports run-time processes (RTPs).-march
and -mtune
options no longer accept 24k
as a processor name. Please use 24kc
, 24kf2_1
or 24kf1_1
instead.-march
and -mtune
options now accept 24kf2_1
, 24kef2_1
and 34kf2_1
as synonyms for 24kf
, 24kef
and 34kf
respectively. The options also accept 24kf1_1
, 24kef1_1
and 34kf1_1
as synonyms for 24kx
, 24kex
and 34kx
.GCC now supports the following configurations:
mipsisa32r2*-linux-gnu*
, which generates MIPS32 revision 2 code by default. Earlier releases also recognized this configuration, but they treated it in the same way as mipsisa32*-linux-gnu*
. Note that you can customize any mips*-linux-gnu*
configuration to a particular ISA or processor by passing an appropriate --with-arch
option to configure
.mipsisa*-sde-elf*
, which provides compatibility with MIPS Technologies' SDE toolchains. The configuration uses the SDE libraries by default, but you can use it like other newlib-based ELF configurations by passing --with-newlib
to configure
. It is the only configuration besides mips64vr*-elf*
to build MIPS16 as well as non-MIPS16 libraries.mipsisa*-elfoabi*
, which is similar to the general mipsisa*-elf*
configuration, but uses the o32 and o64 ABIs instead of the 32-bit and 64-bit forms of the EABI.-msmartmips
option.-mdspr2
option. A new preprocessor macro called __mips_dsp_rev
indicates the revision of the ASE in use.-march
and -mtune
options.sync
instructions to implement atomic built-in functions such as __sync_fetch_and_add
. The memory reference must be 4 bytes wide for 32-bit targets and either 4 or 8 bytes wide for 64-bit targets.clz
and dclz
instructions to implement the __builtin_ctz
and __builtin_ffs
families of functions.__builtin___clear_cache
function for flushing the instruction cache. GCC expands this function inline on MIPS32 revision 2 targets, otherwise it calls the function specified by -mcache-flush-func
.mips16
and nomips16
, for specifying which mode a function should use.-minterlink-mips16
makes non-MIPS16 code link-compatible with MIPS16 code.-mhard-float
support should now work fairly reliably.save
and restore
instructions.-fsection-anchors
now works in MIPS16 mode. MIPS16 code compiled with -G0
-fsection-anchors
is often smaller than code compiled with -G8
. However, please note that you must usually compile all objects in your application with the same -G
option; see the documentation of -G
for details.-mcode-readable
specifies which instructions are allowed to load from the code segment. -mcode-readable=yes
is the default and says that any instruction may load from the code segment. The other alternatives are -mcode-readable=pcrel
, which says that only PC-relative MIPS16 instructions may load from the code segment, and -mcode-readable=no
, which says that no instruction may do so. Please see the documentation for more details, including example uses.There are three new options for controlling small data:
-mno-extern-sdata
, which disables small-data accesses for externally-defined variables. Code compiled with -Gn
-mno-extern-sdata
will be link-compatible with any -G
setting between -G0
and -Gn
inclusive.-mno-local-sdata
, which disables the use of small-data sections for data that is not externally visible. This option can be a useful way of reducing small-data usage in less performance-critical parts of an application.-mno-gpopt
, which disables the use of the $gp
register while still honoring the -G
limit when placing externally-visible data. This option implies -mno-extern-sdata
and -mno-local-sdata
and it can be useful in situations where $gp
does not necessarily hold the expected value.-mbranch-cost
for tweaking the perceived cost of branches..gnu_attribute
directive, it will use that directive to record certain properties of the output code. .gnu_attribute
is new to GAS 2.18.near
and far
, for overriding the command-line setting of -mlong-calls
on a function-by-function basis.-mfp64
, which previously required a 64-bit target, now works with MIPS32 revision 2 targets as well. The mipsisa*-elfoabi*
and mipsisa*-sde-elf*
configurations provide suitable library support.-mdmx
and -mmt
options and passes them down to the assembler. It does nothing else with the options at present.powerpc-*-linux*paired*
target configuration. It is enabled by an associated -mpaired
option and can be accessed using new built-in functions.-march=z9-ec
option, the compiler will generate code making use of instructions provided by the decimal floating point facility and the floating point conversion facility (pfpo). Besides the instructions used to implement decimal floating point operations these facilities also contain instructions to move between general purpose and floating point registers and to modify and copy the sign-bit of floating point values.-march=z9-ec
option is used the new -mhard-dfp/-mno-hard-dfp
options can be used to specify whether the decimal floating point hardware instructions will be used or not. If none of them is given the hardware support is enabled by default.-mstack-guard
option can now be omitted when using stack checking via -mstack-size
in order to let GCC choose a sensible stack guard value according to the frame size of each function.a + b + carry < b
.S32C1I
instructions.__builtin_ctz
and __builtin_clz
functions.The compiler's --help
command-line option has been extended so that it now takes an optional set of arguments. These arguments restrict the information displayed to specific classes of command-line options, and possibly only a subset of those options. It is also now possible to replace the descriptive text associated with each displayed option with an indication of its current value, or for binary options, whether it has been enabled or disabled.
Here are some examples. The following will display all the options controlling warning messages:
--help=warnings
Whereas this will display all the undocumented, target specific options:
--help=target,undocumented
This sequence of commands will display the binary optimizations that are enabled by -O3
:
gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
diff /tmp/O2-opts /tmp/O3-opts | grep enabled
--with-pkgversion
and --with-bugurl
have been added. These allow distributors of GCC to include a distributor-specific string in manuals and --version
output and to specify the URL for reporting bugs in their versions of GCC.Please send FSF & GNU inquiries & questions to [email protected]. There are also other ways to contact the FSF.
These pages are maintained by the GCC team.
For questions related to the use of GCC, please consult these web pages and the GCC manuals. If that fails, the [email protected] mailing list might help.Copyright (C) Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
Last modified 2008-02-28 |