public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed, PATCH] Always set up sh_name in assign_section_numbers
@ 2015-04-20 19:53 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2015-04-20 19:53 UTC (permalink / raw)
  To: binutils

commit 9ad5cbcfb23cb74d34bd04f88f4e47c0f5de5155 added the initial support
for more than 64k ELF sections with holes for reserved section indices in
section header table and set entries of reserved section indices in
section header table to index 0:

   for (secn = 1; secn < section_number; ++secn)
-    i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
-                                                    i_shdrp[secn]->sh_name);
-
+    if (i_shdrp[secn] == NULL)
+      i_shdrp[secn] = i_shdrp[0];
+    else
+      i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
+							i_shdrp[secn]->sh_name);

commit 4fbb74a6055f7d48f09c44064073d3b1e99c6642 removed holes in section
header table.  Check for i_shdrp[secn] == NULL is no longer needed now.
This patch removes it.

	* elf.c (assign_section_numbers): Always set up sh_name.
---
 bfd/ChangeLog | 4 ++++
 bfd/elf.c     | 7 ++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 09231bf..1f95fd5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,9 @@
 2015-04-20  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* elf.c (assign_section_numbers): Always set up sh_name.
+
+2015-04-20  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* elf.c (assign_file_positions_for_non_load_sections): Iterate
 	sections by pointer.
 	(_bfd_elf_assign_file_positions_for_non_load): Likewise.
diff --git a/bfd/elf.c b/bfd/elf.c
index 4258c6e..c60e1c8 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3479,11 +3479,8 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
     }
 
   for (secn = 1; secn < section_number; ++secn)
-    if (i_shdrp[secn] == NULL)
-      i_shdrp[secn] = i_shdrp[0];
-    else
-      i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
-						       i_shdrp[secn]->sh_name);
+    i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
+						     i_shdrp[secn]->sh_name);
   return TRUE;
 }
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-20 19:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20 19:53 [committed, PATCH] Always set up sh_name in assign_section_numbers H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).