https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95095
--- Comment #5 from Fangrui Song <i at maskray dot me> ---
Linux kernel
include/asm-generic/vmlinux.lds.h currently has
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
*(.text.hot .text.hot.*) \
*(TEXT_MAIN .text.fixup) \
*(.text.unlikely .text.unlikely.*) \
*(.text.unknown .text.unknown.*) \
NOINSTR_TEXT \
*(.text..refcount) \
*(.ref.text) \
MEM_KEEP(init.text*) \
MEM_KEEP(exit.text*) \
If you change .text.* to .text%* , this script will need a change, along with
other projects which use or adapt GNU ld's built-in linker script
.text :
{
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(SORT(.text.sorted.*))
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf.em. */
*(.gnu.warning)
}
By default, -fno-unique-section-names produces '.text' instead of '.text.foo'
in the normal -ffunction-sections case.
For PGO, -fno-unique-section-names produces '.text.hot.' instead of
'.text.hot.foo' in the normal -ffunction-sections case.
'.text.hot.' is an attempt to distinguish PGO caused 'hot' from a regular
functions named 'hot'.