Reverse-1.X86汇编

历史

结构种类:

X86 AMD64 ARM MIPS IA64 X86-64CPU

分为:精简指令集(risv)该指令集编程相对复杂,复杂指令集(cisv)

ARM手机芯片  MIPS嵌入式路由器

基础知识--字节

基础知识--总线

冯诺依曼理论---计算机组成----总线

总线是单向的。

 基础知识--编译过程

文本到可以执行的程序。

过程:预编译-->编译-->汇编-->链接

gcc -E xxx.c -o xxx.i

gcc -S xxx.i -o xxx.s

gcc -c xxx.s -o xxx.o

gcc --static xxx.o -o xxx

预编译:头文件进行展开。留下正确的宏,删除不需要的分支,展开嵌套。

编译:将预处理之后的文件转化为汇编语言,

汇编:将汇编语言转化为机器语言。

链接:静态链接,自己带lib库,动态链接调用第三方的lib库

案例:

demo.c

#include <stdio.h>

int main() {
		printf("hello word");
    return 0;
}

将demo.c预编译

 gcc -E demo.c -o demo.i

查看编译的内容

[root@localhost ~]# cat demo.i|more
# 1 "demo.c"
# 1 "<built-in>"
# 1 "<命令行>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<命令行>" 2
# 1 "demo.c"

# 1 "/usr/include/stdio.h" 1 3 4
# 27 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 375 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 392 "/usr/include/sys/cdefs.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 393 "/usr/include/sys/cdefs.h" 2 3 4
# 376 "/usr/include/features.h" 2 3 4
# 399 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 10 "/usr/include/gnu/stubs.h" 3 4
# 1 "/usr/include/gnu/stubs-64.h" 1 3 4
# 11 "/usr/include/gnu/stubs.h" 2 3 4
# 400 "/usr/include/features.h" 2 3 4
# 28 "/usr/include/stdio.h" 2 3 4

# 1 "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stddef.h" 1 3 4
# 212 "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stddef.h" 3 4
typedef long unsigned int size_t;
# 34 "/usr/include/stdio.h" 2 3 4

# 1 "/usr/include/bits/types.h" 1 3 4
# 27 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 28 "/usr/include/bits/types.h" 2 3 4

typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;

typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

typedef signed long int __int64_t;
typedef unsigned long int __uint64_t;


.......

将预编译的文件进行编译,转化为汇编语言。

gcc -S demo.i -o demo.s

查看编译后的内容

[root@localhost ~]# cat demo.s|more
	.file	"demo.c"
	.section	.rodata
.LC0:
	.string	"hello word"
	.text
	.globl	main
	.typ
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值