diff options
author | Cary Coutant <ccoutant@gmail.com> | 2016-06-23 09:45:25 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2016-06-23 09:45:25 -0700 |
commit | 3ca25b560af813ca576821b500a0f0885829b500 (patch) | |
tree | 6c6b394becd0a8da3259ccb807460f420fce7220 /gold/script-sections.cc | |
parent | 2ec060b71cc1cddb506d3a38475aadc184e25985 (diff) | |
download | gdb-3ca25b560af813ca576821b500a0f0885829b500.zip gdb-3ca25b560af813ca576821b500a0f0885829b500.tar.gz gdb-3ca25b560af813ca576821b500a0f0885829b500.tar.bz2 |
Fix bug with grouping sections.
The fix for PR 15370 did not correctly check all patterns in a group,
but instead threw all unassigned sections into the group. This patch
fixes that.
2016-06-23 Cary Coutant <ccoutant@gmail.com>
Igor Kudrin <ikudrin@accesssoftek.com>
gold/
PR gold/15370
* script-sections.cc
(Output_section_element_input::set_section_addresses): Keep bin_count
separate from input_pattern_count.
* testsuite/script_test_12.t: Add another section .x4.
* testsuite/script_test_12i.t: Likewise.
* testsuite/script_test_12a.c: Likewise.
* testsuite/script_test_12b.c: Likewise.
Diffstat (limited to 'gold/script-sections.cc')
-rw-r--r-- | gold/script-sections.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gold/script-sections.cc b/gold/script-sections.cc index c42827f..ef82953 100644 --- a/gold/script-sections.cc +++ b/gold/script-sections.cc @@ -1595,6 +1595,7 @@ Output_section_element_input::set_section_addresses( typedef std::vector<std::vector<Input_section_info> > Matching_sections; size_t input_pattern_count = this->input_section_patterns_.size(); + size_t bin_count = 1; bool any_patterns_with_sort = false; for (size_t i = 0; i < input_pattern_count; ++i) { @@ -1602,9 +1603,9 @@ Output_section_element_input::set_section_addresses( if (isp.sort != SORT_WILDCARD_NONE) any_patterns_with_sort = true; } - if (input_pattern_count == 0 || !any_patterns_with_sort) - input_pattern_count = 1; - Matching_sections matching_sections(input_pattern_count); + if (any_patterns_with_sort) + bin_count = input_pattern_count; + Matching_sections matching_sections(bin_count); // Look through the list of sections for this output section. Add // each one which matches to one of the elements of @@ -1661,11 +1662,11 @@ Output_section_element_input::set_section_addresses( break; } - if (i >= this->input_section_patterns_.size()) + if (i >= input_pattern_count) ++p; else { - if (!any_patterns_with_sort) + if (i >= bin_count) i = 0; matching_sections[i].push_back(isi); p = input_sections->erase(p); @@ -1679,7 +1680,7 @@ Output_section_element_input::set_section_addresses( // output section. uint64_t dot = *dot_value; - for (size_t i = 0; i < input_pattern_count; ++i) + for (size_t i = 0; i < bin_count; ++i) { if (matching_sections[i].empty()) continue; |