Hi all,

I am a newbie to gnu gcc , i am trying to write a c code then assemble it to give me assembly program with 32i bit instructions…and also to give me compressed 16 bit instructions.

I have no idea which option will help me to do that …


Using “-march=rv32ic -mabi=ilp32” will give you rv32i instructions including compressed instructions, and the 32-bit soft-float ABI. Using “-S” will generate a .s assembly language text file that you can look at. Compressed instructions are generated at assembly time. To see the compressed instructions, compile with -c to generate a .o file, and then “objdump -dr .o” to see the instructions and relocations.

Palmer Dabbelt has a blog series that discusses a lot of RISC-V compiler issues which you might want to read.

Thanks a lot… i will give it a try

Depending on the options you choose it might try to find that specific multilib. So if you will go wild, your compiler might not have that multilib present and use the default 64bit one. So if you will get strange errors target emulation 'elf64-littleriscv' does not match 'elf32-littleriscv' then it could mean you selected combination of features that your compiler does not have included the specific multilib.