This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Don't set sh_size for .shstrtab twice
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 25 Jun 2015 20:11:21 -0000
- Subject: [binutils-gdb] Don't set sh_size for .shstrtab twice
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=946748d5ed1d218adfccd523be9fdf280adfe434
commit 946748d5ed1d218adfccd523be9fdf280adfe434
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Jun 25 12:12:43 2015 -0700
Don't set sh_size for .shstrtab twice
_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.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/elf.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 321d86f..8724de4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
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
* elf-bfd.h (elf_sym_strtab): New.
(elf_link_hash_table): Add strtabcount, strtabsize and
diff --git a/bfd/elf.c b/bfd/elf.c
index 4020961..9846046 100644
--- 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;