PR 10244
authorIan Lance Taylor <ian@airs.com>
Wed, 24 Jun 2009 14:36:14 +0000 (14:36 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 24 Jun 2009 14:36:14 +0000 (14:36 +0000)
* reloc.cc (relocate_sections): Skip empty relocation sections.

gold/ChangeLog
gold/reloc.cc

index debf9339b0aba8f4acc4dd11e9ecb52e40938951..7c2feacbcf00e58eafa12e35e1e99a92ef7c1c3c 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-24  Ian Lance Taylor  <iant@google.com>
+
+       PR 10244
+       * reloc.cc (relocate_sections): Skip empty relocation sections.
+
 2009-06-23  Ian Lance Taylor  <iant@google.com>
 
        PR 10156
index b6394a56ec9a0ca9c9d05c2b7b48151a87e59a27..1985867fda857802fc7dc6809005c72e200f84f1 100644 (file)
@@ -822,6 +822,10 @@ Sized_relobj<size, big_endian>::relocate_sections(
       if (sh_type != elfcpp::SHT_REL && sh_type != elfcpp::SHT_RELA)
        continue;
 
+      off_t sh_size = shdr.get_sh_size();
+      if (sh_size == 0)
+       continue;
+
       unsigned int index = this->adjust_shndx(shdr.get_sh_info());
       if (index >= this->shnum())
        {
@@ -851,7 +855,6 @@ Sized_relobj<size, big_endian>::relocate_sections(
          continue;
        }
 
-      off_t sh_size = shdr.get_sh_size();
       const unsigned char* prelocs = this->get_view(shdr.get_sh_offset(),
                                                    sh_size, true, false);