From: Cary Coutant Date: Mon, 2 Mar 2015 18:20:21 +0000 (-0800) Subject: Fix crash when processing merge section with entsize of 0. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2c7b626ceef8ee50d6ef6fb575cfe55b93ef7a0f;p=binutils-gdb.git Fix crash when processing merge section with entsize of 0. 2015-02-04 Peter Collingbourne Cary Coutant gold/ * output.cc (Output_section::add_merge_input_section): Do not attempt to merge sections with an entsize of 0. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index 10fc03b3ec1..d7dd903f67c 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2015-02-04 Peter Collingbourne + Cary Coutant + + * output.cc (Output_section::add_merge_input_section): Do not + attempt to merge sections with an entsize of 0. + 2015-02-02 Khem Raj * attributes.h (class Output_attributes_section_data ): Add diff --git a/gold/output.cc b/gold/output.cc index e9dd522bdf7..01838cc86e0 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -2636,6 +2636,10 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx, uint64_t addralign, bool keeps_input_sections) { + // We cannot merge sections with entsize == 0. + if (entsize == 0) + return false; + bool is_string = (flags & elfcpp::SHF_STRINGS) != 0; // We cannot restore merged input section states.