public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-11367] Darwin: Partial reversion of r14-3648 (Inits Section). Date: Thu, 25 Apr 2024 19:21:23 +0000 (GMT) [thread overview] Message-ID: <20240425192123.5A9483858C66@sourceware.org> (raw) https://gcc.gnu.org/g:960ca4144ebb61d125f28fab17b57cd3b09b49fd commit r11-11367-g960ca4144ebb61d125f28fab17b57cd3b09b49fd Author: Iain Sandoe <iain@sandoe.co.uk> Date: Sun Sep 10 14:48:42 2023 +0100 Darwin: Partial reversion of r14-3648 (Inits Section). Although the Darwin ABI places both hot and cold partitions in the same section (the linker can partition by name), this does not work with the current dwarf2out implementation. Since we do see global initialization code getting hot/cold splits, this patch places the cold parts into text_cold, and keeps the hot part in the correct Init section per ABI. TODO: figure out a way to allow us to match the ABI fully. gcc/ChangeLog: * config/darwin.c (darwin_function_section): Place unlikely executed global init code into the standard cold section. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 5b33b364652866165431aef1810af1e890229c5e) Diff: --- gcc/config/darwin.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index a3a7c509e36..db0e80889ab 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -3848,19 +3848,22 @@ darwin_function_section (tree decl, enum node_frequency freq, if (decl && DECL_SECTION_NAME (decl) != NULL) return get_named_section (decl, NULL, 0); + /* We always put unlikely executed stuff in the cold section; we have to put + this ahead of the global init section, since partitioning within a section + breaks some assumptions made in the DWARF handling. */ + if (freq == NODE_FREQUENCY_UNLIKELY_EXECUTED) + return (use_coal) ? darwin_sections[text_cold_coal_section] + : darwin_sections[text_cold_section]; + /* Intercept functions in global init; these are placed in separate sections. - FIXME: there should be some neater way to do this. */ + FIXME: there should be some neater way to do this, FIXME we should be able + to partition within a section. */ if (DECL_NAME (decl) && (strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "_GLOBAL__sub_I", 14) == 0 || strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "__static_initialization_and_destruction", 39) == 0)) return darwin_sections[static_init_section]; - /* We always put unlikely executed stuff in the cold section. */ - if (freq == NODE_FREQUENCY_UNLIKELY_EXECUTED) - return (use_coal) ? darwin_sections[text_cold_coal_section] - : darwin_sections[text_cold_section]; - /* If we have LTO *and* feedback information, then let LTO handle the function ordering, it makes a better job (for normal, hot, startup and exit - hence the bailout for cold above). */
reply other threads:[~2024-04-25 19:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240425192123.5A9483858C66@sourceware.org \ --to=iains@gcc.gnu.org \ --cc=gcc-cvs@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).