Set correct SHT_NOTE type for .note.spu_name
authorAlan Modra <amodra@gmail.com>
Fri, 5 Oct 2018 10:22:55 +0000 (19:52 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 5 Oct 2018 10:34:10 +0000 (20:04 +0930)
* elf32-spu.c (spu_elf_create_sections): Make .note.spu_name
SHT_NOTE.

bfd/ChangeLog
bfd/elf32-spu.c

index f5caffbdd9478b6610530266efb25cb0307d0d69..da2a4d2fb71b205501c0edaf932f8bcdb394fe2e 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-05  Alan Modra  <amodra@gmail.com>
+
+       * elf32-spu.c (spu_elf_create_sections): Make .note.spu_name
+       SHT_NOTE.
+
 2018-10-05  Richard Henderson  <rth@twiddle.net>
 
        * bfd-in2.h: Regenerated.
index c3bfbbdd031f00e0d75f15951560d0dbd4c30957..bb3264f2361786c1a5bce5c46fcedbb8d71d216b 100644 (file)
@@ -580,11 +580,16 @@ spu_elf_create_sections (struct bfd_link_info *info)
       flagword flags;
 
       ibfd = info->input_bfds;
+      /* This should really be SEC_LINKER_CREATED, but then we'd need
+        to write out the section ourselves.  */
       flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
       s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags);
       if (s == NULL
          || !bfd_set_section_alignment (ibfd, s, 4))
        return FALSE;
+      /* Because we didn't set SEC_LINKER_CREATED we need to set the
+        proper section type.  */
+      elf_section_type (s) = SHT_NOTE;
 
       name_len = strlen (bfd_get_filename (info->output_bfd)) + 1;
       size = 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4);