--- Comment #14 from Jakub Jelinek <jakub at gcc dot> ---
     In addition to reordering basic blocks in the compiled function, in
     order to reduce number of taken branches, partitions hot and cold
     basic blocks into separate sections of the assembly and '.o' files,
     to improve paging and cache locality performance.
is what we say about -freorder-blocks-and-partition in the documentation, when
functions are normally placed in .text section rather than anything different,
the cold basic blocks go into .text.cold subsection and the linker merges all
those cold subsections from all objects into one part of the resulting .text
section, so unlikely used code from all the functions is adjacent and hot code
from all of them elsewhere too.  The cold partition could end up either below
or above the hot partition, it is purely up to the linker to decide that.
As written above, the real entrypoint to the function can be found in DWARF by
checking DW_AT_entry_pc if it exists, or if it doesn't, as the base address of
the function which is the lowest address of the first range if it has
DW_AT_ranges, or if it has DW_AT_{low,high}_pc as the DW_AT_low_pc.

Reply via email to