From 1307d6cd4a961a2cd31a1ff63d8cd8dcf27b470a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 24 Jun 2009 14:36:14 +0000 Subject: [PATCH] PR 10244 * reloc.cc (relocate_sections): Skip empty relocation sections. --- gold/ChangeLog | 5 +++++ gold/reloc.cc | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index debf9339b0a..7c2feacbcf0 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2009-06-24 Ian Lance Taylor + + PR 10244 + * reloc.cc (relocate_sections): Skip empty relocation sections. + 2009-06-23 Ian Lance Taylor PR 10156 diff --git a/gold/reloc.cc b/gold/reloc.cc index b6394a56ec9..1985867fda8 100644 --- a/gold/reloc.cc +++ b/gold/reloc.cc @@ -822,6 +822,10 @@ Sized_relobj::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::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); -- 2.30.2