Using the GNU Compiler Collection (GCC)

Total Page:16

File Type:pdf, Size:1020Kb

Using the GNU Compiler Collection (GCC) Using the GNU Compiler Collection (GCC) Using the GNU Compiler Collection by Richard M. Stallman and the GCC Developer Community Last updated 23 May 2004 for GCC 3.4.6 For GCC Version 3.4.6 Published by: GNU Press Website: www.gnupress.org a division of the General: [email protected] Free Software Foundation Orders: [email protected] 59 Temple Place Suite 330 Tel 617-542-5942 Boston, MA 02111-1307 USA Fax 617-542-2652 Last printed October 2003 for GCC 3.3.1. Printed copies are available for $45 each. Copyright c 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. 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. i Short Contents Introduction ...................................... 1 1 Programming Languages Supported by GCC ............ 3 2 Language Standards Supported by GCC ............... 5 3 GCC Command Options .......................... 9 4 C Implementation-defined behavior ................. 175 5 Extensions to the C Language Family ................ 179 6 Extensions to the C++ Language ................... 301 7 GNU Objective-C runtime features.................. 313 8 Binary Compatibility ........................... 319 9 gcov|a Test Coverage Program ................... 323 10 Known Causes of Trouble with GCC ................ 331 11 Reporting Bugs ............................... 351 12 How To Get Help with GCC ...................... 353 13 Contributing to GCC Development ................. 355 Funding Free Software ............................. 357 The GNU Project and GNU/Linux..................... 359 GNU GENERAL PUBLIC LICENSE ................... 361 GNU Free Documentation License ..................... 367 Contributors to GCC .............................. 375 Option Index.................................... 387 Keyword Index .................................. 399 ii Using the GNU Compiler Collection (GCC) iii Table of Contents Introduction .................................. 1 1 Programming Languages Supported by GCC ......................................... 3 2 Language Standards Supported by GCC .... 5 3 GCC Command Options ................... 9 3.1 Option Summary .......................................... 9 3.2 Options Controlling the Kind of Output .................... 18 3.3 Compiling C++ Programs ................................. 21 3.4 Options Controlling C Dialect ............................. 21 3.5 Options Controlling C++ Dialect ........................... 25 3.6 Options Controlling Objective-C Dialect.................... 31 3.7 Options to Control Diagnostic Messages Formatting ......... 34 3.8 Options to Request or Suppress Warnings .................. 35 3.9 Options for Debugging Your Program or GCC .............. 49 3.10 Options That Control Optimization ....................... 56 3.11 Options Controlling the Preprocessor ..................... 77 3.12 Passing Options to the Assembler......................... 86 3.13 Options for Linking...................................... 86 3.14 Options for Directory Search ............................. 89 3.15 Specifying subprocesses and the switches to pass to them ... 90 3.16 Specifying Target Machine and Compiler Version .......... 97 3.17 Hardware Models and Configurations ..................... 97 3.17.1 M680x0 Options .................................. 98 3.17.2 M68hc1x Options ................................ 100 3.17.3 VAX Options .................................... 101 3.17.4 SPARC Options.................................. 101 3.17.5 ARM Options.................................... 106 3.17.6 MN10300 Options ................................ 110 3.17.7 M32R/D Options ................................ 110 3.17.8 IBM RS/6000 and PowerPC Options .............. 112 3.17.9 Darwin Options .................................. 121 3.17.10 MIPS Options .................................. 123 3.17.11 Intel 386 and AMD x86-64 Options ............... 127 3.17.12 HPPA Options.................................. 134 3.17.13 Intel 960 Options ............................... 137 3.17.14 DEC Alpha Options............................. 138 3.17.15 DEC Alpha/VMS Options ....................... 142 3.17.16 H8/300 Options................................. 142 3.17.17 SH Options ..................................... 143 iv Using the GNU Compiler Collection (GCC) 3.17.18 Options for System V ........................... 144 3.17.19 TMS320C3x/C4x Options ....................... 144 3.17.20 V850 Options ................................... 146 3.17.21 ARC Options ................................... 148 3.17.22 NS32K Options ................................. 148 3.17.23 AVR Options ................................... 150 3.17.24 MCore Options ................................. 151 3.17.25 IA-64 Options .................................. 151 3.17.26 D30V Options .................................. 153 3.17.27 S/390 and zSeries Options ....................... 154 3.17.28 CRIS Options................................... 155 3.17.29 MMIX Options ................................. 157 3.17.30 PDP-11 Options ................................ 158 3.17.31 Xstormy16 Options ............................. 159 3.17.32 FRV Options ................................... 159 3.17.33 Xtensa Options ................................. 162 3.18 Options for Code Generation Conventions ................ 163 3.19 Environment Variables Affecting GCC ................... 168 3.20 Using Precompiled Headers ............................. 171 3.21 Running Protoize....................................... 172 4 C Implementation-defined behavior ....... 175 4.1 Translation ............................................. 175 4.2 Environment ............................................ 175 4.3 Identifiers ............................................... 175 4.4 Characters .............................................. 175 4.5 Integers................................................. 176 4.6 Floating point........................................... 176 4.7 Arrays and pointers ..................................... 177 4.8 Hints ................................................... 177 4.9 Structures, unions, enumerations, and bit-fields ............ 177 4.10 Qualifiers .............................................. 178 4.11 Preprocessing directives ................................. 178 4.12 Library functions ....................................... 178 4.13 Architecture ........................................... 178 4.14 Locale-specific behavior ................................. 178 5 Extensions to the C Language Family ..... 179 5.1 Statements and Declarations in Expressions ............... 179 5.2 Locally Declared Labels .................................. 180 5.3 Labels as Values......................................... 181 5.4 Nested Functions ........................................ 182 5.5 Constructing Function Calls .............................. 184 5.6 Referring to a Type with typeof ......................... 184 5.7 Generalized Lvalues ..................................... 186 5.8 Conditionals with Omitted Operands ..................... 187 5.9 Double-Word Integers.................................... 187 5.10 Complex Numbers...................................... 187 v 5.11 Hex Floats ............................................. 188 5.12 Arrays of Length Zero .................................. 188 5.13 Structures With No Members ........................... 189 5.14 Arrays of Variable Length ............................... 190 5.15 Macros with a Variable Number of Arguments. ........... 191 5.16 Slightly Looser Rules for Escaped Newlines ............... 191 5.17 Non-Lvalue Arrays May Have Subscripts ................. 192 5.18 Arithmetic on void- and Function-Pointers ............... 192 5.19 Non-Constant Initializers................................ 192 5.20 Compound Literals ..................................... 192 5.21 Designated Initializers .................................. 193 5.22 Case Ranges ........................................... 194 5.23 Cast to a Union Type................................... 195 5.24 Mixed Declarations and Code ........................... 195 5.25 Declaring Attributes of Functions ........................ 195 5.26 Attribute Syntax ....................................... 206 5.27 Prototypes and Old-Style Function Definitions ............ 209 5.28 C++ Style Comments ................................... 209 5.29 Dollar Signs in Identifier Names ......................... 210 5.30 The Character ESC in Constants ........................ 210 h i 5.31 Inquiring on Alignment of Types or Variables............. 210 5.32 Specifying Attributes of Variables........................ 210 5.32.1 M32R/D Variable Attributes ...................... 214 5.32.2 i386 Variable Attributes .......................... 215 5.33 Specifying Attributes of Types .......................... 215 5.33.1 i386 Type Attributes ............................
Recommended publications
  • Compiling Sandboxes: Formally Verified Software Fault Isolation
    Compiling Sandboxes: Formally Verified Software Fault Isolation Frédéric Besson1[0000−0001−6815−0652], Sandrine Blazy1[0000−0002−0189−0223], Alexandre Dang1, Thomas Jensen1, and Pierre Wilke2[0000−0001−9681−644X] 1 Inria, Univ Rennes, CNRS, IRISA 2 CentraleSupélec, Inria, Univ Rennes, CNRS, IRISA Abstract. Software Fault Isolation (SFI) is a security-enhancing pro- gram transformation for instrumenting an untrusted binary module so that it runs inside a dedicated isolated address space, called a sandbox. To ensure that the untrusted module cannot escape its sandbox, existing approaches such as Google’s Native Client rely on a binary verifier to check that all memory accesses are within the sandbox. Instead of rely- ing on a posteriori verification, we design, implement and prove correct a program instrumentation phase as part of the formally verified com- piler CompCert that enforces a sandboxing security property a priori. This eliminates the need for a binary verifier and, instead, leverages the soundness proof of the compiler to prove the security of the sandbox- ing transformation. The technical contributions are a novel sandboxing transformation that has a well-defined C semantics and which supports arbitrary function pointers, and a formally verified C compiler that im- plements SFI. Experiments show that our formally verified technique is a competitive way of implementing SFI. 1 Introduction Isolating programs with various levels of trustworthiness is a fundamental se- curity concern, be it on a cloud computing platform running untrusted code provided by customers, or in a web browser running untrusted code coming from different origins. In these contexts, it is of the utmost importance to pro- vide adequate isolation mechanisms so that a faulty or malicious computation cannot compromise the host or neighbouring computations.
    [Show full text]
  • Object Oriented Programming
    No. 52 March-A pril'1990 $3.95 T H E M TEe H CAL J 0 URN A L COPIA Object Oriented Programming First it was BASIC, then it was structures, now it's objects. C++ afi<;ionados feel, of course, that objects are so powerful, so encompassing that anything could be so defined. I hope they're not placing bets, because if they are, money's no object. C++ 2.0 page 8 An objective view of the newest C++. Training A Neural Network Now that you have a neural network what do you do with it? Part two of a fascinating series. Debugging C page 21 Pointers Using MEM Keep C fro111 (C)rashing your system. An AT Keyboard Interface Use an AT keyboard with your latest project. And More ... Understanding Logic Families EPROM Programming Speeding Up Your AT Keyboard ((CHAOS MADE TO ORDER~ Explore the Magnificent and Infinite World of Fractals with FRAC LS™ AN ELECTRONIC KALEIDOSCOPE OF NATURES GEOMETRYTM With FracTools, you can modify and play with any of the included images, or easily create new ones by marking a region in an existing image or entering the coordinates directly. Filter out areas of the display, change colors in any area, and animate the fractal to create gorgeous and mesmerizing images. Special effects include Strobe, Kaleidoscope, Stained Glass, Horizontal, Vertical and Diagonal Panning, and Mouse Movies. The most spectacular application is the creation of self-running Slide Shows. Include any PCX file from any of the popular "paint" programs. FracTools also includes a Slide Show Programming Language, to bring a higher degree of control to your shows.
    [Show full text]
  • Using Restricted Transactional Memory to Build a Scalable In-Memory Database
    Using Restricted Transactional Memory to Build a Scalable In-Memory Database Zhaoguo Wang†, Hao Qian‡, Jinyang Li§, Haibo Chen‡ † School of Computer Science, Fudan University ‡ Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University § Department of Computer Science, New York University Abstract However, the correctness of the resulting code is complex to reason about and relies on the processor’s (increasingly The recent availability of Intel Haswell processors marks the complex) memory model. transition of hardware transactional memory from research Recently, Intel has shipped its 4th-generation Haswell toys to mainstream reality. DBX is an in-memory database processor with support for Hardware Transactional Mem- that uses Intel’s restricted transactional memory (RTM) to ory [16]. This opens up a third possibility to scaling multi- achieve high performance and good scalability across multi- core software. Instead of relying on fine-grained locking core machines. The main limitation (and also key to practi- and atomic operations, one can synchronize using hardware cality) of RTM is its constrained working set size: an RTM transactions, which offer a programming model that is ar- region that reads or writes too much data will always be guably even more straightforward than mutual exclusion. aborted. The design of DBX addresses this challenge in sev- The promise is that the resulting implementation is much eral ways. First, DBX builds a database transaction layer on simpler and easier-to-understand while still retaining the top of an underlying shared-memory store. The two layers performance benefits of fine-grained locking. use separate RTM regions to synchronize shared memory Does hardware transactional memory actually deliver its access.
    [Show full text]
  • Bash Shell Scripts
    Bash Shell Scripts Writing Bash shell scripts Bash shell scripts are text files Text files most efficiently built with programming editors (emacs or vi) File must be executable and in search path chmod 700 my_script PATH environment variable may not include .! An example shell script: #!/bin/bash #My first script echo "Hello World!" Bash Shell Scripts Writing Bash shell scripts Compile a Verilog file with vlog #!/bin/bash if [ ! d work ] ; then echo work does not exist, making it vlib work fi if [ ! s adder.v ] ; then vlog adder.v fi work directory must exist before compilation Get scripts via wget, eg: wget http://web.engr.oregonstate.edu/~traylor/ece474/script --- Bash Shell Scripts Writing Bash shell scripts File attribute checking #!/bin/bash if [ ! s junk_dir ] ; then mkdir junk_dir fi Spaces around brackets are needed! File attribute checking d exists and is a directory e, a file exists f exists and is a regular file s file exists and is not empty --- Bash Shell Scripts Writing Bash shell scripts Compile Verilog then run a simultion #!/bin/bash if [ ! -d "work" ] ; then vlib work fi if [ -s "adder.v" ] ; then vlog adder.v #runs simulation with a do file and no GUI vsim adder -do do.do quiet c else echo verilog file missing fi --- Bash Shell Scripts Writing Bash shell scripts vsim command and arguments vsim entity_name do dofile.do quiet -c -quiet (do not report loading file messages) -c (console mode, no GUI) -do (run vsim from a TCL do file) +nowarnTFMPC (don’t warn about mismatched ports, scary) +nowarnTSCALE (don’t warn about timing mismatches) Try vsim help for command line arguements --- Bash Shell Scripts Writing Bash Shell Scripts (TCL Script) In another text file, we create a TCL script with commands for the simulator.
    [Show full text]
  • Introduction to Linux by Lars Eklund Based on Work by Marcus Lundberg
    Introduction to Linux By Lars Eklund Based on work by Marcus Lundberg ● What is Linux ● Logging in to UPPMAX ● Navigate the file system ● “Basic toolkit” What is Linux ● The Linux Operating system is a UNIX like UNIX compatible Operating system. ● Linux is a Kernel on which many different programs can run. The shell(bash, sh, ksh, csh, tcsh and many more) is one such program ● Linux has a multiuser platform at its base which means permissions and security comes easy. Many Flavours Connect to UPPMAX ● (Download XQuartz or other X11 server for Mac OS ) ● Linux and MacOS: – start Terminal – $ ssh -X [email protected] Connect to UPPMAX for windows users ● Download a X-server such as GWSL or X-ming or VcXsrv or an other of your choosing ● Install WSL and a Distribution such as ubuntu or a ssh program such as MobaXTerm ● Connect to $ ssh -X [email protected] Windows links ● https://sourceforge.net/projects/vcxsrv/ ● https://mobaxterm.mobatek.net/ ● https://opticos.github.io/gwsl/ ● https://sourceforge.net/projects/xming/ ● https://docs.microsoft.com/en-us/windows/wsl/install-wi n10 ● Don’t forget to update to wsl2 X11-forwarding graphics from the command line ● Graphics can be sent through the SSH connection you’re using to connect - Use ssh -Y or ssh -X ● MacOS users will need to install XQuartz. ● When starting a graphical program, a new window will open, but your terminal will be “locked”. - Run using & at the end to run it as a background proccess e.g. “gedit &” - Alternatively, use ctrl-z to put gedit to sleep and
    [Show full text]
  • Emerging Technologies Multi/Parallel Processing
    Emerging Technologies Multi/Parallel Processing Mary C. Kulas New Computing Structures Strategic Relations Group December 1987 For Internal Use Only Copyright @ 1987 by Digital Equipment Corporation. Printed in U.S.A. The information contained herein is confidential and proprietary. It is the property of Digital Equipment Corporation and shall not be reproduced or' copied in whole or in part without written permission. This is an unpublished work protected under the Federal copyright laws. The following are trademarks of Digital Equipment Corporation, Maynard, MA 01754. DECpage LN03 This report was produced by Educational Services with DECpage and the LN03 laser printer. Contents Acknowledgments. 1 Abstract. .. 3 Executive Summary. .. 5 I. Analysis . .. 7 A. The Players . .. 9 1. Number and Status . .. 9 2. Funding. .. 10 3. Strategic Alliances. .. 11 4. Sales. .. 13 a. Revenue/Units Installed . .. 13 h. European Sales. .. 14 B. The Product. .. 15 1. CPUs. .. 15 2. Chip . .. 15 3. Bus. .. 15 4. Vector Processing . .. 16 5. Operating System . .. 16 6. Languages. .. 17 7. Third-Party Applications . .. 18 8. Pricing. .. 18 C. ~BM and Other Major Computer Companies. .. 19 D. Why Success? Why Failure? . .. 21 E. Future Directions. .. 25 II. Company/Product Profiles. .. 27 A. Multi/Parallel Processors . .. 29 1. Alliant . .. 31 2. Astronautics. .. 35 3. Concurrent . .. 37 4. Cydrome. .. 41 5. Eastman Kodak. .. 45 6. Elxsi . .. 47 Contents iii 7. Encore ............... 51 8. Flexible . ... 55 9. Floating Point Systems - M64line ................... 59 10. International Parallel ........................... 61 11. Loral .................................... 63 12. Masscomp ................................. 65 13. Meiko .................................... 67 14. Multiflow. ~ ................................ 69 15. Sequent................................... 71 B. Massively Parallel . 75 1. Ametek.................................... 77 2. Bolt Beranek & Newman Advanced Computers ...........
    [Show full text]
  • The GNU Configure and Build System
    The GNU configure and build system Ian Lance Taylor Copyright c 1998 Cygnus Solutions Permission is granted to make and distribute verbatim copies of this manual provided 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 con- ditions 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 lan- guage, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. i Table of Contents 1 Introduction ............................... 1 1.1 Goals................................................... 1 1.2 Tools ................................................... 1 1.3 History ................................................. 1 1.4 Building ................................................ 2 2 Getting Started............................ 3 2.1 Write configure.in ....................................... 4 2.2 Write Makefile.am ....................................... 6 2.3 Write acconfig.h......................................... 7 2.4 Generate files ........................................... 8 2.5 Example................................................ 8 2.5.1 First Try....................................... 9 2.5.2 Second Try.................................... 10 2.5.3 Third
    [Show full text]
  • Bringing GNU Emacs to Native Code
    Bringing GNU Emacs to Native Code Andrea Corallo Luca Nassi Nicola Manca [email protected] [email protected] [email protected] CNR-SPIN Genoa, Italy ABSTRACT such a long-standing project. Although this makes it didactic, some Emacs Lisp (Elisp) is the Lisp dialect used by the Emacs text editor limitations prevent the current implementation of Emacs Lisp to family. GNU Emacs can currently execute Elisp code either inter- be appealing for broader use. In this context, performance issues preted or byte-interpreted after it has been compiled to byte-code. represent the main bottleneck, which can be broken down in three In this work we discuss the implementation of an optimizing com- main sub-problems: piler approach for Elisp targeting native code. The native compiler • lack of true multi-threading support, employs the byte-compiler’s internal representation as input and • garbage collection speed, exploits libgccjit to achieve code generation using the GNU Com- • code execution speed. piler Collection (GCC) infrastructure. Generated executables are From now on we will focus on the last of these issues, which con- stored as binary files and can be loaded and unloaded dynamically. stitutes the topic of this work. Most of the functionality of the compiler is written in Elisp itself, The current implementation traditionally approaches the prob- including several optimization passes, paired with a C back-end lem of code execution speed in two ways: to interface with the GNU Emacs core and libgccjit. Though still a work in progress, our implementation is able to bootstrap a func- • Implementing a large number of performance-sensitive prim- tional Emacs and compile all lexically scoped Elisp files, including itive functions (also known as subr) in C.
    [Show full text]
  • The GNU Compiler Collection on Zseries
    The GNU Compiler Collection on zSeries Dr. Ulrich Weigand Linux for zSeries Development, IBM Lab Böblingen [email protected] Agenda GNU Compiler Collection History and features Architecture overview GCC on zSeries History and current status zSeries specific features and challenges Using GCC GCC optimization settings GCC inline assembly Future of GCC GCC and Linux Apache Samba mount cvs binutils gdb gcc Linux ls grep Kernel glibc DB2 GNU - essentials UDB SAP R/3 Unix - tools Applications GCC History Timeline January 1984: Start of the GNU project May 1987: Release of GCC 1.0 February 1992: Release of GCC 2.0 August 1997: EGCS project announced November 1997: Release of EGCS 1.0 April 1999: EGCS / GCC merge July 1999: Release of GCC 2.95 June 2001: Release of GCC 3.0 May/August 2002: Release of GCC 3.1/3.2 March 2003: Release of GCC 3.3 (estimated) GCC Features Supported Languages part of GCC distribution: C, C++, Objective C Fortran 77 Java Ada distributed separately: Pascal Modula-3 under development: Fortran 95 Cobol GCC Features (cont.) Supported CPU targets i386, ia64, rs6000, s390 sparc, alpha, mips, arm, pa-risc, m68k, m88k many embedded targets Supported OS bindings Unix: Linux, *BSD, AIX, Solaris, HP/UX, Tru64, Irix, SCO DOS/Windows, Darwin (MacOS X) embedded targets and others Supported modes of operation native compiler cross-compiler 'Canadian cross' builds GCC Architecture: Overview C C++ Fortran Java ... front-end front-end front-end front-end tree Optimizer rtx i386 s390 rs6000 sparc ... back-end back-end back-end
    [Show full text]
  • Memory Tagging and How It Improves C/C++ Memory Safety Kostya Serebryany, Evgenii Stepanov, Aleksey Shlyapnikov, Vlad Tsyrklevich, Dmitry Vyukov Google February 2018
    Memory Tagging and how it improves C/C++ memory safety Kostya Serebryany, Evgenii Stepanov, Aleksey Shlyapnikov, Vlad Tsyrklevich, Dmitry Vyukov Google February 2018 Introduction 2 Memory Safety in C/C++ 2 AddressSanitizer 2 Memory Tagging 3 SPARC ADI 4 AArch64 HWASAN 4 Compiler And Run-time Support 5 Overhead 5 RAM 5 CPU 6 Code Size 8 Usage Modes 8 Testing 9 Always-on Bug Detection In Production 9 Sampling In Production 10 Security Hardening 11 Strengths 11 Weaknesses 12 Legacy Code 12 Kernel 12 Uninitialized Memory 13 Possible Improvements 13 Precision Of Buffer Overflow Detection 13 Probability Of Bug Detection 14 Conclusion 14 Introduction Memory safety in C and C++ remains largely unresolved. A technique usually called “memory tagging” may dramatically improve the situation if implemented in hardware with reasonable overhead. This paper describes two existing implementations of memory tagging: one is the full hardware implementation in SPARC; the other is a partially hardware-assisted compiler-based tool for AArch64. We describe the basic idea, evaluate the two implementations, and explain how they improve memory safety. This paper is intended to initiate a wider discussion of memory tagging and to motivate the CPU and OS vendors to add support for it in the near future. Memory Safety in C/C++ C and C++ are well known for their performance and flexibility, but perhaps even more for their extreme memory unsafety. This year we are celebrating the 30th anniversary of the Morris Worm, one of the first known exploitations of a memory safety bug, and the problem is still not solved.
    [Show full text]
  • Seashore Guide
    Seashore The Incomplete Guide Contents Contents..........................................................................................................................1 Introducing Seashore.......................................................................................................4 Product Summary........................................................................................................4 Technical Requirements ..............................................................................................4 Development Notice....................................................................................................4 Seashore’s Philosophy.................................................................................................4 Seashore and the GIMP...............................................................................................4 How do I contribute?...................................................................................................5 The Concepts ..................................................................................................................6 Bitmaps.......................................................................................................................6 Colours .......................................................................................................................7 Layers .........................................................................................................................7 Channels ..................................................................................................................
    [Show full text]
  • Statically Detecting Likely Buffer Overflow Vulnerabilities
    Statically Detecting Likely Buffer Overflow Vulnerabilities David Larochelle [email protected] University of Virginia, Department of Computer Science David Evans [email protected] University of Virginia, Department of Computer Science Abstract Buffer overflow attacks may be today’s single most important security threat. This paper presents a new approach to mitigating buffer overflow vulnerabilities by detecting likely vulnerabilities through an analysis of the program source code. Our approach exploits information provided in semantic comments and uses lightweight and efficient static analyses. This paper describes an implementation of our approach that extends the LCLint annotation-assisted static checking tool. Our tool is as fast as a compiler and nearly as easy to use. We present experience using our approach to detect buffer overflow vulnerabilities in two security-sensitive programs. 1. Introduction ed a prototype tool that does this by extending LCLint [Evans96]. Our work differs from other work on static detection of buffer overflows in three key ways: (1) we Buffer overflow attacks are an important and persistent exploit semantic comments added to source code to security problem. Buffer overflows account for enable local checking of interprocedural properties; (2) approximately half of all security vulnerabilities we focus on lightweight static checking techniques that [CWPBW00, WFBA00]. Richard Pethia of CERT have good performance and scalability characteristics, identified buffer overflow attacks as the single most im- but sacrifice soundness and completeness; and (3) we portant security problem at a recent software introduce loop heuristics, a simple approach for engineering conference [Pethia00]; Brian Snow of the efficiently analyzing many loops found in typical NSA predicted that buffer overflow attacks would still programs.
    [Show full text]