Hexagon GNU C/C++ Compiler a GNU Manual
Total Page:16
File Type:pdf, Size:1020Kb
Hexagon GNU C/C++ Compiler A GNU Manual 80-N2040-2 Rev. D September 1, 2011 Submit technical questions to: https://www.codeaurora.org QUALCOMM is a registered trademark of QUALCOMM Incorporated in the United States and may be registered in other countries. Hexagon is a trademark of QUALCOMM Incorporated in the United States and other countries. Other product and brand names may be trademarks or registered trademarks of their respective owners. Authors Richard Stallman, GCC Developer Community, QUALCOMM Incorporated, Qualcomm Innovation Center, Inc. Portions copyrighted by Free Software Foundation, Inc., QUALCOMM Incorporated, Qualcomm Innovation Center, Inc., and Code Aurora Forum. Published by Code Aurora Forum 48377 Fremont Blvd., Ste. 117 Fremont, CA 94538 U.S.A. Chapter 1 and 7 are licensed under the following terms: Copyright © 2006-2010 QUALCOMM Incorporated. Copyright © 2010 Qualcomm Innovation Center, Inc. Copyright © 2010-2011 Code Aurora Forum. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being “GNU General Public License” and “Funding Free Software”, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”. (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. Copies published by the Free Software Foundation raise funds for GNU development. Chapters 2-6 and 8 are a Qualcomm-modified version of the document entitled Using the GNU Compiler Collection and are licensed under the following terms: Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Copyright © 2006-2010 QUALCOMM Incorporated. Copyright © 2010 Qualcomm Innovation Center, Inc. Copyright © 2010-2011 Code Aurora Forum. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being “GNU General Public License” and “Funding Free Software”, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”. (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. Copies published by the Free Software Foundation raise funds for GNU development. 80-N2040-2 Rev. D 2 CODE AURORA FORUM Contents 1 Introduction......................................................................................... 12 1.1 Overview ....................................................................................................................12 1.2 Features....................................................................................................................... 12 1.3 Languages...................................................................................................................13 1.4 Runtime systems......................................................................................................... 13 1.5 Processor versions ...................................................................................................... 13 1.6 Processor-specific features ......................................................................................... 13 1.7 Language standards .................................................................................................... 14 1.8 Using the document.................................................................................................... 16 1.9 Notation ...................................................................................................................... 17 1.10 Feedback...................................................................................................................17 2 Getting Started.................................................................................... 18 2.1 Overview ....................................................................................................................18 2.2 Create source file........................................................................................................ 18 2.3 Compile program........................................................................................................ 18 2.4 Execute program......................................................................................................... 19 3 Using The Compilers.......................................................................... 20 3.1 Overview ....................................................................................................................20 3.2 Using the compilers.................................................................................................... 21 3.3 Starting the compilers................................................................................................. 23 3.4 Compiler options ........................................................................................................ 24 3.4.1 Display .............................................................................................................. 30 3.4.2 Compilation....................................................................................................... 32 3.4.3 C dialect ............................................................................................................ 34 3.4.4 C++ dialect........................................................................................................ 38 3.4.5 Diagnostic message formats ............................................................................. 46 3.4.6 Warning messages............................................................................................. 47 3.4.7 Advisory warning messages ............................................................................. 56 3.4.8 Debugging......................................................................................................... 63 3.4.9 Optimization ..................................................................................................... 68 3.4.10 Specific optimizations..................................................................................... 70 3.4.11 Math optimizations ......................................................................................... 88 3.4.12 Preprocessor.................................................................................................... 91 80-N2040-2 Rev. D 3 CODE AURORA FORUM Hexagon GNU C/C++ Compiler Contents 3.4.13 Assembly....................................................................................................... 101 3.4.14 Linking.......................................................................................................... 102 3.4.15 Directory search............................................................................................ 106 3.4.16 Processor version .......................................................................................... 108 3.4.17 Target machine.............................................................................................. 108 3.4.18 Code generation ............................................................................................ 109 3.5 Screen messages ....................................................................................................... 117 3.6 Warning and error messages..................................................................................... 117 3.7 List files.................................................................................................................... 118 3.8 Spec files ..................................................................................................................118 3.9 GCC environment variables ..................................................................................... 126 3.10 Using precompiled headers .................................................................................... 129 3.11 Using code optimization......................................................................................... 130 3.11.1 Basic optimization......................................................................................... 131 3.11.2 Global data optimization............................................................................... 131 3.11.3 Function inlining........................................................................................... 133 3.11.4 Dead function elimination............................................................................. 133 3.11.5 Unused data removal..................................................................................... 134 3.11.6 Fast math....................................................................................................... 134 3.12 Processor-specific features ..................................................................................... 135 4 Language Implementation ............................................................... 136 4.1 Overview