在气体汇编语言中使用ifdef [英] Use of ifdef in gas assembly language

查看:218
本文介绍了在气体汇编语言中使用ifdef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下汇编文件mov.s

I have following assembly file mov.s

 .text
    .macro test_3
     and $3,%eax
    .endm

    movz:
    movzb   %al,%ax
     movzb   (%eax),%ax
     movzb   %al,%eax
        movzb   (%eax),%eax
    .ifdef test_3
        movzb33 %al,%rax
        movzb   (%rax),%rax
.endif

命令as -o dump.o movz

在这段代码中,我想用汇编语言测试ifdef,所以我定义了宏test_3.

In this code I want to test ifdef in assembly language so I have defined macro test_3.

据我了解,它应该打印消息 Error: no such instruction: 'movzb33 %al,%rax'当我使用汇编程序但它不在内部ifdef时,这是什么问题?

According to my understanding it should print message Error: no such instruction: 'movzb33 %al,%rax' when I use assembler but it is not going inside ifdef so what is the problem?

推荐答案

.ifdef检查是否定义了符号,它不测试宏.在GNU AS和许多其他汇编程序宏中,只能在允许使用指令的地方使用.

.ifdef checks if a symbol is defined, it does not test macros. In GNU AS and many other assemblers macros can only be used where an instruction is permitted.

这篇关于在气体汇编语言中使用ifdef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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