Using The GNU Compiler Collection

Transcription

Using the GNU Compiler CollectionFor gcc version 5.1.0(GCC)Richard M. Stallman and the GCC Developer Community

Published by:GNU Pressa division of theFree Software Foundation51 Franklin Street, Fifth FloorBoston, MA 02110-1301 USAWebsite: http://www.gnupress.orgGeneral: press@gnu.orgOrders: sales@gnu.orgTel 617-542-5942Fax 617-542-2652Last printed October 2003 for GCC 3.3.1.Printed copies are available for 45 each.Copyright c 1988-2015 Free Software Foundation, Inc.Permission is granted to copy, distribute and/or modify this document under the terms ofthe GNU Free Documentation License, Version 1.3 or any later version published by theFree Software Foundation; with the Invariant Sections being “Funding Free Software”, theFront-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (seebelow). A copy of the license is included in the section entitled “GNU Free DocumentationLicense”.(a) The FSF’s Front-Cover Text is:A GNU Manual(b) The FSF’s Back-Cover Text is:You have freedom to copy and modify this GNU Manual, like GNU software. Copiespublished by the Free Software Foundation raise funds for GNU development.

iShort ContentsIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Programming Languages Supported by GCC . . . . . . . . . . . . . . . 32 Language Standards Supported by GCC . . . . . . . . . . . . . . . . . . 53 GCC Command Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 C Implementation-Defined Behavior . . . . . . . . . . . . . . . . . . . . 3595 C Implementation-Defined Behavior . . . . . . . . . . . . . . . . . 3676 Extensions to the C Language Family . . . . . . . . . . . . . . . . . . . 3697 Extensions to the C Language . . . . . . . . . . . . . . . . . . . . . . 6478 GNU Objective-C Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 6619 Binary Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67710 gcov—a Test Coverage Program . . . . . . . . . . . . . . . . . . . . . . . 68111 gcov-tool—an Offline Gcda Profile Processing Tool . . . . . . . 69112 Known Causes of Trouble with GCC . . . . . . . . . . . . . . . . . . . . 69513 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71114 How To Get Help with GCC . . . . . . . . . . . . . . . . . . . . . . . . . . 71315 Contributing to GCC Development . . . . . . . . . . . . . . . . . . . . . 715Funding Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717The GNU Project and GNU/Linux . . . . . . . . . . . . . . . . . . . . . . . . . 719GNU General Public License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . 733Contributors to GCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741Option Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759Keyword Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781

iiiTable of ContentsIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Programming Languages Supported by GCC. 32Language Standards Supported by GCC . . . . . 52.12.22.32.42.53C Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .C Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Objective-C and Objective-C Languages . . . . . . . . . . . . . . . . . . . .Go Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .References for Other Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56788GCC Command Options . . . . . . . . . . . . . . . . . . . . . . . 93.1 Option Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Options Controlling the Kind of Output . . . . . . . . . . . . . . . . . . . . . . . 263.3 Compiling C Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313.4 Options Controlling C Dialect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323.5 Options Controlling C Dialect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383.6 Options Controlling Objective-C and Objective-C Dialects . . 493.7 Options to Control Diagnostic Messages Formatting . . . . . . . . . . . 533.8 Options to Request or Suppress Warnings . . . . . . . . . . . . . . . . . . . . . 553.9 Options for Debugging Your Program or GCC . . . . . . . . . . . . . . . . . 833.10 Options That Control Optimization . . . . . . . . . . . . . . . . . . . . . . . . . 1103.11 Options Controlling the Preprocessor. . . . . . . . . . . . . . . . . . . . . . . . 1683.12 Passing Options to the Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . 1793.13 Options for Linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1793.14 Options for Directory Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1833.15 Specifying Subprocesses and the Switches to Pass to Them . . 1863.16 Specifying Target Machine and Compiler Version . . . . . . . . . . . . 1933.17 Hardware Models and Configurations . . . . . . . . . . . . . . . . . . . . . . . 1933.17.1 AArch64 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1933.17.1.1 ‘-march’ and ‘-mcpu’ Feature Modifiers . . . . . . . . . . . . 1953.17.2 Adapteva Epiphany Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 1953.17.3 ARC Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1973.17.4 ARM Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2033.17.5 AVR Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2093.17.5.1 EIND and Devices with More Than 128 Ki Bytes ofFlash. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2133.17.5.2 Handling of the RAMPD, RAMPX, RAMPY and RAMPZ SpecialFunction Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2153.17.5.3 AVR Built-in Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2153.17.6 Blackfin Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

ivUsing the GNU Compiler Collection (GCC)3.17.7 C6X Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2203.17.8 CRIS Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2213.17.9 CR16 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2233.17.10 Darwin Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2233.17.11 DEC Alpha Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2273.17.12 FR30 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2313.17.13 FRV Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2313.17.14 GNU/Linux Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2353.17.15 H8/300 Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2363.17.16 HPPA Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2363.17.17 IA-64 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2393.17.18 LM32 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2433.17.19 M32C Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2433.17.20 M32R/D Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2443.17.21 M680x0 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2453.17.22 MCore Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2503.17.23 MeP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2513.17.24 MicroBlaze Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2533.17.25 MIPS Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2543.17.26 MMIX Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2683.17.27 MN10300 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2693.17.28 Moxie Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2703.17.29 MSP430 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2703.17.30 NDS32 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2713.17.31 Nios II Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2723.17.32 Nvidia PTX Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2763.17.33 PDP-11 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2773.17.34 picoChip Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2783.17.35 PowerPC Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2783.17.36 RL78 Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2783.17.37 IBM RS/6000 and PowerPC Options . . . . . . . . . . . . . . . . . . 2793.17.38 RX Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2953.17.39 S/390 and zSeries Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2973.17.40 Score Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3003.17.41 SH Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3013.17.42 Solaris 2 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3093.17.43 SPARC Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3103.17.44 SPU Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3153.17.45 Options for System V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3163.17.46 TILE-Gx Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3173.17.47 TILEPro Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3173.17.48 V850 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3173.17.49 VAX Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3203.17.50 Visium Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3203.17.51 VMS Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3213.17.52 VxWorks Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3223.17.53 x86 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3223.17.54 x86 Windows Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

v3.17.55 Xstormy16 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3.17.56 Xtensa Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3.17.57 zSeries Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3.18 Options for Code Generation Conventions . . . . . . . . . . . . . . . . . . .3.19 Environment Variables Affecting GCC . . . . . . . . . . . . . . . . . . . . . .3.20 Using Precompiled Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4C Implementation-Defined Behavior . . . . . . . 4.154.165Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Floating Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Arrays and Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Structures, Unions, Enumerations, and Bit-Fields . . . . . . . . . . . . .Qualifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Preprocessing Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Locale-Specific Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3593593593603613613623633633643653653

3.3 Compiling C Programs ::::: 31 3.4 Options Controlling C Dialect::::: 32 3.5 Options Controlling C Dialect ::::: 38 3.6 Options Controlling Objective-C and Objective-C Dialects:: 49 3.7 Options to Cited by: 378Publish Year: 2010Author: Richard M. Stallman