This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I am working on a linker plugin to use callgraph edge profiles generated by GCC to guide function layout in the linker. The compiler passes the callgraph edge profile values to the linker via special .note sections, I am working on a GCC patch to do this. The linker plugin reads the .note sections and constructs an annotated callgraph with the edge profiles. It then uses the Pettis-Hansen algorithm, "Profile-guided Code Positioning, PLDI 1990, K. Pettis, and R.C. Hansen.", to determine the order of functions in the final layout. In order for my plugin to do the above, I need the interfaces to read section contents & attributes and reorder them. I have attached a patch for review that adds these interfaces to the GOLD plugin infrastructure. I have also made appropriate changes to allow section ordering from a plugin. * layout.cc (Layout::Layout): Initialize section_ordering_specified_, input_section_position_, and input_section_glob_. (Layout::update_layout_of_sections): New function. (read_layout_from_file): Add parameter filename and call function section_ordering_specified. * layout.h (is_section_ordering_specified): New function. (section_ordering_specified): New function. (read_layout_from_file): Add parameter filename. (update_layout_of_sections): New function. (section_ordering_specified_): New boolean member. * main.cc(main): Call load_plugins after layout object is defined. Call read_layout_from_file when section ordering is specified. * output.cc (Output_section::add_input_section): Use function section_ordering_specified to check if section ordering is needed. (Output_section::update_section_layout): New function. (Output_section::sort_attached_input_sections): Check if input section must be reordered. * plugin.cc (get_object_handle): New function. (get_section_count): New function. (get_section_type): New function. (get_section_name): New function. (get_section_contents): New function. (read_layout_from_file): New function. (allow_section_ordering): New function. (Plugin::load): Add the new interfaces to the transfer vector. (Plugin_manager::load_plugins): New parameter. * plugin.h (input_objects): New function. (layout): New function. * plugin_test.c (get_object_handle): New function pointer. (get_section_count): New function pointer. (get_section_type): New function pointer. (get_section_name): New function pointer. (get_section_contents): New function pointer. (read_layout_from_file): New function pointer. (allow_section_ordering): New function pointer. (onload): Check if the new interfaces exist. Thanks, -Sri.
Attachment:
gold_patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |