Skip to content

Using picolibc with libstdc++_nano.a #860

@Damian-Nordic

Description

@Damian-Nordic

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, 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions