putting __glibcxx_assert_fail into debug.cc bloats binary size by introducing all the dead code with debug.cc

Jonathan Wakely jwakely.gcc@gmail.com
Thu Nov 18 09:51:47 GMT 2021


On Thu, 18 Nov 2021 at 09:44, Jonathan Wakely wrote:
>
> On Thu, 18 Nov 2021 at 09:12, unlvsur unlvsur wrote:
> > -O3. Removal of unused functions require additional non-standard often-unused compiler (-fdata-sections -ffunction-sections -Os) and linker (-Wl,--gc-sections) optimization flags.
>
> I asked why one of those flags doesn't help, and all you've done is
> quote something that says you need to use those flags. You realise
> that's not an answer, right?
>
> Libstdc++ is built with -fdata-sections -ffunction-sections -O2 and
> linked with -Wl,--gc-sections
>
> So why doesn't it help?

I guess the problem is that users need to link their own code with
-Wl,--gc-sections to get the benefit. But then if you care about the
size of the result, you should be doing that.


More information about the Libstdc++ mailing list