gcc常用命令使用
gcc编译文件过程
.c文件到 .i文件 到.s(汇编文件) 到.o文件,再到可执行文件
.c到.i
实操一下:
test.c文件如下 :
#include <stdlib.h>
#include <stdio.h>
int main()
{
char buf[]={};
int n = snprintf(buf, , "%s", "");
printf("buf: %s\n", buf);
printf("n: %d\n", n); }
gcc -E test.c -o test.i,文件过大,只显示一部份

gcc -s test.i
vim test.s
test.s内容如下:
.LC2:
.string "buf: %s\n"
.LC3:
.string "n: %d\n"
.text
.globl main
.type main, @function
main:
.LFB2:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset
.cfi_offset , -
movq %rsp, %rbp
.cfi_def_cfa_register
subq $, %rsp
movq %fs:, %rax
movq %rax, -(%rbp)
xorl %eax, %eax
movq $, -(%rbp)
leaq -(%rbp), %rax
movl $.LC0, %ecx
汇编代码到 .o文件
gcc -c test.s 生成 test.o

生成二进制文件
gcc -c test.o -o test

gcc常用命令使用的更多相关文章
- GCC常用命令行一览表
GCC常用命令行一览表 这些常用的 gcc/g++ 命令行参数,你都知道么?1. gcc -E source_file.c-E,只执行到预编译.直接输出预编译结果. 2. gcc -S source_ ...
- gcc 常用命令行及解释
gcc - GNU project C and C++ compiler gcc [option] file... preprocessing compila ...
- Linux系统GCC常用命令和GCC编译过程描述
前言: GCC 原名为 GNU C 语言编译器(GNU C Compiler),因为它原本只能处理 C语言.GCC 很快地扩展,变得可处理 C++.后来又 扩展能够支持更多编程语言,如Fortran. ...
- Linux GCC常用命令
1简介 2简单编译 2.1预处理 2.2编译为汇编代码(Compilation) 2.3汇编(Assembly) 2.4连接(Linking) 3多个程序文件的编译 4检错 5库文件连接 5.1编译成 ...
- gcc常用命令集
引用:http://developer.51cto.com/art/200609/32317_1.htm 对于GUN编译器来说,程序的编译要经历预处理.编译.汇编.连接四个阶段 假设源程序文件名为te ...
- (转)Linux GCC常用命令
1简介 2简单编译 2.1预处理 2.2编译为汇编代码(Compilation) 2.3汇编(Assembly) 2.4连接(Linking) 3多个程序文件的编译 4检错 5库文件连接 5.1编译成 ...
- gcc 常用命令
gcc编译器 $ gcc -o XX.exe XXX.c ddd.c $ gcc -o XX.asm -S XXX.c 编译生成可执行文件,并执行程序,缺省的时候,gcc 编译出来的文件是a.out ...
- gcc常用命令
1简介 2简单编译 2.1预处理 2.2编译为汇编代码(Compilation) 2.3汇编(Assembly) 2.4连接(Linking) 3多个程序文件的编译 4检错 5库文件连接 5.1编译成 ...
- Linux GCC常用命令学习
1简介 GCC 的意思也只是 GNU C Compiler 而已.经过了这么多年的发展,GCC 已经不仅仅能支持 C 语言:它现在还支持 Ada 语言.C++ 语言.Java 语言.Objective ...
- 【转】Linux GCC常用命令
转自:http://www.cnblogs.com/ggjucheng/archive/2011/12/14/2287738.html 1简介 2简单编译 2.1预处理 2.2编译为汇编代码(Comp ...
随机推荐
- ROS中.launch文件的remap标签详解
https://www.cnblogs.com/LiuQiang921202/p/7679943.html
- CCPC-Wannafly Winter Camp Day1 Div1 - 爬爬爬山 - [最短路][堆优化dijkstra]
题目链接:https://zhixincode.com/contest/3/problem/F?problem_id=39 样例输入 1 4 5 1 1 2 3 4 1 2 1 1 3 1 1 4 ...
- POJ 3635 - Full Tank? - [最短路变形][优先队列优化Dijkstra]
题目链接:http://poj.org/problem?id=3635 Description After going through the receipts from your car trip ...
- BZOJ 1150 - 数据备份Backup - [小顶堆][CTSC2007]
题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1150 Time Limit: 10 Sec Memory Limit: 162 M De ...
- [No0000183]Parallel Programming with .NET-How PLINQ processes an IEnumerable<T> on multiple cores
As Ed Essey explained in Partitioning in PLINQ, partitioning is an important step in PLINQ execution ...
- Some untracked working tree files would be overwritten by checkout. Please move or remove them before you can checkout. View them
Some untracked working tree files would be overwritten by checkout. Please move or remove them befor ...
- XA Transactions Restrictions on XA Transactions
小结: 1.innodb支持XA事务: 2.XA协议作为资源管理器(数据库)与事务管理器的接口标准: 3.提交或者回滚的点:必须所有的组件被提交或者被回滚: 4.2阶段 PC-1,TM告知所有RM要准 ...
- 在计算机通信中,可靠交付应当由谁来负责?是网络还是端系统? 网络层协议 MAC帧、IP数据报、TCP报文 关系 IP地址与硬件地址 链路层与网络层
小结: 1. 网络层两种服务 虚电路服务 virtual circuit 电信网 网络层负责可靠交付 数据报服务 网络层不负责可靠交付 提供灵活的.无连接的.尽最大努力交付的数据报服务 不提供服务 ...
- day4_函数简单介绍
一.函数是什么? 函数一词来源于数学,但编程中的「函数」概念,与数学中的函数是有很大不同的,编程中的函数在英文中也有很多不同的叫法.在BASIC中叫做subroutine(子过程或子程序),在Pasc ...
- vue安装调试器Vue.js devtools
一. 打开https://github.com/vuejs/vue-devtools,进入gitlab.往下翻找到: 找到installation,选择以chrome的拓展方式安装. 二. 这边选择添 ...