aboutsummaryrefslogtreecommitdiff
path: root/gold/output.h
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/output.h
parent92a289b3800274d15d440cea98c0df067da4c2ec (diff)
downloadbinutils-16164a6b00372ebc0360f6aa71337e5613278817.zip
binutils-16164a6b00372ebc0360f6aa71337e5613278817.tar.gz
binutils-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/output.h')
-rw-r--r--gold/output.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/gold/output.h b/gold/output.h
index 9b0f87f..25a6b89 100644
--- a/gold/output.h
+++ b/gold/output.h
@@ -3265,6 +3265,28 @@ class Output_section : public Output_data
requires_postprocessing() const
{ return this->requires_postprocessing_; }
+ bool
+ is_unique_segment() const
+ { return this->is_unique_segment_; }
+
+ void
+ set_is_unique_segment()
+ { this->is_unique_segment_ = true; }
+
+ uint64_t extra_segment_flags() const
+ { return this->extra_segment_flags_; }
+
+ void
+ set_extra_segment_flags(uint64_t flags)
+ { this->extra_segment_flags_ = flags; }
+
+ uint64_t segment_alignment() const
+ { return this->segment_alignment_; }
+
+ void
+ set_segment_alignment(uint64_t align)
+ { this->segment_alignment_ = align; }
+
// If a section requires postprocessing, return the buffer to use.
unsigned char*
postprocessing_buffer() const
@@ -4216,9 +4238,17 @@ class Output_section : public Output_data
bool has_fixed_layout_ : 1;
// True if we can add patch space to this section.
bool is_patch_space_allowed_ : 1;
+ // True if this output section goes into a unique segment.
+ bool is_unique_segment_ : 1;
// For SHT_TLS sections, the offset of this section relative to the base
// of the TLS segment.
uint64_t tls_offset_;
+ // Additional segment flags, specified via linker plugin, when mapping some
+ // input sections to unique segments.
+ uint64_t extra_segment_flags_;
+ // Segment alignment specified via linker plugin, when mapping some
+ // input sections to unique segments.
+ uint64_t segment_alignment_;
// Saved checkpoint.
Checkpoint_output_section* checkpoint_;
// Fast lookup maps for merged and relaxed input sections.
@@ -4294,6 +4324,16 @@ class Output_segment
set_is_large_data_segment()
{ this->is_large_data_segment_ = true; }
+ bool
+ is_unique_segment() const
+ { return this->is_unique_segment_; }
+
+ // Mark segment as unique, happens when linker plugins request that
+ // certain input sections be mapped to unique segments.
+ void
+ set_is_unique_segment()
+ { this->is_unique_segment_ = true; }
+
// Return the maximum alignment of the Output_data.
uint64_t
maximum_alignment();
@@ -4504,6 +4544,8 @@ class Output_segment
bool are_addresses_set_ : 1;
// Whether this segment holds large data sections.
bool is_large_data_segment_ : 1;
+ // Whether this was marked as a unique segment via a linker plugin.
+ bool is_unique_segment_ : 1;
};
// This class represents the output file.