c++ - 这是什么样式的组件(intel、att...等?),我该如何生产它?

标签 c++ c gcc compiler-construction

我正在尝试生成这样的汇编代码(以便它与 nasm 一起工作)

;hello.asm
[SECTION .text]

global _start


_start:

    jmp short ender

    starter:

    xor eax, eax    ;clean up the registers
    xor ebx, ebx
    xor edx, edx
    xor ecx, ecx

    mov al, 4       ;syscall write
    mov bl, 1       ;stdout is 1
    pop ecx         ;get the address of the string from the stack
    mov dl, 5       ;length of the string
    int 0x80

    xor eax, eax
    mov al, 1       ;exit the shellcode
    xor ebx,ebx
    int 0x80

    ender:
    call starter    ;put the address of the string on the stack
    db 'hello'

首先,这是什么汇编风格,其次,如何使用类似于 gcc -S code.c -o code.S -masm=intel 的命令从 C 文件生成它

最佳答案

这是英特尔风格。

问题中你写的命令行有什么问题?

关于c++ - 这是什么样式的组件(intel、att...等?),我该如何生产它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10070091/

相关文章:

c++ - Boost async_read 没有给我一个 "end of frame"标志

c++ - 将 std::unique_ptr 与 lambda 交换为删除器——GCC

gcc - 如何将 GCC LTO 与不同优化的目标文件一起使用?

c++ - 一个类的双重部分模板特化

c++ - 快速 n 为大 n 选择 k mod p?

c++ - 尝试使用类 C++ 创建通用数据类型的问题

c - Erlang ei ei_decode_version等函数未定义引用

c - 使用 eclipse CDT 进行 gdb 调试 : not able to show correctly varibles values

c - freeRTOS环境下公共(public)变量的存储区

c++ - 如何配置 autoreconf 使用不同于 GCC 的编译器