Linker support for -freorder-functions?
H. J. Lu
hjl@lucon.org
Thu Aug 5 21:23:00 GMT 2004
This patch
http://gcc.gnu.org/ml/gcc-patches/2002-05/msg00973.html
added
`-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.
But it is useless without linker support. Should linker group
text.hot/text.unlikely like
*(.text.hot)
*(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
KEEP (*(.text.*personality*))
*(.text.unlikely)
Also, should section names be .text.hot/.text.unlikely instead of
text.hot/text.unlikely?
H.J.
More information about the Gcc
mailing list