Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Principle Analysis of Linux tool GCC Compiler

Shulou Source: shulou.com Published: 2022-06-02 01:39:25 10月02日 Update

This article introduces the principle analysis of Linux tool GCC compiler, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Overview

The GCC (GNU Compiler Collection) compiler is the default compiler for the GNU Linux operating system

Preprocessing of compilation process

The preprocessor CPP performs preprocessing, expands header files, macros, etc., and generates .i files.

Compile

GCC supports a variety of programming languages, assuming that the c language ze calls the C language compiler cll. After the compilation, the assembler is generated and the .s file is output.

Compilation

GCC calls the assembler as to assemble to generate a redirectable object program.

Link

GCC call linker connects all object files and C language standard libraries into executable binary files.

Compilation option

Programs compiled locally on the current target platform and generally run only on the currently compiled platform.

Cross-compilation compiles on one platform and then runs on another platform. This process is called cross-compilation.

Gcc compilation options

Option

-c

Compiles and assembles the specified source file, but does not link

-S

Compiles the specified source file, but does not assemble

-E preprocesses the specified source file without compiling-o to generate the target file, [file1] [file2] compiles the file file2 into an executable file file1-Idirectory specifies the search directory of the include containing file-g to generate debugging information, and the program can be debugged by the debugger.

-Wall

Generate all warning messages

On the Linux tool GCC compiler principle analysis is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Compile file generate compiler platform target program language preprocessing source file link principle tool analysis information content more cross help run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Tech Info Apple Xiaomi macOS