You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to switch a bunch of C++ applications from newlibc nano to picolibc but I noticed it resulted in ~4 kB flash usage growth. I realized it was because nano.specs replaces -lstdc++ flag with -lstdc++_nano, while picolibc.specs does not. The full libstdc++ contains a lot of code for handling exceptions and stack unwinding, which is often not needed in embedded applications.
I forced the build system to use -lstdc++_nano by adding set_linker_property(PROPERTY c++_library "-lstdc++_nano") in CMakeLists, and the flash usage dropped by ~10kB.
Would it make sense to default to lstdc++_nano when linking with picolibc or at least support the nano variant to be used by applications that disable C++ exceptions?
The text was updated successfully, but these errors were encountered:
@keith-packard would you be able to help with re-building process? Is this something we can plan for next releases of the Zephyr toolchain?
It's pretty easy to adapt crosstool-ng to build another version of any library; it would be great if you'd dig in and take a look; I'd be happy to provide some guidance.
Hi,
I wanted to switch a bunch of C++ applications from newlibc nano to picolibc but I noticed it resulted in ~4 kB flash usage growth. I realized it was because
nano.specs
replaces-lstdc++
flag with-lstdc++_nano
, whilepicolibc.specs
does not. The fulllibstdc++
contains a lot of code for handling exceptions and stack unwinding, which is often not needed in embedded applications.I forced the build system to use
-lstdc++_nano
by addingset_linker_property(PROPERTY c++_library "-lstdc++_nano")
in CMakeLists, and the flash usage dropped by ~10kB.Would it make sense to default to
lstdc++_nano
when linking with picolibc or at least support the nano variant to be used by applications that disable C++ exceptions?The text was updated successfully, but these errors were encountered: