If I use register names I get:
如果我使用寄存器名称,我得到:
Error: illegal operands `add $t0,$zero,$zero'
If I use register number ($8
instead of $t0
and $0
instead of $zero
) it works. (I'm using binutils 2.17).
如果我使用寄存器编号($ 8而不是$ t0和$ 0而不是$ 0)它可以工作。 (我正在使用binutils 2.17)。
1 个解决方案
#1
The GNU assembler doesn't support symbolic register names directly. A common approach, if using gcc to drive the assembler, is to use the ".S" extension for the assembler source file (which tells gcc to pass the source through the C preprocessor before the assembler) and #include a header file containing definitions like:
GNU汇编程序不直接支持符号寄存器名称。如果使用gcc来驱动汇编程序,一种常见的方法是使用汇编源文件的“.S”扩展名(告诉gcc在汇编程序之前通过C预处理程序传递源代码)和#include包含定义的头文件喜欢:
#define zero $0
#define v0 $2
#define v1 $3
Then the assembler source can have statements like
然后汇编源可以有类似的语句
add v0, zero, zero
#1
The GNU assembler doesn't support symbolic register names directly. A common approach, if using gcc to drive the assembler, is to use the ".S" extension for the assembler source file (which tells gcc to pass the source through the C preprocessor before the assembler) and #include a header file containing definitions like:
GNU汇编程序不直接支持符号寄存器名称。如果使用gcc来驱动汇编程序,一种常见的方法是使用汇编源文件的“.S”扩展名(告诉gcc在汇编程序之前通过C预处理程序传递源代码)和#include包含定义的头文件喜欢:
#define zero $0
#define v0 $2
#define v1 $3
Then the assembler source can have statements like
然后汇编源可以有类似的语句
add v0, zero, zero