Set sh_entsize for .init_array and similar.
authorAlan Modra <amodra@gmail.com>
Thu, 19 May 2016 15:03:42 +0000 (00:33 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 19 May 2016 15:05:24 +0000 (00:35 +0930)
PR gas/20118
* elf.c (elf_fake_sections): Set sh_entsize for SHT_INIT_ARRAY,
SHT_FINI_ARRAY, and SHT_PREINIT_ARRAY.

bfd/ChangeLog
bfd/elf.c

index c17c2bdca77dd0d027e46d58d018539587c26c2c..878f22f54e35e613ec07823586710aa71d9c1365 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-20  Alan Modra  <amodra@gmail.com>
+
+       PR gas/20118
+       * elf.c (elf_fake_sections): Set sh_entsize for SHT_INIT_ARRAY,
+       SHT_FINI_ARRAY, and SHT_PREINIT_ARRAY.
+
 2016-05-19  Cupertino Miranda  <cmiranda@synopsys.com>
 
        * elf32-arc.c (arc_elf_final_write_processing): Changed.
index 1592183fae7f0990589dcf0bd2489ceb5a04cc0a..fa4cc4c468e37e1a6e40e30c3d71920d90c1a9a9 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3208,14 +3208,17 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg)
       break;
 
     case SHT_STRTAB:
-    case SHT_INIT_ARRAY:
-    case SHT_FINI_ARRAY:
-    case SHT_PREINIT_ARRAY:
     case SHT_NOTE:
     case SHT_NOBITS:
     case SHT_PROGBITS:
       break;
 
+    case SHT_INIT_ARRAY:
+    case SHT_FINI_ARRAY:
+    case SHT_PREINIT_ARRAY:
+      this_hdr->sh_entsize = bed->s->arch_size / 8;
+      break;
+
     case SHT_HASH:
       this_hdr->sh_entsize = bed->s->sizeof_hash_entry;
       break;