Get 32bit instructions from comilation


I am compiling a riscv C code andas output, i want to get purly 32bit instructions, not compressed to 16bits. Is it possible to set a parameter for compiler, or is there some other solution?

(Jim Wilson) #2

Choose an architecture without the C (compressed) extension. For instance, if you are currently compiling for rv64gc, then compile for -march=rv64g instead.

Note that this only affects what the compiler does with C code. It doesn’t affect precompiled libraries that you may be linking with. To get libraries without compressed instructions, you might need to configure and build a toolchain from scratch to default for an architecture without the compressed extension. If you have a multilib enabled toolchain, then there will be some arch targets without the compressed extension pre-built, but not a complete set of them. You can see the set with the gcc option --print-multi-lib.