Don't set sh_size for .shstrtab twice
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 25 Jun 2015 19:12:43 +0000 (12:12 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 25 Jun 2015 20:04:07 +0000 (13:04 -0700)
_bfd_elf_assign_file_positions_for_non_load will set the sh_size
field for .shstrtab section.  There is need to initialize it in
_bfd_elf_compute_section_file_positions.

* elf.c (_bfd_elf_compute_section_file_positions): Don't
initialize sh_size for .shstrtab here.

bfd/ChangeLog
bfd/elf.c

index 321d86f0af4fc3b30eecf1eeb4d89b532d75441b..8724de43f1edcd8793a0336a9f5b922a0812c82d 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf.c (_bfd_elf_compute_section_file_positions): Don't
+       initialize sh_size for .shstrtab here.
+
 2015-06-25  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR gas/18451
index 4020961a6a61c2d07cec2bad8781b61703fa001d..98460467d0c32908e98b068320e1e2c94ec750be 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3772,7 +3772,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd,
   shstrtab_hdr->sh_type = SHT_STRTAB;
   shstrtab_hdr->sh_flags = 0;
   shstrtab_hdr->sh_addr = 0;
-  shstrtab_hdr->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
+  /* sh_size is set in _bfd_elf_assign_file_positions_for_non_load.  */
   shstrtab_hdr->sh_entsize = 0;
   shstrtab_hdr->sh_link = 0;
   shstrtab_hdr->sh_info = 0;