Error: unrecognized opcode `mul a0,t4,t5', extension `m' or `zmmul' required

659 views Asked by At

I'm trying to compile RISC-V assembly code to object file. I've built riscv-gnu-toolchain, selecting newlib, architecture rv32imac and abi ilp32.

However, when I try to compile assembly code with command: riscv32-unknown-elf-as -march=rv32imac -mabi=ilp32 main.s -o main.o, I'm getting: Error: unrecognized opcode 'mul a0,t4,t5', extension 'm' or 'zmmul' required.

I don't really understand, why I'm getting this. In both cases (building the toolchain and compiling the code) I specified m extension, but it looks like riscv32-unknown-elf-as doesn't detect it.

Do you know, what am I doing wrong and how can I fix it? Thanks!

EDIT:

I solved the problem: in source code I had the line .attribute 5, "rv32i2p0" that was overriding -march option from command line. I changed it to .attribute 5, "rv32imac" and fixed the problem.

0

There are 0 answers