gcc Compiler
Description
When you invoke GCC, you typically perform preprocessing, compilation,
assembly and bonding. The “general options” allow you to stop
this process in an intermediate stage. For example, the -c option
it says not to run the linker. Then the output consists of
assembler-generated object files.
Other options go to one or more stages of processing.
Some options control the preprocessor and others control the
own compiler. However, other options control the assembler and linker; the majority
of these are not documented here as they rarely need to be used
.
Most of the command line options that you can use with GCC are
useful for C programs; when one option is only useful with another
language (usually C ++), the explanation says so explicitly. Yes
the description of a particular option does not mention a
source language, you can use that option with all supported languages.
The usual way to run GCC is to run the executable called gcc, or
machine -gcc when cross-compiling, or machine -gcc- version to run a
GCC specific version. When you compile programs in C ++,
you should invoke GCC as g ++ instead.
The gcc program accepts options and file names as operands. Many
options have multi-letter names; Thus
, multiple single letter options may not be grouped together: -dv is very different from -d -v.
You can mix options and other arguments. For the most part, the
order you use doesn’t matter. Order matters when you use
several options of the same type; for example, if you specify -L
more than once, the directories are searched in the order
specified. Also, the location of the -l option is significant.
Many options have long names that start with -fo with -W — — for
example, -fmove-loop-invariants, -Wformat, and so on. most of
These have both positive and negative forms; the negative form of
-ffoo is -fno-foo. This manual documents only one of these two
forms, whichever is not the default.
Some options take one or more normally separate arguments
by a space or by the equal sign (=) of the option name.
Unless otherwise documented, an argument can be numeric or
a chain. Numeric arguments should generally be small unsigned
decimal or hexadecimal integers. Hexadecimal arguments must
start with the prefix 0x. Arguments to options that specify a
size threshold of some kind may be
arbitrarily large decimal or hexadecimal integers followed by a byte-size suffix designating a
multiple of bytes such as “kB” and “KiB” for kilobyte and
kibibyte, respectively, “MB” and “MiB” for megabyte and mebibyte,
“GB” and “GiB” for gigabyte and gigibyte, and so on. Sayings
Arguments are designated by byte size in the following text.
Consult NIST, IEC,
binary and decimal byte size prefixes.
Source code
Source code is understood to be any human-readable text written in a specific programming language.
Preprocessor
preprocessing is the first stage in the compilation process of C programs. The preprocessor is a tool that filters source code before compiling it. The preprocessor accepts the source code as input and takes care of:
- Delete the comments.
- Interpret and process preprocessing directives. The preprocessor provides a set of directives that are an extremely useful tool for the programmer. All directives always start with the # symbol.
Using preprocessing directives provides several benefits:
- Facilitates software development.
- Facilitates the reading of programs.
- Facilitates software modification.
- It helps to make C code portable to different architectures.
- It facilitates the concealment of information.
Compiler
In this part of the compiler the assembly code is generated
Assembler
In this part the assembly code is generated
Linker
In this part, the assembly code is combined with the libraries to generate an executable.