------- Additional Comments From cvs-commit at gcc dot gnu dot org 2010-06-03 18:01 ------- Subject: Bug 11658
CVSROOT: /cvs/src Module name: src Changes by: tmsri...@sourceware.org 2010-06-03 18:01:20 Modified files: gold : ChangeLog output.cc Log message: PR gold/11658 * output.cc (Output_section::Input_section_sort_entry::compare_section_ordering): Change to return non-zero correctly. (Output_section::Input_section_sort_section_order_index_compare ::operator()): Change to fix ambiguity in comparisons. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.570&r2=1.571 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/output.cc.diff?cvsroot=src&r1=1.127&r2=1.128 ------- Additional Comments From tmsriram at google dot com 2010-06-03 18:03 ------- Fixed with patch : 2010-06-03 Sriraman Tallam <tmsri...@google.com> PR gold/11658 * output.cc (Output_section::Input_section_sort_entry::compare_section_ordering): Change to return non-zero correctly. (Output_section::Input_section_sort_section_order_index_compare ::operator()): Change to fix ambiguity in comparisons. Index: output.cc =================================================================== RCS file: /cvs/src/src/gold/output.cc,v retrieving revision 1.127 diff -u -u -p -r1.127 output.cc --- output.cc 1 Jun 2010 23:37:57 -0000 1.127 +++ output.cc 3 Jun 2010 06:17:16 -0000 @@ -2801,20 +2801,21 @@ class Output_section::Input_section_sort return memcmp(base_name + base_len - 2, ".o", 2) == 0; } - // Returns 0 if sections are not comparable. Returns 1 if THIS is the - // first section in order, returns -1 for S. + // Returns 1 if THIS should appear before S in section order, -1 if S + // appears before THIS and 0 if they are not comparable. int compare_section_ordering(const Input_section_sort_entry& s) const { - gold_assert(this->index_ != -1U); - if (this->input_section_.section_order_index() == 0 - || s.input_section().section_order_index() == 0) - return 0; - if (this->input_section_.section_order_index() - < s.input_section().section_order_index()) - return 1; - else - return -1; + unsigned int this_secn_index = this->input_section_.section_order_index(); + unsigned int s_secn_index = s.input_section().section_order_index(); + if (this_secn_index > 0 && s_secn_index > 0) + { + if (this_secn_index < s_secn_index) + return 1; + else if (this_secn_index > s_secn_index) + return -1; + } + return 0; } private: @@ -2935,20 +2936,23 @@ Output_section::Input_section_sort_init_ return s1.index() < s2.index(); } -// Return true if S1 should come before S2. +// Return true if S1 should come before S2. Sections that do not match +// any pattern in the section ordering file are placed ahead of the sections +// that match some pattern. + bool Output_section::Input_section_sort_section_order_index_compare::operator()( const Output_section::Input_section_sort_entry& s1, const Output_section::Input_section_sort_entry& s2) const { - // Check if a section order exists for these sections through a section - // ordering file. If sequence_num is 0, an order does not exist. - int sequence_num = s1.compare_section_ordering(s2); - if (sequence_num != 0) - return sequence_num == 1; + unsigned int s1_secn_index = s1.input_section().section_order_index(); + unsigned int s2_secn_index = s2.input_section().section_order_index(); - // Otherwise we keep the input order. - return s1.index() < s2.index(); + // Keep input order if section ordering cannot determine order. + if (s1_secn_index == s2_secn_index) + return s1.index() < s2.index(); + + return s1_secn_index < s2_secn_index; } -- What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED http://sourceware.org/bugzilla/show_bug.cgi?id=11658 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils