I am attempting to forge my own path in setting up a build environment for WCH CH32V003 RISC-V chips - that is, not using WCH's MounRiver or anything that comes with it. What I am using is the
xPack RISC-V GCC distribution for Windows (specifically, xpack-riscv-none-elf-gcc-12.2.0).
But, I've hit a bit of a roadblock.

When attempting to compile some code that does integer multiplication (e.g. something as simple as
a = b * c), I'm getting a linking error:
ld.exe: error: ../lib/gcc/riscv-none-elf/12.2.0\libgcc.a(muldi3.o): mis-matched ISA string to merge 'i' and 'e'
ld.exe: failed to merge target specific data of file ../lib/gcc/riscv-none-elf/12.2.0\libgcc.a(muldi3.o)
What I'm wondering is, because the error message mentions "mis-matched ISA", is there somehow a mis-match in the architecture of my code and that of the libgcc it's trying to link? That is, GCC is using the
wrong libgcc? If I go digging in the folder path that it gives for libgcc.a, I notice that particular library file seems to be a 'generic' one, and not one of the architecture-specific versions (e.g. 'rv32e', 'rv32i', etc.) residing in sub-folders. What also is of note is that there
isn't one in existence for the architecture I'm specifying when compiling. So, is that why it's falling back to a 'generic' library?
The command line options I'm compiling with are:
riscv-none-elf-gcc.exe -mabi=ilp32e -march=rv32ec_zicsr -msave-restore -misa-spec=2.2 -fdata-sections -ffunction-sections -fsigned-char -g -c main.c -o obj\Debug\main.o
As mentioned above, there isn't a libgcc for 'rv32ec_zicsr', but there is one for 'rv32ec'. What will changing to the latter affect? What am I gaining or losing with or without the Zicsr (Control and Status Register) extension?
Also, on a related note, the QingKeV2 CPU manual from WCH says that it also features the 'XW' extension, but that appears to be non-standard. I'm guessing that's only available with the version of GCC they bundle with the MounRiver IDE? Seems like it just provides some extra 'compressed' versions of some instructions ("c.lbu/c.lhu/c.sb/c.sh/c.lbusp/c.lhusp/c.sbsp/c.shsp"), so the only impact would be on code size, right?