gcc
GCC, the GNU Compiler Collection
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada,
Go, and D, as well as libraries for these languages (libstdc++,...). GCC was originally
written as the compiler for the GNU operating system. The GNU system was developed to
be 100% free software, free in the sense that it respects the user's freedom.
We strive to provide regular, high quality releases, which we want to work well on a
variety of native and cross targets (including GNU/Linux), and encourage everyone to
contribute changes or help testing GCC. Our sources are readily and freely available
via Git and weekly snapshots.
https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/
https://gcc.gnu.org/onlinedocs/10.1.0/
------------------------------------------------------------
gcc操作手册:
https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc.pdf
gcc的安装:
----------------------------------------------------------------
gcc Host/Target 参数说明
https://gcc.gnu.org/install/specific.html
gcc编译
一步到位编译:gcc hello.c -o hello
预处理 -E (.i) 编译 -S (.s) 汇编-c (.o) 连接-o
预处理
gcc -E hello.c -o hello.i -E:仅执行编译预处理
-o:将结果输出并指定输出文件的文件名
编译为汇编代码
gcc -S hello.c(.i) -o hello.s -S:将C代码转换为汇编代码
汇编:
gcc -c hello.c -o hello.o -c:仅执行编译操作,不进行连接操作
连接:
gcc hello.o -o hello
-o:将结果输出并指定输出文件的文件名
-O0、-O1、-O2、-O3:编译优化选项的四个级别,-O0 表示没有优化, -O1 为默认值,-O3 优化级别最高
-g:只是编译器,在编译的时候,产生调试信息
gdb
https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/gdb.html
linux工具使用教程
https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/lsof.html