Can't Compile for MIPS or ATOM with gcc

270 views Asked by At

Using the following commands, I am trying to compile to assembly, in different ISAs

gcc -S -march=atom -o mainAtom.s main.c

But This still generates a x86 assembly format.

gcc -S -march=mips32 -o mainMIPS.s main.c

But i get the following error.

main.c:1:0: error: bad value (mips32) for -march= switch
void f() {
^

How can I solve this?

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609

1

There are 1 answers

0
yugr On BEST ANSWER

By design every version of GCC can only compile code for a single target. To compile MIPS, you need to install MIPS cross-toolchain (see How to cross-compile for MIPS?).