Skip to main content
JGurley
Associate
July 31, 2025
Question

Build GNU Tools for STM32 12.3.rel1

  • July 31, 2025
  • 1 reply
  • 247 views

Hello :)

I am wondering if there is a "how to" for how to build the stdlibc++ library for STM32 gcc tools.  I am in need of a stripped down stdlibc++ library to link with.  Can anyone point me to a link or can you walk me through it?

The reason I ask, is because my compiled binary has included things like std::__cxx11::time_get and std::time_get.  There are 8 instances of this variant each with 2.76K in size.  We are using c++ but we certainly aren't using anything related to time.  Locale is another thing we aren't using.  There are two instances of std::locale::_Impl::_Impl(unsigned it) which is 1.82K in  size as well.  

These functions appear in the binary even though we are using compiler flags -ffunction-sections -fdata-sections and linker flags -Wl,--gc-sections.

I need to get rid of the "fluff" that isn't used from libstdc++. I would like to build libstdc++ with -ffunction-sections -fdata-sections flags so the linker can remove the unused sections when it links libstdc++.  And perhaps build without locale and time since those are both build flags and are parts of the library that we don't and won't need.

1 reply

Pavel A.
Super User
August 1, 2025

Have you seen this with previous toolchain versions?