Always set up sh_name in assign_section_numbers
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 20 Apr 2015 19:37:14 +0000 (12:37 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 20 Apr 2015 19:37:14 +0000 (12:37 -0700)
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
bfd/elf.c

index 09231bf42f38e51e4cb7cc7a9b28ab18034240b1..1f95fd54c33c02f360e2d52daae9d6461787c4df 100644 (file)
@@ -1,3 +1,7 @@
+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
index 4258c6ee6a6b942c7d64d9e922fe2dcc8b448e33..c60e1c873a63b39cb9f26df8d796b6e9421aa507 100644 (file)
--- 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;
 }
 
This page took 0.031026 seconds and 4 git commands to generate.