5

I am trying to compile a file of C code into mips assembly. My OS is suse linux and I already have gcc and cross-mips-binutils installed - I simply don't know what commands to use to cross-compile into mips.

I already used:

gcc -S text.c -o text.s

and it compiled fine - just not into mips. I also looked through other posts here on stack overflow like: How to cross-compile for MIPS? but either they are not helpful or like this one, the helpful links don't work anymore.

I would appreciate any help! Thanks :)

ec-m
  • 779
  • 1
  • 5
  • 15
  • Make sure you have the mips gcc cross-compiler and that you actually invoke that. Just having the binutils is not going to be enough. – Jester May 13 '14 at 17:40
  • 1
    If you just want to see Mips assembly produced by a C or C++ source program, you can use my online demo: http://ellcc.org/blog/?page_id=340 Select the target processor under "Output Options." – Richard Pennington May 14 '14 at 11:21

1 Answers1

3

cross-mips-binutils is not sufficient for compilation, only linking, creating archives, etc. You need cross-mips-gcc in order to generate MIPS assembly.

Brian Cain
  • 14,403
  • 3
  • 50
  • 88
  • 1
    ... and you need to actually call the proper compiler binary, i.e. not the system's default `gcc`, which is probably building for the host system. – unwind May 13 '14 at 18:27