GNU 作为 .macro 占位符紧跟字符

GNU as .macro placeholder immediately followed by character

在 GNU 汇编器中,我定义了一个这样的宏。

.macro test_cond condition, index
    STR\conditionB r4, [r6, #\index*17]
.endm

test_cond EQ, 0

它应该扩展到

STREQB r4, [r6, #0*17]

相反,它失败了

bad instruction `streq\conditionB r4,[r6,#0*17]'

有没有办法让宏中的占位符紧跟一个字符?

使用\()结构将宏参数与其后面的字符分开:

.macro test_cond condition, index
    STR\condition\()B r4, [r6, #\index*17]
.endm