学习阅读GCC汇编输出。 [英] Learning to read GCC assembler output

查看:113
本文介绍了学习阅读GCC汇编输出。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在考虑拿起装配的一些非常基本的了解。我现在的目标很简单:非常基本编译时GCC汇编输出的理解C / C ++与86 / x86-64的-S开关

I'm considering picking up some very rudimentary understanding of assembly. My current goal is simple: VERY BASIC understanding of GCC assembler output when compiling C/C++ with the -S switch for x86/x86-64.

刚好够做简单的事情,如看一个单一的功能并验证是否GCC优化掉一些东西我希望消失了。

Just enough to do simple things such as looking at a single function and verifying whether GCC optimizes away things I expect to disappear.

有没有人有/知道一个真正简明的介绍集会,有关GCC和专为阅读的目的,而且最重要的指令列表的人随便读装配应该知道?

Does anyone have/know of a truly concise introduction to assembly, relevant to GCC and specifically for the purpose of reading, and a list of the most important instructions anyone casually reading assembly should know?

推荐答案

如果你正在使用gcc或铛中,-masm =英特尔参数告诉编译器生成与英特尔语法,而不是AT&放组装; T语法,及--save-临时工的说法告诉编译器保存在目录GCC临时文件(preprocessed源,汇编输出,未链接的目标文件)从调用。

If you're using gcc or clang, the -masm=intel argument tells the compiler to generate assembly with Intel syntax rather than AT&T syntax, and the --save-temps argument tells the compiler to save temporary files (preprocessed source, assembly output, unlinked object file) in the directory GCC is called from.

获取x86汇编的一个粗浅的认识应该很容易与所有的资源在那里。这里有一个这样的资源:<一href=\"http://www.cs.virginia.edu/~evans/cs216/guides/x86.html\">http://www.cs.virginia.edu/~evans/cs216/guides/x86.html

Getting a superficial understanding of x86 assembly should be easy with all the resources out there. Here's one such resource: http://www.cs.virginia.edu/~evans/cs216/guides/x86.html .

您也可以只用反汇编和gdb看什么编译的程序在做什么。

You can also just use disasm and gdb to see what a compiled program is doing.

这篇关于学习阅读GCC汇编输出。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆