Use of ifdef in gas assembly language

怎甘沉沦 提交于 2019-12-12 05:38:58

问题


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

command as -o dump.o movz

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

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?


回答1:


.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.



来源:https://stackoverflow.com/questions/46272497/use-of-ifdef-in-gas-assembly-language

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!