+static struct bfd_elf_special_section const special_sections[] =
+{
+ { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { ".comment", 8, 0, SHT_PROGBITS, 0 },
+ { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".debug", 6, 0, SHT_PROGBITS, 0 },
+ { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".line", 5, 0, SHT_PROGBITS, 0 },
+ { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC },
+ { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC },
+ { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { ".debug_line", 11, 0, SHT_PROGBITS, 0 },
+ { ".debug_info", 11, 0, SHT_PROGBITS, 0 },
+ { ".debug_abbrev", 13, 0, SHT_PROGBITS, 0 },
+ { ".debug_aranges", 14, 0, SHT_PROGBITS, 0 },
+ { ".dynamic", 8, 0, SHT_DYNAMIC, SHF_ALLOC },
+ { ".dynstr", 7, 0, SHT_STRTAB, SHF_ALLOC },
+ { ".dynsym", 7, 0, SHT_DYNSYM, SHF_ALLOC },
+ { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".hash", 5, 0, SHT_HASH, SHF_ALLOC },
+ { ".interp", 7, 0, SHT_PROGBITS, 0 },
+ { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".shstrtab", 9, 0, SHT_STRTAB, 0 },
+ { ".strtab", 7, 0, SHT_STRTAB, 0 },
+ { ".symtab", 7, 0, SHT_SYMTAB, 0 },
+ { ".gnu.version", 12, 0, SHT_GNU_versym, 0 },
+ { ".gnu.version_d", 14, 0, SHT_GNU_verdef, 0 },
+ { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 },
+ { ".note", 5, -1, SHT_NOTE, 0 },
+ { ".rela", 5, -1, SHT_RELA, 0 },
+ { ".rel", 4, -1, SHT_REL, 0 },
+ { ".stabstr", 5, 3, SHT_STRTAB, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section *
+get_special_section (const char *name,
+ const struct bfd_elf_special_section *special_sections,
+ unsigned int rela)
+{
+ int i;
+ int len = strlen (name);
+
+ for (i = 0; special_sections[i].prefix != NULL; i++)
+ {
+ int suffix_len;
+ int prefix_len = special_sections[i].prefix_length;
+
+ if (len < prefix_len)
+ continue;
+ if (memcmp (name, special_sections[i].prefix, prefix_len) != 0)
+ continue;
+
+ suffix_len = special_sections[i].suffix_length;
+ if (suffix_len <= 0)
+ {
+ if (name[prefix_len] != 0)
+ {
+ if (suffix_len == 0)
+ continue;
+ if (name[prefix_len] != '.'
+ && (suffix_len == -2
+ || (rela && special_sections[i].type == SHT_REL)))
+ continue;
+ }
+ }
+ else
+ {
+ if (len < prefix_len + suffix_len)
+ continue;
+ if (memcmp (name + len - suffix_len,
+ special_sections[i].prefix + prefix_len,
+ suffix_len) != 0)
+ continue;
+ }
+ return &special_sections[i];
+ }
+
+ return NULL;
+}
+
+const struct bfd_elf_special_section *
+_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name)
+{
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct bfd_elf_special_section *ssect = NULL;
+
+ /* See if this is one of the special sections. */
+ if (name)
+ {
+ unsigned int rela = bed->default_use_rela_p;
+
+ if (bed->special_sections)
+ ssect = get_special_section (name, bed->special_sections, rela);
+
+ if (! ssect)
+ ssect = get_special_section (name, special_sections, rela);
+ }
+
+ return ssect;
+}
+
+bfd_boolean
+_bfd_elf_new_section_hook (bfd *abfd, asection *sec)