aboutsummaryrefslogtreecommitdiff
path: root/gold/gold.cc
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2012-08-24 18:35:35 +0000
committerSriraman Tallam <tmsriram@google.com>2012-08-24 18:35:35 +0000
commit16164a6b00372ebc0360f6aa71337e5613278817 (patch)
tree503893149fa2b29775eafe985a0a537cf7433132 /gold/gold.cc
parent92a289b3800274d15d440cea98c0df067da4c2ec (diff)
downloadgdb-16164a6b00372ebc0360f6aa71337e5613278817.zip
gdb-16164a6b00372ebc0360f6aa71337e5613278817.tar.gz
gdb-16164a6b00372ebc0360f6aa71337e5613278817.tar.bz2
Patch adds support to allow plugins to map selected subset of sections to unique
segments. 2012-08-24 Sriraman Tallam <tmsriram@google.com> * gold.cc (queue_middle_tasks): Call layout again when unique segments for sections is desired. * layout.cc (Layout::Layout): Initialize new members. (Layout::get_output_section_flags): New function. (Layout::choose_output_section): Call get_output_section_flags. (Layout::layout): Make output section for mapping to a unique segment. (Layout::insert_section_segment_map): New function. (Layout::attach_allocated_section_to_segment): Make unique segment for output sections marked so. (Layout::segment_precedes): Check for unique segments when sorting. * layout.h (Layout::Unique_segment_info): New struct. (Layout::Section_segment_map): New typedef. (Layout::insert_section_segment_map): New function. (Layout::get_output_section_flags): New function. (Layout::is_unique_segment_for_sections_specified): New function. (Layout::set_unique_segment_for_sections_specified): New function. (Layout::unique_segment_for_sections_specified_): New member. (Layout::section_segment_map_): New member. * object.cc (Sized_relobj_file<size, big_endian>::do_layout): Rename is_gc_pass_one to is_pass_one. Rename is_gc_pass_two to is_pass_two. Rename is_gc_or_icf to is_two_pass. Check for which pass based on whether symbols data is present. Make it two pass when unique segments for sections is desired. * output.cc (Output_section::Output_section): Initialize new members. * output.h (Output_section::is_unique_segment): New function. (Output_section::set_is_unique_segment): New function. (Output_section::is_unique_segment_): New member. (Output_section::extra_segment_flags): New function. (Output_section::set_extra_segment_flags): New function. (Output_section::extra_segment_flags_): New member. (Output_section::segment_alignment): New function. (Output_section::set_segment_alignment): New function. (Output_section::segment_alignment_): New member. (Output_segment::Output_segment): Initialize is_unique_segment_. (Output_segment::is_unique_segment): New function. (Output_segment::set_is_unique_segment): New function. (Output_segment::is_unique_segment_): New member. * plugin.cc (allow_unique_segment_for_sections): New function. (unique_segment_for_sections): New function. (Plugin::load): Add new functions to transfer vector. * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output. * Makefile.in: Regenerate. * testsuite/plugin_final_layout.sh: Check if unique segment functionality works. * testsuite/plugin_section_order.c (onload): Check if new interfaces are available. (allow_unique_segment_for_sections): New global. (unique_segment_for_sections): New global. (claim_file_hook): Call allow_unique_segment_for_sections. (all_symbols_read_hook): Call unique_segment_for_sections. 2012-08-24 Sriraman Tallam <tmsriram@google.com> * plugin-api.h (ld_plugin_allow_unique_segment_for_sections): New interface. (ld_plugin_unique_segment_for_sections): New interface. (LDPT_ALLOW_UNIQUE_SEGMENT_FOR_SECTIONS): New enum val. (LDPT_UNIQUE_SEGMENT_FOR_SECTIONS): New enum val. (tv_allow_unique_segment_for_sections): New member. (tv_unique_segment_for_sections): New member.
Diffstat (limited to 'gold/gold.cc')
-rw-r--r--gold/gold.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gold/gold.cc b/gold/gold.cc
index dddf5ad..1b4badc 100644
--- a/gold/gold.cc
+++ b/gold/gold.cc
@@ -530,11 +530,13 @@ queue_middle_tasks(const General_options& options,
// Call Object::layout for the second time to determine the
// output_sections for all referenced input sections. When
- // --gc-sections or --icf is turned on, Object::layout is
- // called twice. It is called the first time when the
- // symbols are added.
+ // --gc-sections or --icf is turned on, or when certain input
+ // sections have to be mapped to unique segments, Object::layout
+ // is called twice. It is called the first time when symbols
+ // are added.
if (parameters->options().gc_sections()
- || parameters->options().icf_enabled())
+ || parameters->options().icf_enabled()
+ || layout->is_unique_segment_for_sections_specified())
{
for (Input_objects::Relobj_iterator p = input_objects->relobj_begin();
p != input_objects->relobj_end();