🌐
GitHub
github.com › gcc-mirror › gcc
GitHub - gcc-mirror/gcc
The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs.
Starred by 10.7K users
Forked by 4.7K users
Languages   C++ 30.1% | C 29.3% | Ada 14.0% | D 5.9% | Go 5.3% | HTML 3.6%
optimizing compiler produced by the GNU Project, key component of the GNU tool-chain and standard compiler for most projects related to GNU and the Linux kernel.
GCC_10.2_GNU_Compiler_Collection_self-compilation.png
gcc 11 1 0 compiling chicken screenshot
The GNU Compiler Collection (GCC) (formerly GNU C Compiler) is a collection of compilers from the GNU Project that support various programming languages, hardware architectures, and operating systems. The Free Software Foundation … Wikipedia
Factsheet
Original author Richard Stallman
Developer GNU Project
Initial release March 22, 1987; 38 years ago (1987-03-22)
Factsheet
Original author Richard Stallman
Developer GNU Project
Initial release March 22, 1987; 38 years ago (1987-03-22)
🌐
Wikipedia
en.wikipedia.org › wiki › GNU_Compiler_Collection
GNU Compiler Collection - Wikipedia
3 weeks ago - Compiler optimizations and static code analysis techniques (such as FORTIFY_SOURCE, a compiler directive that attempts to discover some buffer overflows) are applied to the code. These work on multiple representations, mostly the architecture-independent GIMPLE representation and the architecture-dependent RTL representation. Finally, machine code is produced using architecture-specific pattern matching originally based on an algorithm of Jack Davidson and Chris Fraser. GCC was written primarily in C except for parts of the Ada front end.
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_enterprise_linux › 7 › html › developer_guide › gcc-compiling-code
Chapter 15. Building Code with GCC | Developer Guide | Red Hat Enterprise Linux | 7 | Red Hat Documentation
With C++ source code, replace the gcc command with g++ for convenient handling of C++ Standard Library dependencies. Section 15.8, “Example: Building a C Program with GCC”
🌐
Pepas
leopard-adc.pepas.com › documentation › DeveloperTools › gcc-4.2.1 › gcc › Source-Code.html
Source Code - Using the GNU Compiler Collection (GCC)
The source code for released versions of Apple's GCC is available at `http://www.opensource.apple.com/darwinsource/', in `.tar.gz' format.
🌐
GNU
gcc.gnu.org
GCC, the GNU Compiler Collection - GNU Project
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, COBOL, Rust, and Algol 68 as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system.
Top answer
1 of 2
12

The .md (machine description) files of GCC source contain stuff to generate assembly. GCC contains several specialized C/C++ code generators (and some of them translates the .md files into code emitting assembly).

GCC is a very complex program. The documentation of GCC MELT (an obsolete project) contains several interesting links and slides, notably refering to the Indian GCC Resource Center

Most of the optimizations in GCC happens in the middle-end (which is mostly independent of source language or target system), notably with many passes working on the Gimple representations.

The GCC repo is an SVN repository.

See also this answer, notably the pictures inside it.

2 of 2
5

The actual source code for GCC is most accessible from here:

https://gcc.gnu.org/svn.html

The software is accessible via SVN (subversion), a source code control system. This would be installed on many versions of Linux/UNIX, but if not on your platform, you can install the svn kit and then fetch the source using the following command:

svn checkout svn://gcc.gnu.org/svn/gcc/trunk SomeLocalDir

GCC is complex and would take significant experience to understand the nature of how the application actually compiles to different architectures.

In a nutshell, GCC has three major components - front-end, middle and back-end processing. The front-end processor has the component of the language parsing to understand the syntax of languages (like C, C++, Objective-C, etc). The front-end deconstructs the code to a portable construct which is then passed to the back-end for compilation to the target environment.

The middle part performs code analysis and optimisation, attempting to prioritise the code to generate the best possible output at the end of the full process. Technically, optimisation can occur at any part of the process as patterns are discovered during analysis.

The back-end processor compiles the code to a tree-style output format (not actually final executable code). Based on what the expected output is designed to be, the "pseudo-code" is optimised for using registers, bit-sizes, endian-ness, and so on. The final code is then generated during the assembly phase, which converts the back-end code into machine executable instructions.

It's important to note that the compiler has many options to deal with output formats so you can create output to many classes of architecture, usually out of the box. For cross-compiling and target compiler options, try checking out this link:

https://gcc.gnu.org/install/configure.html

🌐
Medium
medium.com › @darrenjs › building-gcc-from-source-dcc368a3bb70
Building GCC from source. Step by step guide on building GCC 9 | by Darren Smith | Medium
June 2, 2019 - The build script defines a utility function (__untar) to open a tarfile and then move its contents into the GCC source code directory. The following example is repeated for each dependency:
Find elsewhere
🌐
GitHub
github.com › gcc-mirror › gcc › blob › master › README
gcc/README at master · gcc-mirror/gcc
This directory contains the GNU Compiler Collection (GCC).
Author   gcc-mirror
🌐
GNU
gcc.gnu.org › legacy-ml › gcc › 2008-03 › msg00903.html
Basile STARYNKEVITCH - Re: How to understand gcc source code?
* on the positive side, GCC is still doing well and alive, has an active community; when you ask questions on this gcc@gcc.gnu.org mailing list, you get some answers, provided your question is precise enough, and you did look into code and existing documentation. * more concretely, there are lot of material on GCC. Of course, the "official" documentation http://gcc.gnu.org/onlinedocs/ the source code (usually well commented), the mailing lists (including gcc-patches@gcc.gnu.org), the Wiki (feel free to contribute) http://gcc.gnu.org/wiki and many others (which you can find by STFW).
🌐
Narkive
gcc.gcc.gnu.narkive.com › q2CaPOAd › understanding-source
Understanding gcc source
Post by Hari I am trying to understand the source code of Gcc because I want to learn its control flow . I am basically concentrating on the order in which Gcc compiler consults its different source files like toplev.c ,expr.c ..e.t.c. Please see the gcc documentation that comes with the gcc sources.
🌐
NTU
www3.ntu.edu.sg › home › ehchua › programming › cpp › gcc_make.html
GCC and Make - A Tutorial on how to compile, link and build C/C++ applications
Compilation: The compiler compiles the pre-processed source code into assembly code for a specific processor. > gcc -S hello.i The -S option specifies to produce assembly code, instead of object code.
🌐
OpenGenus
iq.opengenus.org › build-gcc-from-source
Build GCC from source [GCC v12.2.0]
October 17, 2022 - $PWD/../gcc-12.2.0/configure --prefix=$HOME/GCC-12.2.0 --enable-languages=c
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › gcc-command-in-linux-with-examples
gcc command in Linux with examples - GeeksforGeeks
October 4, 2025 - Most Useful Options with Examples: Here source.c is the C program code file. -o opt: This will compile the source.c file but instead of giving default name hence executed using ./opt, it will give output file as opt.
🌐
GNU
gcc.gnu.org › install › download.html
Downloading GCC - GNU Project
Please refer to the releases web page for information on how to obtain GCC. The source distribution includes the Ada, C, C++, Objective-C, COBOL (GCC 15 and later), D (GCC 9 and later), Fortran, Go, Modula-2 (GCC 13 and later) and Algol 68 (GCC 16 and later, experimental) compilers, as well ...
🌐
Medium
medium.com › @307 › looking-under-the-hood-with-gcc-facfb8809a2b
Looking Under The Hood With GCC. What is GCC | by Andrew | Medium
January 18, 2018 - Besides the header file, there are conditional statements to define macros and predefined macros already ready to use within the program such as __DATE__ or __FILE__. We can also see what source code would look like after going through the pre-processing phase using the -E option from gcc.
🌐
D-meiser
d-meiser.github.io › 2015 › 11 › 30 › building-gcc-trunk.html
Building gcc from source
With things changing this rapidly ... from source. That’s especially true if the stock compiler that comes with your linux distribution is dated (e.g. centos 6 which ships with gcc version 4.4). In addition to the benefits just mentioned this also gives access to experimental features that aren’t in the release version of the compiler yet. As a bonus, you get to taylor various features of the compiler to your needs. For example, with gcc ...
🌐
Medium
medium.com › @camilofetecua2011 › compiling-with-gcc-transforming-source-code-into-executable-programs-2f362859d54f
Compiling with gcc: Transforming Source Code into Executable Programs | by Camilo Fetecua | Medium
October 27, 2023 - In this post, we will explore the steps of the compilation process using “gcc.” ... Every software project begins with the creation of source code, written in programming languages like C or C++. In this example, we'll consider a simple program, "Hello World" in C, typically saved in a file named "main.c." Here's the source code:
🌐
GNU
gcc.gnu.org › codingconventions.html
GCC Coding Conventions - GNU Project
For example, appropriate uses of @code are in phrases such as "@code{const}-qualified type", or "@code{asm} statement", or "function returns @code{true}". Examples where @code should be avoided are phrases such as "const variable", "volatile access", or "condition is false."