Fix crash when processing merge section with entsize of 0.
authorCary Coutant <ccoutant@google.com>
Mon, 2 Mar 2015 18:20:21 +0000 (10:20 -0800)
committerCary Coutant <ccoutant@google.com>
Mon, 2 Mar 2015 18:20:21 +0000 (10:20 -0800)
2015-02-04  Peter Collingbourne  <pcc@google.com>
            Cary Coutant  <ccoutant@google.com>

gold/
* output.cc (Output_section::add_merge_input_section): Do not
attempt to merge sections with an entsize of 0.

gold/ChangeLog
gold/output.cc

index 10fc03b3ec116a881d359a5d94f80d9cbdc67a20..d7dd903f67c45d0378cde71529cb94c6595c1c0f 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-04  Peter Collingbourne  <pcc@google.com>
+            Cary Coutant  <ccoutant@google.com>
+
+       * output.cc (Output_section::add_merge_input_section): Do not
+       attempt to merge sections with an entsize of 0.
+
 2015-02-02  Khem Raj  <raj.khem@gmail.com>
 
        * attributes.h (class Output_attributes_section_data ): Add
index e9dd522bdf751cb67163275eb009780bfc417914..01838cc86e00a5a982fda8817b0b296550cb2011 100644 (file)
@@ -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.
This page took 0.036431 seconds and 4 git commands to generate.