问题
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