mkst / maspsx

MIT License
5 stars 4 forks source link

Translate old GCC's `-mcpu=` argument to `-mtune=` #81

Closed abelbriggs1 closed 4 months ago

abelbriggs1 commented 4 months ago

Old versions of MIPS GCC accept the -mcpu argument to determine which MIPS CPU to tune the scheduler for. However, modern versions of GAS do not accept -mcpu for MIPS targets - instead, they use -mtune.

If GCC's driver (gcc) is invoked to compile code and modern GAS is the assembler, passing -mcpu to the compilation will result in a GAS error:

Compiler error: Compiler did not create an object file: mips-linux-gnu-as: unrecognized option '-mcpu=r6000'

This can be worked around in a local decompilation by only invoking cc1 and piping its output to MASPSX/GAS. However, since it's extremely common to use old GCC with newer GAS in decompilations, it would be nice if MASPSX could translate -mcpu to -mtune.

As far as I can see, all potential MIPS -mcpu parameters in old GCC are accepted for -mtune in modern GAS - the base argument just needs to be changed.