This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][GOLD] Avoid linker crashing when merge sections have uneven sizes.


Hi Ian,

    This patch fixes a problem exposed by bootstrapping gcc.  libjava
contains objects with unevenly sized merge sections, whose sections
sizes are not multiples of their entsizes.
Output_merge_data::do_add_input_section cannot handle these sections
and returns false but the result is ignored by
Output_section::add_merge_input_section, which updates the merge
section map incorrectly.  Unevenly sized merge sections also cause
another problem Output_merge_data::set_final_data_size because the
method assumes the data member Output_merge_data::p_ is always not
NULL.  However, that condition is possible is an Output_merge_data is
empty due to unevenly sized input sections.

-Doug

2010-04-08  Doug Kwan  <dougkwan@google.com>

        * merge.cc (Output_merge_data::set_final_data_size): Handle empty
        Output_merge_data.
        * output.cc (Output_section::add_merge_input_section): Simplify
        code and return status of Output_merge_base::add_input_section.
        Update merge section map only if Output_merge_base::add_input_section
        returns true.

Attachment: patch-merge.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]