Open esolera opened 6 years ago
You probably have different C libraries. Unless you've passed "--enable-multilib" to riscv-gnu-toolchain's configure then you'll end up with a non-multilib GCC, which will just always use a single C library. Since the C library is built as part of the toolchain, it doesn't respect any of the flags you pass the compiler. If you want to be able to change the C library on the fly you need to use a multilib toolcain. There's some blog posts on how this works
https://www.sifive.com/blog/2017/08/14/all-aboard-part-1-compiler-args/ https://www.sifive.com/blog/2017/09/18/all-aboard-part-5-risc-v-multilib/
I build rv32im toolchain with the "build-rv32ima" script , changing the target compiler --with-arch=rv32im. Later I compile the program with "riscv32-unknown-elf-gcc -march=rv32i" and I measure the program size with "riscv32-unknown-elf-size" and my program size is 6168 Bytes.
Later I build rv32imc toolchain with the "build-rv32ima" script, changing the target compiler --with-arch=rv32imc. Later I compile the program with "riscv32-unknown-elf-gcc -march=rv32i" and I measure the program size with "riscv32-unknown-elf-size" and my program size is 5168 Bytes.
Why do two differents toolchains compile differents size by the same target isa rv32i?.