-
Notifications
You must be signed in to change notification settings - Fork 157
Using picolibc with libstdc++_nano.a #860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Good idea. We'll have to re-build libstdc++ to use the picolibc ABI though; libstdc++_nano is built against newlib-nano, which has a different ABI. |
This looks like a pretty nice optimization! @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: