gcc - GCC with -masm=intel produces AT&T syntax
问题描述
Below is a gcc command line string I used to output to assembly language listing using -masm=intel. Both command line strings work, but they both produce AT&T syntax, not Intel syntax.
gcc -S -masm=intel Svx.c
but that produces a mixed Intel and AT&T syntax.
.file "Svx.c"
.intel_syntax noprefix
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
mov DWORD PTR -4[rbp], 0
jmp .L2
.L3:
add DWORD PTR -4[rbp], 1
.L2:
cmp DWORD PTR -4[rbp], 1000000000
jne .L3
mov eax, DWORD PTR -4[rbp]
pop rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0"
.section .note.GNU-stack,"",@progbits
The output looks like a modified Intel syntax, but the AT&T-specific cfi directives for stack handling are not translated. And add DWORD PTR -4[rbp],1 is not Intel syntax.
Why do I get mixed AT&T and Intel syntax with -masm=intel?
解决方案
CFI 指令是GNU 汇编器的指令。通常,此类指令(以 a 开头.
)与您选择的汇编语言无关,因此您担心的行不是“AT&T 特定的”,甚至与 AT&T 无关。
并且add DWORD PTR -4[rbp],1
是英特尔语法。
推荐阅读
- python - 如果字符串包含 PySpark 中的某些子字符串,则替换字符串
- php - 在 Laravel 中重新排序集合
- java - Java - JPA 规范:如何在属于嵌套对象的字段上创建标准/规范?
- javascript - 如何自定义 Ant Design 的表单?
- javascript - Proxyquire 和 Sinon 检查函数是否被调用
- python - 如何输入类型
- node.js - 尝试打开应用程序时 Heroku 错误代码 H13
- flutter - authStateChanges 仅在调试模式下有效
- python - 使用 libimobiledevice python 绑定的正确方法是什么?
- python - 具有固定主机名的 Kubernetes