0

I tried gcc -S Source.c but I must edit produced assembly file Source.s. How should I edit it to work on Spim?

  • I assume you're using the gcc MIPS cross compiler (so you're not emitting x86 assembly), correct? Then `gcc -S` is definitely a good start. And yes, you'll then need to hand-edit the code for SPIM: https://stackoverflow.com/a/3231839/421195. See also: https://stackoverflow.com/q/4175450/421195 – paulsm4 Apr 04 '21 at 03:47
  • Yes, exactly. I tried gcc -S but I do not know how can I edit this produced assembly code for Spim, produced assembly file has too many differences from MIPS. – seydanurdemir Apr 04 '21 at 04:07
  • "gcc" can emit assembly code for many different architectures. If you're on a PC, the default architecture is Intel x86/i386. It sounds like that's what's happening here. If so, you can easily download a gcc "cross compiler" for MIPS. This will generate MIPS assembly. It will be *CLOSE* to what you need for SPIM ... but even so, you'll still have to hand-edit the GCC/MIPS assembly code. Please refer to the links I cited for getting a copy of the gcc MIPS cross compiler. – paulsm4 Apr 04 '21 at 19:15
  • Yes I got it, actually I hope to find any other solution, may be any command line argument or any environment for this, but seems there is no solution this way, may I should look for cross compilers. Thank for your reply. – seydanurdemir Apr 04 '21 at 23:28

1 Answers1

0

There isn't any official C to MIPS Assembly compiler but if you insist then give this github a try

LazerDance
  • 93
  • 7