GNU toolchain 5.4 2016q3 in use and compiling c/c++ project to M4. Compiling with --specs=nano.specs flag so Newlib nano is in use.
I am working to optimize code and looking output binary data to clean all unwanted read-only constant string out of my project. I noticed following string:"not enough space for format expansion (Please submit full bug report at http://gcc.gnu.org/bugs.html)"
Searching map file and found this string is coming from "arm-none-eabi/lib/armv7e-m/fpu\libstdc++_nano.a(snprintf_lite.o)"This is really something I don't want to be stored in any memory. Project is not having exceptions and flag -fno-exceptions is in use. String is there even compiling for size using -Os flag.
My question: Is it possible to drop that string out from flash?
Is newlib sources available somewhere?Found this: https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/c%2B%2B11/snprintf_lite.cc
There's snprintf_lite calling throw in insufficient space case which is having
const char __err[] = "not enough space for format expansion " "(Please submit full bug report at https://gcc.gnu.org/bugs/):\n ";
My compile flags might not affect to libraries so any other idea how to get rid of this?
Everything defined in newlib can be redefined in your application.
namespace __gnu_cxx { int __snprintf_lite(char *__buf, size_t __bufsize, const char *__fmt, va_list __ap) {} } // namespace __gnu_cxx
This safes 486 bytes on my machine.