Without giving actual numbers, it’s a meaningless comparison.
If one library is bigger than the other then the difference will look extreme if your program is “hello world”. It will look much less extreme for real sized programs.
For our freedom-e-sdk example “hello” program using
puts() I get 51118 bytes for the code. If I change it to use
printf() then it’s 51066 bytes. If I change it to use
write() then it’s 51070. If I take out printing “hello world” entirely and just return 0 then the size is 51030.
If I look at the object file before linking (using
riscv32-unknown-elf-size, there is 42 bytes (28 for
main(), 13 for the string). In the linked program
main() is reduced to 22 bytes because of linker relaxations.
So clearly we’ve got some work to do on getting the library to strip better. At the moment it’s giving basically 50 KB of overhead for any program.
What should the priority be on when we put effort into that instead of into other things? What is the use-case where it actually matters?
Maybe the ARM toolchain produces a 5 KB binary for helloworld. It’s not because their code is ten times smaller – it’s because they pulled in ten times less of the library. As you look at a real program that uses more of the library, the absolute difference will get smaller. And as you get a bigger program with 50KB, 100KB, whatever of your own code, the relative difference will be much less too.
Meanwhile, the HiFive1 has 16 MB of space for the user’s program. 50 KB for library code is utterly in the noise.
How much space will the device you deploy on have?