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]

Re: [PATCH] [gold] Do not attempt to merge sections with an entsize of 0.


> It seems to be invalid for a section to have the SHF_MERGE flag set and an
> entsize of 0, but we should cope with this gracefully instead of crashing.
>
> 2015-02-04  Peter Collingbourne  <pcc@google.com>
>
>         * merge.cc (Output_merge_data::do_add_input_section): Do not attempt to
>         merge sections with an entsize of 0.

In output.cc, Output_section::add_merge_input_section, we already
check the entsize for merge string sections. I think that would be the
right place to reject sections with entsize == 0, and would avoid some
unnecessary allocations. Just put:

    if (entsize == 0)
      return false;

at the top of that function. With that change, you could simply call
gold_assert(entsize != 0) just before the divide.

Thanks!

-cary


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