According to man gcc, gcc supports the following languages, which you can choose from with the -x flag:

c  c-header  cpp-output
c++  c++-header  c++-cpp-output
objective-c  objective-c-header  objective-c-cpp-output
objective-c++ objective-c++-header objective-c++-cpp-output
assembler  assembler-with-cpp
f77  f77-cpp-input f95  f95-cpp-input

What is the criteria for putting a language in gcc? Obviously languages like C and C++ are going to be in gcc, but I was surprised at go and java.

Additionally, the gcc documentation at gnu.org says: "The language-independent component of GCC includes the majority of the optimizers, as well as the “back ends” that generate machine code for various processors." My knowledge on compilers is basic at best, but does this mean that gcc parses and lexes each language into some kind of universal format and then produces some kind of binary from there? If this is the case, would writing a gcc optimizer that is language-independent work for any of those languages, for example both C and go?

closed as too broad by Michael Homer, Thomas Dickey, mosvy, Mr Shunz, msp9011 Mar 18 at 8:43

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Basically, there has to be a language frontend and any necessary supporting libraries, licensed appropriately, of sufficient quality (code but also documentation and tests), with people willing to maintain it. The deciders are the GCC steering committee.

There are examples of languages being added and removed in the not-too-distant past. D became a candidate in 2011, was approved in 2017 and is available in GCC 8. Java on the other hand was removed in GCC 7 after languishing for a long time.

There are projects to add Python and Rust but I don’t think there’s much activity there.

GCC is split into multiple components; the various languages it supports are implemented by frontends, which transform programs into an intermediate representation, GIMPLE (which is language- and machine-independent). Optimisers are thus shared across languages.

Not the answer you're looking for? Browse other questions tagged or ask your own question.