From: Alan Modra Date: Tue, 23 Sep 2003 00:40:49 +0000 (+0000) Subject: * elf-bfd.h (struct bfd_elf_special_section): Remove "suffix". Change X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7dcb9820ee9e265f0696fc5aa65e71fde8faed03;p=binutils-gdb.git * elf-bfd.h (struct bfd_elf_special_section): Remove "suffix". Change type of prefix_length and suffix_length to int. Rename "attributes" to "attr". Comment. (_bfd_elf_get_sec_type_attr): Update prototype. * elf.c (get_special_section): Rewrite. (_bfd_elf_get_sec_type_attr): Return struct rather than passing in attr and type pointers. (_bfd_elf_new_section_hook): Adjust for above. (special_sections): Merge suffix with prefix. Set prefix_length for all entries. Set suffix_length appropriately. * elf32-m32r.c (m32r_elf_special_sections): Likewise. * elf32-m68hc11.c (elf32_m68hc11_special_sections): Likewise. * elf32-m68hc12.c (elf32_m68hc12_special_sections): Likewise. * elf32-mcore.c (mcore_elf_special_sections): Likewise. * elf32-sh64.c (sh64_elf_special_sections): Likewise. * elf32-v850.c (v850_elf_special_sections): Likewise. * elf32-xtensa.c (elf_xtensa_special_sections): Likewise. * elf64-alpha.c (elf64_alpha_special_sections): Likewise. * elf64-hppa.c (elf64_hppa_special_sections): Likewise. * elf64-ppc.c (ppc64_elf_special_sections): Likewise. * elf64-sh64.c (sh64_elf64_special_sections): Likewise. * elfxx-ia64.c (elfNN_ia64_special_sections): Likewise. * elfxx-mips.c (_bfd_mips_elf_special_sections): Likewise. * elf32-ppc.c (ppc_elf_special_sections): Likewise. Fix .plt flags. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9452f98352d..bffa6ec0cf7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,30 @@ +2003-09-23 Alan Modra + + * elf-bfd.h (struct bfd_elf_special_section): Remove "suffix". Change + type of prefix_length and suffix_length to int. Rename "attributes" + to "attr". Comment. + (_bfd_elf_get_sec_type_attr): Update prototype. + * elf.c (get_special_section): Rewrite. + (_bfd_elf_get_sec_type_attr): Return struct rather than passing in + attr and type pointers. + (_bfd_elf_new_section_hook): Adjust for above. + (special_sections): Merge suffix with prefix. Set + prefix_length for all entries. Set suffix_length appropriately. + * elf32-m32r.c (m32r_elf_special_sections): Likewise. + * elf32-m68hc11.c (elf32_m68hc11_special_sections): Likewise. + * elf32-m68hc12.c (elf32_m68hc12_special_sections): Likewise. + * elf32-mcore.c (mcore_elf_special_sections): Likewise. + * elf32-sh64.c (sh64_elf_special_sections): Likewise. + * elf32-v850.c (v850_elf_special_sections): Likewise. + * elf32-xtensa.c (elf_xtensa_special_sections): Likewise. + * elf64-alpha.c (elf64_alpha_special_sections): Likewise. + * elf64-hppa.c (elf64_hppa_special_sections): Likewise. + * elf64-ppc.c (ppc64_elf_special_sections): Likewise. + * elf64-sh64.c (sh64_elf64_special_sections): Likewise. + * elfxx-ia64.c (elfNN_ia64_special_sections): Likewise. + * elfxx-mips.c (_bfd_mips_elf_special_sections): Likewise. + * elf32-ppc.c (ppc_elf_special_sections): Likewise. Fix .plt flags. + 2003-09-21 Daniel Jacobowitz * elf64-alpha.c (elf64_alpha_create_got_section): Initialize diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index abbe377e491..99036949adf 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -511,11 +511,16 @@ typedef enum { struct bfd_elf_special_section { const char *prefix; - size_t prefix_length; - const char *suffix; - size_t suffix_length; + int prefix_length; + /* 0 means name must match PREFIX exactly. + -1 means name must start with PREFIX followed by an arbitrary string. + -2 means name must match PREFIX exactly or consist of PREFIX followed + by a dot then anything. + > 0 means name must start with the first PREFIX_LENGTH chars of + PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */ + int suffix_length; int type; - int attributes; + int attr; }; struct elf_backend_data @@ -1384,8 +1389,8 @@ extern bfd_boolean _bfd_elf_new_section_hook (bfd *, asection *); extern bfd_boolean _bfd_elf_init_reloc_shdr (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean); -extern bfd_boolean _bfd_elf_get_sec_type_attr - (bfd *, const char *, int *, int *); +extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr + (bfd *, const char *); /* If the target doesn't have reloc handling written yet: */ extern void _bfd_elf_no_info_to_howto diff --git a/bfd/elf.c b/bfd/elf.c index 5935803f11c..5fde379d147 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -2019,82 +2019,44 @@ bfd_section_from_elf_index (bfd *abfd, unsigned int index) static struct bfd_elf_special_section const special_sections[] = { - { ".bss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".comment", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".data", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".data1", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".debug", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".fini", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".line", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".rodata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".rodata1", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".tbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { ".tdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { ".text", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init_array", 0, NULL, 0, - SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".fini_array", 0, NULL, 0, - SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".preinit_array", 0, NULL, 0, - SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".debug_line", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".debug_info", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".debug_abbrev", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".debug_aranges", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".dynamic", 0, NULL, 0, - SHT_DYNAMIC, SHF_ALLOC }, - { ".dynstr", 0, NULL, 0, - SHT_STRTAB, SHF_ALLOC }, - { ".dynsym", 0, NULL, 0, - SHT_DYNSYM, SHF_ALLOC }, - { ".got", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".hash", 0, NULL, 0, - SHT_HASH, SHF_ALLOC }, - { ".interp", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".plt", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".shstrtab", 0, NULL, 0, - SHT_STRTAB, 0 }, - { ".strtab", 0, NULL, 0, - SHT_STRTAB, 0 }, - { ".symtab", 0, NULL, 0, - SHT_SYMTAB, 0 }, - { ".gnu.version", 0, NULL, 0, - SHT_GNU_versym, 0 }, - { ".gnu.version_d", 0, NULL, 0, - SHT_GNU_verdef, 0 }, - { ".gnu.version_r", 0, NULL, 0, - SHT_GNU_verneed, 0 }, - { ".note", 5, NULL, 0, - SHT_NOTE, 0 }, - { ".rela", 5, NULL, 0, - SHT_RELA, 0 }, - { ".rel", 4, NULL, 0, - SHT_REL, 0 }, - { ".stab", 5, "str", 3, - SHT_STRTAB, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".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 * @@ -2103,32 +2065,55 @@ get_special_section (const char *name, unsigned int rela) { int i; + int len = strlen (name); for (i = 0; special_sections[i].prefix != NULL; i++) - if (((special_sections[i].prefix_length - && strncmp (name, special_sections[i].prefix, - special_sections[i].prefix_length) == 0 - && (! special_sections[i].suffix_length - || strcmp ((name + strlen (name) - - special_sections[i].suffix_length), - special_sections[i].suffix) == 0)) - || strcmp (name, special_sections[i].prefix) == 0) - && (rela || special_sections[i].type != SHT_RELA)) + { + 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; } -bfd_boolean -_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name, int *type, int *attr) +const struct bfd_elf_special_section * +_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name) { - bfd_boolean found = FALSE; 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) { - const struct bfd_elf_special_section *ssect = NULL; unsigned int rela = bed->default_use_rela_p; if (bed->special_sections) @@ -2136,23 +2121,16 @@ _bfd_elf_get_sec_type_attr (bfd *abfd, const char *name, int *type, int *attr) if (! ssect) ssect = get_special_section (name, special_sections, rela); - - if (ssect) - { - *type = ssect->type; - *attr = ssect->attributes; - found = TRUE; - } } - return found; + return ssect; } bfd_boolean _bfd_elf_new_section_hook (bfd *abfd, asection *sec) { struct bfd_elf_section_data *sdata; - int type, attr; + const struct bfd_elf_special_section *ssect; sdata = (struct bfd_elf_section_data *) sec->used_by_bfd; if (sdata == NULL) @@ -2164,11 +2142,11 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec) } elf_section_type (sec) = SHT_NULL; - if (sec->name && _bfd_elf_get_sec_type_attr (abfd, sec->name, - &type, &attr)) + ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name); + if (ssect != NULL) { - elf_section_type (sec) = type; - elf_section_flags (sec) = attr; + elf_section_type (sec) = ssect->type; + elf_section_flags (sec) = ssect->attr; } /* Indicate whether or not this section should use RELA relocations. */ diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 7e955e9b116..257a68cc7d5 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -2094,12 +2094,9 @@ m32r_elf_check_relocs (abfd, info, sec, relocs) static struct bfd_elf_special_section const m32r_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; #define ELF_ARCH bfd_arch_m32r diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 2844b487a40..49dcb6cef2f 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1289,16 +1289,11 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) vectors. */ static struct bfd_elf_special_section const elf32_m68hc11_special_sections[]= { - { ".eeprom", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".softregs", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".page0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".vectors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; #define ELF_ARCH bfd_arch_m68hc11 diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c index 3074935cc83..435c4bd9ac2 100644 --- a/bfd/elf32-m68hc12.c +++ b/bfd/elf32-m68hc12.c @@ -545,16 +545,11 @@ m68hc12_elf_set_mach_from_flags (abfd) vectors. */ static struct bfd_elf_special_section const elf32_m68hc12_special_sections[]= { - { ".eeprom", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".softregs", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".page0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".vectors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; #define ELF_ARCH bfd_arch_m68hc12 diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 3f878cfaca9..59c5840d45a 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -683,12 +683,9 @@ mcore_elf_check_relocs (abfd, info, sec, relocs) static struct bfd_elf_special_section const mcore_elf_special_sections[]= { - { ".ctors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".dtors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".ctors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".dtors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_BIG_SYM bfd_elf32_mcore_big_vec diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 3bffc70c786..a37eb3a284a 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6186,26 +6186,16 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) static struct bfd_elf_special_section const ppc_elf_special_sections[]= { - { ".tags", 0, NULL, 0, - SHT_ORDERED, SHF_ALLOC }, - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".sdata2", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".sbss2", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".PPC.EMB.apuinfo", 0, NULL, 0, - SHT_NOTE, 0 }, - { ".PPC.EMB.sdata0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".PPC.EMB.sbss0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".plt", 0, NULL, 0, - SHT_NOBITS, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC }, + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 }, + { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC }, + { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC }, + { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index 396fedfad43..288003e0660 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -737,10 +737,8 @@ sh64_elf_final_write_processing (bfd *abfd, static struct bfd_elf_special_section const sh64_elf_special_sections[]= { - { ".cranges", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".cranges", 8, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } }; #undef TARGET_BIG_SYM diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 0dc6542b2d6..e2b80126f97 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -3163,34 +3163,33 @@ v850_elf_relax_section (abfd, sec, link_info, again) static struct bfd_elf_special_section const v850_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, - { ".rosdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_V850_GPREL }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, - { ".scommon", 0, NULL, 0, - SHT_V850_SCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, - { ".tdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, - { ".tbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, - { ".tcommon", 0, NULL, 0, - SHT_V850_TCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".zdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".rozdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_V850_R0REL }, - { ".zbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".zcommon", 0, NULL, 0, - SHT_V850_ZCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".call_table_data", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".call_table_text", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".rosdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC + + SHF_V850_GPREL) }, + { ".sbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".scommon", 8, -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".tdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_EPREL) }, + { ".tbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_EPREL) }, + { ".tcommon", 8, -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".zdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".rozdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC + + SHF_V850_R0REL) }, + { ".zbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".zcommon", 8, -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".call_table_data", 16, 0, SHT_PROGBITS, (SHF_ALLOC + + SHF_WRITE) }, + { ".call_table_text", 16, 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_EXECINSTR) }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_LITTLE_SYM bfd_elf32_v850_vec diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 251c3323959..c9fce980db0 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -5841,14 +5841,10 @@ xtensa_callback_required_dependence (abfd, sec, link_info, callback, closure) module loader so that the literals are not placed after the text. */ static struct bfd_elf_special_section const elf_xtensa_special_sections[]= { - { ".literal", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init.literal", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".fini.literal", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".literal", 8, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".init.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".fini.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { NULL, 0, 0, 0, 0 } }; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index a3f81ebac1b..7b1592daa7f 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -5449,12 +5449,9 @@ elf64_alpha_reloc_type_class (rela) static struct bfd_elf_special_section const elf64_alpha_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + { NULL, 0, 0, 0, 0 } }; /* ECOFF swapping routines. These are used when dealing with the diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 88403f5221c..9eced4c9cc6 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -2675,12 +2675,9 @@ elf64_hppa_elf_get_symbol_type (elf_sym, type) static struct bfd_elf_special_section const elf64_hppa_special_sections[]= { - { ".fini", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".init", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; /* The hash bucket size is the standard one, namely 4. */ diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 2042e6ae323..820f80852e2 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2405,20 +2405,13 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) static struct bfd_elf_special_section const ppc64_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".plt", 0, NULL, 0, - SHT_NOBITS, 0 }, - { ".toc", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".toc1", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".tocbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".plt", 4, 0, SHT_NOBITS, 0 }, + { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; struct _ppc64_elf_section_data diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index e0bc8df7e5d..4cc20a7c5c4 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -4118,10 +4118,8 @@ sh64_elf64_finish_dynamic_sections (bfd *output_bfd, static struct bfd_elf_special_section const sh64_elf64_special_sections[]= { - { ".cranges", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".cranges", 8, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_BIG_SYM bfd_elf64_sh64_vec diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 47f457594d5..c8dd9c49b95 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -4748,12 +4748,9 @@ elfNN_ia64_reloc_type_class (rela) static struct bfd_elf_special_section const elfNN_ia64_special_sections[]= { - { ".sbss", 5, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, - { ".sdata", 6, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, + { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, + { NULL, 0, 0, 0, 0 } }; static bfd_boolean diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 919593d1873..0063100f8ec 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -9296,18 +9296,11 @@ _bfd_mips_elf_print_private_bfd_data (abfd, ptr) struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".lit4", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".lit8", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".ucode", 0, NULL, 0, - SHT_MIPS_UCODE, 0 }, - { ".mdebug", 0, NULL, 0, - SHT_MIPS_DEBUG, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 }, + { ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 }, + { NULL, 0, 0, 0, 0 } };