1

我正在尝试在虚拟机中编译 MIPS32 代码。程序的其余部分是用 C 代码完成的。这里有问题的代码:

"# include "ordenamiento.h"

"# a0 is the pointer to char **, a1 is the start (int), a2 is the end (int)
.overall stoogeSort

.Set noreorder

.cpload $t9

.September reorder

.cprestore

.ent stoogeSort

"#arming the stack
stoogeSort: 
addiu $ sp, -32 

sw $ fp, 28 ($ sp) 
$ sw gp, 24 ($ sp) 
move $ fp, $ sp 
sw $ a0, 32 ($ sp)
sw $ a1, 36 ($ sp) 
sw $ a2, 40 ($ sp) 
b CMP 
FinComp: bgt $ t0, $ zero, noswap 
Swap: addu $ t2, $ a0, $ a1 
----
----
----
. stoogeSort end

问题是当编译如下 gcc-c-O0 stoogeSort.S 给我以下错误:

stooge.s: 1: Warning: line numbers must be positive, line number 0 rejected
stooge.s: 9: Error: illegal operands `sw $ a0, 32 ($ sp) '
stooge.s: 10: Error: illegal operands `sw $ a1, 36 ($ sp) '
stooge.s: 11: Error: illegal operands `sw $ a2, 40 ($ sp) '
stooge.s: 12: Error: unrecognized opcode `ba CMP '
stooge.s: 13: Error: illegal operands `bgt $ t0, $ zero, noswap '
stooge.s: 14: Error: illegal operands `addu $ t2, $ a0, $ a1 '
stooge.s: 15: Error: illegal operands `addu $ t3, $ a0, $ a2 '

我究竟做错了什么?为什么我会收到这些错误?

4

1 回答 1

0

既然您已经得到了问题的答案,最好将其发布在这里,以便对遇到同样问题的人有所帮助。

我在这里为您发布答案。

问题是失踪"# include <mips/regdef.h>"

于 2012-12-06T06:56:40.143 回答