diff options
Diffstat (limited to 'gold/script-sections.cc')
-rw-r--r-- | gold/script-sections.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/gold/script-sections.cc b/gold/script-sections.cc index f90c0b3..e5d3a93 100644 --- a/gold/script-sections.cc +++ b/gold/script-sections.cc @@ -582,7 +582,7 @@ class Sections_element // Output_section_definition. virtual const char* output_section_name(const char*, const char*, Output_section***, - Script_sections::Section_type*) + Script_sections::Section_type*, bool*) { return NULL; } // Initialize OSP with an output section. @@ -800,7 +800,7 @@ class Output_section_element // Return whether this element matches FILE_NAME and SECTION_NAME. // The only real implementation is in Output_section_element_input. virtual bool - match_name(const char*, const char*) const + match_name(const char*, const char*, bool *) const { return false; } // Set section addresses. This includes applying assignments if the @@ -1238,10 +1238,10 @@ class Output_section_element_input : public Output_section_element *dot_section = this->final_dot_section_; } - // See whether we match FILE_NAME and SECTION_NAME as an input - // section. + // See whether we match FILE_NAME and SECTION_NAME as an input section. + // If we do then also indicate whether the section should be KEPT. bool - match_name(const char* file_name, const char* section_name) const; + match_name(const char* file_name, const char* section_name, bool* keep) const; // Set the section address. void @@ -1393,15 +1393,19 @@ Output_section_element_input::match_file_name(const char* file_name) const return true; } -// See whether we match FILE_NAME and SECTION_NAME. +// See whether we match FILE_NAME and SECTION_NAME. If we do then +// KEEP indicates whether the section should survive garbage collection. bool Output_section_element_input::match_name(const char* file_name, - const char* section_name) const + const char* section_name, + bool *keep) const { if (!this->match_file_name(file_name)) return false; + *keep = this->keep_; + // If there are no section name patterns, then we match. if (this->input_section_patterns_.empty()) return true; @@ -1861,7 +1865,8 @@ class Output_section_definition : public Sections_element // section name. const char* output_section_name(const char* file_name, const char* section_name, - Output_section***, Script_sections::Section_type*); + Output_section***, Script_sections::Section_type*, + bool*); // Initialize OSP with an output section. void @@ -2146,14 +2151,15 @@ Output_section_definition::output_section_name( const char* file_name, const char* section_name, Output_section*** slot, - Script_sections::Section_type* psection_type) + Script_sections::Section_type* psection_type, + bool* keep) { // Ask each element whether it matches NAME. for (Output_section_elements::const_iterator p = this->elements_.begin(); p != this->elements_.end(); ++p) { - if ((*p)->match_name(file_name, section_name)) + if ((*p)->match_name(file_name, section_name, keep)) { // We found a match for NAME, which means that it should go // into this output section. @@ -3365,7 +3371,8 @@ Script_sections::output_section_name( const char* file_name, const char* section_name, Output_section*** output_section_slot, - Script_sections::Section_type* psection_type) + Script_sections::Section_type* psection_type, + bool* keep) { for (Sections_elements::const_iterator p = this->sections_elements_->begin(); p != this->sections_elements_->end(); @@ -3373,7 +3380,7 @@ Script_sections::output_section_name( { const char* ret = (*p)->output_section_name(file_name, section_name, output_section_slot, - psection_type); + psection_type, keep); if (ret != NULL) { |