Discussion:
What is text.hot section in elf files ?
Sandeep Kumar
2006-02-06 07:26:56 UTC
Permalink
Hello everyone,
While scrolling down the objdump of the code for /usr/bin/gcc, There
is a section called text.hot section, which is normally not present on
the elf files. What is that? is it something specific to /usr/bin/gcc
only.How can be create such sections in our normal executables ?


--
Regards,
Sandeep





A man with one watch knows what time it is; a man with two watches is
never quite sure.
Ravi Ramaseshan
2006-02-06 07:47:53 UTC
Permalink
Hi,
Post by Sandeep Kumar
Hello everyone,
While scrolling down the objdump of the code for /usr/bin/gcc, There
is a section called text.hot section, which is normally not present on
the elf files. What is that? is it something specific to /usr/bin/gcc
only.How can be create such sections in our normal executables ?
Seems to be something that gcc generates. Read below:

<snip http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/Optimize-Options.html>

-freorder-functions
Reorder basic blocks in the compiled function in order to reduce
number of taken branches and improve code locality. This is
implemented by using special subsections text.hot for most frequently
executed functions and text.unlikely for unlikely executed functions.
Reordering is done by the linker so object file format must support
named sections and linker must place them in a reasonable way.

Also profile feedback must be available in to make this option
effective. See -fprofile-arcs for details.

Enabled at levels -O2, -O3, -Os

</snip>

Cheers,
--
Ravi Ramaseshan
http://www.geocities.com/ramaseshan_ravi/

" Reality is only something we believe in strongly. "

Loading...