Hi, This patch adds a new linker plugin to re-order functions. The plugin constructs an annotated callgraph with edge profile information and then repeatedly groups sections that are connected by hot edges and passes the new function layout to the linker. The grouping is done similar to the Pettis Hansen code ordering scheme.
How to use the plugin: During Profile use build stage of Feedback-directed builds, use the flags: -fcallgraph-profiles-sections -Wl,--plugin,<gcc_install_dir>/libexec/gcc/x86_64-unknown-linux-gnu/4.6.x-google/libfunction_reordering_plugin.so The first flag generates special .note.callgraph.text sections which contain the callgraph profiles that are read by the plugin and an new function layout is generated. The ordering of sections is dumped in file final_layout.txt. The plugin itself is implemented in the three files: function_ordering_plugin.cc, callgraph.cc, and callgraph.h. The file include/plugin-api.h has changes which has already been submitted to trunk. The rest is related to Makefiles and configure scripts to build and install the plugin. Please find the patch here: http://codereview.appspot.com/4802070/ Thanks, -Sriraman.