This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Linker support for -freorder-functions?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Cc: gcc at gcc dot gnu dot org, jh at suse dot cz
- Date: Thu, 5 Aug 2004 13:58:57 -0700
- Subject: Linker support for -freorder-functions?
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.