无法使用 MinGW 编译包含 asm 代码的 C 文件

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

我需要将一个具有 asm 片段的 C 程序编译为 32 位 PE 文件,asm 代码以这种方式声明:

__asm__("jz $ + $13;\n\t"
        "jnz $ + $7;\n\t"
        "emit %0xe8;\n\t");

当我尝试用基于 GCC 的 MinGW 编译它时,它给了我错误:

/tmp/ccPbXtg9.s: Assembler messages:
/tmp/ccPbXtg9.s:77: Error: operand type mismatch for `jz'
/tmp/ccPbXtg9.s:78: Error: operand type mismatch for `jnz'
/tmp/ccPbXtg9.s:79: Error: no such instruction: `emit %0xe8'

我用来编译的命令是

i686-w64-mingw32-gcc file.c -o file.exe

你知道我做错了什么吗?提前谢谢你。

c assembly gcc inline-assembly portable-executable
© www.soinside.com 2019 - 2024. All rights reserved.