public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dumoulin.thibaut at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/68606] Reduce or disable the static emergency pool for C++ exceptions Date: Wed, 28 Sep 2022 14:42:42 +0000 [thread overview] Message-ID: <bug-68606-4-VAWoiptm5F@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-68606-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68606 --- Comment #12 from Thibaut M. <dumoulin.thibaut at gmail dot com> --- Thank you for the updated link! The problem with the original code is that it malloc unconditionally at least 2.4ko on the heap. This cannot be avoided when liking with libstdc++. This malloc is done very early, when initializing `.init_array` section (in ResetHandler on an ARM Cortex M for example). As 2.4ko is a lot for some embedded systems, it would be nice to avoid this behavior. Also, even if this code is never used in your project, none of the symbols in eh_malloc.cc are called; the constructor of the global variable `pool emergency_pool;` calls a non-pure functions, compiler cannot get rid of this function. If you do not use this code in your project, it will cost you, unconditionally, 2.4ko of heap. This is the problem. This patch https://gcc.gnu.org/legacy-ml/gcc-patches/2016-12/msg01158.html seems a nice solution, it allocates a static buffer and if nobody is using it, it can be stripped by the linker.
next prev parent reply other threads:[~2022-09-28 14:42 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-68606-4@http.gcc.gnu.org/bugzilla/> 2020-05-23 15:45 ` egallager at gcc dot gnu.org 2022-09-28 7:00 ` dumoulin.thibaut at gmail dot com 2022-09-28 14:01 ` rdiezmail-gcc at yahoo dot de 2022-09-28 14:42 ` dumoulin.thibaut at gmail dot com [this message] 2022-09-28 15:14 ` rdiezmail-gcc at yahoo dot de 2022-09-28 20:20 ` redi at gcc dot gnu.org 2022-09-28 20:24 ` redi at gcc dot gnu.org 2022-09-29 7:02 ` rguenth at gcc dot gnu.org 2022-09-29 9:31 ` redi at gcc dot gnu.org 2022-09-29 12:24 ` dumoulin.thibaut at gmail dot com 2022-09-29 13:01 ` redi at gcc dot gnu.org 2022-10-07 15:55 ` redi at gcc dot gnu.org 2022-10-11 15:22 ` cvs-commit at gcc dot gnu.org 2022-10-11 15:25 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-68606-4-VAWoiptm5F@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).