This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] New fixes for hot/cold partitioning
>>>>> Caroline Tice writes:
> I'm not sure this belongs in the function struct. This will only be
> function-specific if the compiler was passed the function-sections
> flag. Otherwise it will be the same across all functions. This is
> the name for the cold section just like ".text" is the name for the
> hot text section, which doesn't vary across functions unless we are
> doing function-sections.
GCC normally does not use a default section "name" unless hot-cold
partitioning is enabled. GCC requires a TEXT_SECTION_ASM_OP, but there is
no actual string "name" by default.
A lot of the recent problems and my concern about the current
design is that hot-cold partitioning has introduced this "name" concept
instead of expanding on TEXT_SECTION_ASM_OP with HOT_TEXT_SECTION_ASM_OP
and UNLIKELY_SECTION_ASM_OP. The latter two could default to the value of
TEXT_SECTION_ASM_OP and everything should work, unless the target has
problems with extra, unnecessary section changes.
The section name really is "text" and it is up to the target file
format, assembly syntax, and other conventions whether the name should be
mangled or have any other decoration like prepended period, etc.
If you want to create unique names or prepend/append _unlikely or
.unlikely_section, that is slightly dangerous because you are making
assumptions about the target format -- specifically what characters are
valid. But what is really dangerous is assuming that the name *itself*
should have decoration like a prepended period. The name is
"text_unlikely" or "foo.unlikely_section"; it is up to the target to emit
that as a valid section name, which may have a prepended period by
convention or required.
David