]> git.ipfire.org Git - thirdparty/gcc.git/commit
Darwin: Place global inits in the correct section.
authorIain Sandoe <iain@sandoe.co.uk>
Fri, 1 Sep 2023 08:04:13 +0000 (09:04 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 31 Mar 2024 08:58:43 +0000 (09:58 +0100)
commitbe95ee81bc934d6b22e5639eb7b5f9603fa1443d
treee5bfa098bbfc46e372891e8a66b90b9b51bbcc4a
parent3449ce05f7cf5b84a866c2a1969285fdece6e5e9
Darwin: Place global inits in the correct section.

This handles placement of global initializers into __TEXT,__StaticInit as used
by other platform toolchains.

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.

This includes the update from 5b33b364652866165431aef1810af1e890229c5e.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin-sections.def (static_init_section): Add the
__TEXT,__StaticInit section.
* config/darwin.cc (darwin_function_section): Use the static init
section for global initializers, to match other platform toolchains.
Place unlikely executed global init code into the standard cold
section.

(cherry picked from commit 68dc3e94fd6bd395a8b343533485616dff3fc796)
gcc/config/darwin-sections.def
gcc/config/darwin.cc