如何使用 gcc 生成 Intel 语法中的汇编代码? [英] How do you use gcc to generate assembly code in Intel syntax?

查看:35
本文介绍了如何使用 gcc 生成 Intel 语法中的汇编代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gcc -S 选项将生成 AT&T 语法的汇编代码,有没有办法生成 Intel 语法的文件?或者有没有办法在两者之间转换?

The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?

推荐答案

你试过了吗?

gcc -S -masm=intel test.c

未经测试,但我在此论坛中找到了它,有人声称它对他们有用.

Untested, but I found it in this forum where someone claimed it worked for them.

我刚刚在 mac 上试过了,但失败了,所以我查看了我的手册页:

I just tried this on the mac and it failed, so I looked in my man page:

   -masm=dialect
       Output asm instructions using selected dialect.  Supported choices
       are intel or att (the default one).  Darwin does not support intel.

它可能适用于您的平台.

It may work on your platform.

对于 Mac OSX:

For Mac OSX:

clang++ -S -mllvm --x86-asm-syntax=intel test.cpp

来源:https://stackoverflow.com/a/11957826/950427

这篇关于如何使用 gcc 生成 Intel 语法中的汇编代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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