This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] [gold] Do not attempt to merge sections with an entsize of 0.
- From: Cary Coutant <ccoutant at google dot com>
- To: Peter Collingbourne <pcc at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 20 Feb 2015 16:20:07 -0800
- Subject: Re: [PATCH] [gold] Do not attempt to merge sections with an entsize of 0.
- Authentication-results: sourceware.org; auth=none
- References: <1423080595-2173-1-git-send-email-pcc at google dot com>
> 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 <email@example.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)
at the top of that function. With that change, you could simply call
gold_assert(entsize != 0) just before the divide.