这是什么风格的组件(intel、att...等?)以及如何生成它?

问题描述 投票:0回答:1

我正在尝试生成这样的汇编代码(以便它与 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++ c gcc
1个回答
0
投票

这是英特尔风格。

您在问题中编写的命令行有什么问题?

© www.soinside.com 2019 - 2024. All rights reserved.