Index: bfd/elf-bfd.h =================================================================== RCS file: /cvs/src/src/bfd/elf-bfd.h,v retrieving revision 1.110 diff -u -p -r1.110 elf-bfd.h --- bfd/elf-bfd.h 20 Aug 2003 08:37:18 -0000 1.110 +++ bfd/elf-bfd.h 22 Sep 2003 16:03:05 -0000 @@ -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_ (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 Index: bfd/elf.c =================================================================== RCS file: /cvs/src/src/bfd/elf.c,v retrieving revision 1.199 diff -u -p -r1.199 elf.c --- bfd/elf.c 19 Sep 2003 02:08:35 -0000 1.199 +++ bfd/elf.c 22 Sep 2003 16:03:07 -0000 @@ -2019,82 +2019,44 @@ bfd_section_from_elf_index (bfd *abfd, u 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, c 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, as } 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. */ Index: bfd/elf32-m32r.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-m32r.c,v retrieving revision 1.34 diff -u -p -r1.34 elf32-m32r.c --- bfd/elf32-m32r.c 25 Jul 2003 14:35:55 -0000 1.34 +++ bfd/elf32-m32r.c 22 Sep 2003 16:03:07 -0000 @@ -2094,12 +2094,9 @@ m32r_elf_check_relocs (abfd, info, sec, 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 Index: bfd/elf32-m68hc11.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-m68hc11.c,v retrieving revision 1.22 diff -u -p -r1.22 elf32-m68hc11.c --- bfd/elf32-m68hc11.c 6 Sep 2003 20:55:50 -0000 1.22 +++ bfd/elf32-m68hc11.c 22 Sep 2003 16:03:08 -0000 @@ -1289,16 +1289,11 @@ m68hc11_elf_relax_delete_bytes (abfd, se 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 + SHF_WRITE }, - { 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 + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; #define ELF_ARCH bfd_arch_m68hc11 Index: bfd/elf32-m68hc12.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-m68hc12.c,v retrieving revision 1.15 #diff -u -p -r1.15 elf32-m68hc12.c #--- bfd/elf32-m68hc12.c 6 Sep 2003 20:55:50 -0000 1.15 #+++ bfd/elf32-m68hc12.c 22 Sep 2003 16:03:09 -0000 #@@ -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 Index: bfd/elf32-mcore.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-mcore.c,v retrieving revision 1.28 diff -u -p -r1.28 elf32-mcore.c --- bfd/elf32-mcore.c 25 Jul 2003 14:35:55 -0000 1.28 +++ bfd/elf32-mcore.c 22 Sep 2003 16:03:09 -0000 @@ -683,12 +683,9 @@ mcore_elf_check_relocs (abfd, info, sec, 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 Index: bfd/elf32-ppc.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-ppc.c,v retrieving revision 1.100 diff -u -p -r1.100 elf32-ppc.c --- bfd/elf32-ppc.c 20 Aug 2003 08:37:17 -0000 1.100 +++ bfd/elf32-ppc.c 22 Sep 2003 16:03:12 -0000 @@ -6186,26 +6186,16 @@ ppc_elf_final_write_processing (bfd *abf 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 Index: bfd/elf32-sh64.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-sh64.c,v retrieving revision 1.18 diff -u -p -r1.18 elf32-sh64.c --- bfd/elf32-sh64.c 7 Aug 2003 08:38:07 -0000 1.18 +++ bfd/elf32-sh64.c 22 Sep 2003 16:03:12 -0000 @@ -737,10 +737,8 @@ sh64_elf_final_write_processing (bfd *ab 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 Index: bfd/elf32-v850.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-v850.c,v retrieving revision 1.35 diff -u -p -r1.35 elf32-v850.c --- bfd/elf32-v850.c 4 Sep 2003 11:04:34 -0000 1.35 +++ bfd/elf32-v850.c 22 Sep 2003 16:03:14 -0000 @@ -3163,34 +3163,33 @@ v850_elf_relax_section (abfd, sec, link_ 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 Index: bfd/elf32-xtensa.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v retrieving revision 1.11 diff -u -p -r1.11 elf32-xtensa.c --- bfd/elf32-xtensa.c 20 Aug 2003 08:37:18 -0000 1.11 +++ bfd/elf32-xtensa.c 22 Sep 2003 16:03:17 -0000 @@ -5841,14 +5841,10 @@ xtensa_callback_required_dependence (abf 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 } }; Index: bfd/elf64-alpha.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-alpha.c,v retrieving revision 1.106 diff -u -p -r1.106 elf64-alpha.c --- bfd/elf64-alpha.c 21 Sep 2003 19:24:52 -0000 1.106 +++ bfd/elf64-alpha.c 22 Sep 2003 16:03:20 -0000 @@ -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 Index: bfd/elf64-hppa.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-hppa.c,v retrieving revision 1.38 diff -u -p -r1.38 elf64-hppa.c --- bfd/elf64-hppa.c 21 Aug 2003 14:00:06 -0000 1.38 +++ bfd/elf64-hppa.c 22 Sep 2003 16:03:22 -0000 @@ -2675,12 +2675,9 @@ elf64_hppa_elf_get_symbol_type (elf_sym, 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. */ Index: bfd/elf64-ppc.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-ppc.c,v retrieving revision 1.130 diff -u -p -r1.130 elf64-ppc.c --- bfd/elf64-ppc.c 20 Aug 2003 08:37:18 -0000 1.130 +++ bfd/elf64-ppc.c 22 Sep 2003 16:03:26 -0000 @@ -2405,20 +2405,13 @@ ppc64_elf_merge_private_bfd_data (bfd *i 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 Index: bfd/elf64-sh64.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-sh64.c,v retrieving revision 1.35 diff -u -p -r1.35 elf64-sh64.c --- bfd/elf64-sh64.c 20 Aug 2003 08:37:18 -0000 1.35 +++ bfd/elf64-sh64.c 22 Sep 2003 16:03:28 -0000 @@ -4118,10 +4118,8 @@ sh64_elf64_finish_dynamic_sections (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 Index: bfd/elfxx-ia64.c =================================================================== RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v retrieving revision 1.100 diff -u -p -r1.100 elfxx-ia64.c --- bfd/elfxx-ia64.c 10 Sep 2003 20:48:32 -0000 1.100 +++ bfd/elfxx-ia64.c 22 Sep 2003 16:03:30 -0000 @@ -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 Index: bfd/elfxx-mips.c =================================================================== RCS file: /cvs/src/src/bfd/elfxx-mips.c,v retrieving revision 1.74 diff -u -p -r1.74 elfxx-mips.c --- bfd/elfxx-mips.c 20 Aug 2003 08:37:19 -0000 1.74 +++ bfd/elfxx-mips.c 22 Sep 2003 16:03:36 -0000 @@ -9296,18 +9296,11 @@ _bfd_mips_elf_print_private_bfd_data (ab 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 } }; Index: gas/config/obj-elf.c =================================================================== RCS file: /cvs/src/src/gas/config/obj-elf.c,v retrieving revision 1.72 diff -u -p -r1.72 obj-elf.c --- gas/config/obj-elf.c 30 Jul 2003 14:11:03 -0000 1.72 +++ gas/config/obj-elf.c 22 Sep 2003 16:03:43 -0000 @@ -614,8 +614,7 @@ obj_elf_change_section (name, type, attr asection *old_sec; segT sec; flagword flags; - int def_type; - int def_attr; + const struct bfd_elf_special_section *ssect; #ifdef md_flush_pending_output md_flush_pending_output (); @@ -638,13 +637,13 @@ obj_elf_change_section (name, type, attr old_sec = bfd_get_section_by_name (stdoutput, name); sec = subseg_new (name, 0); + ssect = _bfd_elf_get_sec_type_attr (stdoutput, name); - if (_bfd_elf_get_sec_type_attr (stdoutput, name, &def_type, - &def_attr)) + if (ssect != NULL) { if (type == SHT_NULL) - type = def_type; - else if (type != def_type) + type = ssect->type; + else if (type != ssect->type) { if (old_sec == NULL /* FIXME: gcc, as of 2002-10-22, will emit @@ -653,12 +652,12 @@ obj_elf_change_section (name, type, attr for __attribute__ ((section (".init_array"))). "@progbits" is incorrect. */ - && def_type != SHT_INIT_ARRAY - && def_type != SHT_FINI_ARRAY - && def_type != SHT_PREINIT_ARRAY) + && ssect->type != SHT_INIT_ARRAY + && ssect->type != SHT_FINI_ARRAY + && ssect->type != SHT_PREINIT_ARRAY) { /* We allow to specify any type for a .note section. */ - if (def_type != SHT_NOTE) + if (ssect->type != SHT_NOTE) as_warn (_("setting incorrect section type for %s"), name); } @@ -666,22 +665,31 @@ obj_elf_change_section (name, type, attr { as_warn (_("ignoring incorrect section type for %s"), name); - type = def_type; + type = ssect->type; } } - if (old_sec == NULL && (attr &~ def_attr) != 0) + if (old_sec == NULL && (attr &~ ssect->attr) != 0) { /* As a GNU extension, we permit a .note section to be - allocatable. If the linker sees an allocateable .note + allocatable. If the linker sees an allocatable .note section, it will create a PT_NOTE segment in the output file. We also allow "x" for .note.GNU-stack. */ - if (!(def_type == SHT_NOTE - && (attr == SHF_ALLOC || attr == SHF_EXECINSTR))) + if (ssect->type == SHT_NOTE + && (attr == SHF_ALLOC || attr == SHF_EXECINSTR)) + ; + /* Allow different SHF_MERGE and SHF_STRINGS if we have + something like .rodata.str. */ + else if (ssect->suffix_length == -2 + && name[ssect->prefix_length] == '.' + && (attr &~ ssect->attr &~ SHF_MERGE &~ SHF_STRINGS) == 0) + ; + else as_warn (_("setting incorrect section attributes for %s"), name); } - attr |= def_attr; + if (old_sec == NULL) + attr |= ssect->attr; } if (type != SHT_NULL) Index: ld/testsuite/ld-discard/exit.s =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-discard/exit.s,v retrieving revision 1.2 diff -u -p -r1.2 exit.s --- ld/testsuite/ld-discard/exit.s 30 Jul 2002 07:41:10 -0000 1.2 +++ ld/testsuite/ld-discard/exit.s 22 Sep 2003 16:03:44 -0000 @@ -2,5 +2,5 @@ .section .data.exit,"aw" data: .globl text - .section .text.exit,"aw" + .section .text.exit,"ax" text: Index: ld/testsuite/ld-discard/extern.s =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-discard/extern.s,v retrieving revision 1.3 diff -u -p -r1.3 extern.s --- ld/testsuite/ld-discard/extern.s 13 Apr 2003 14:42:22 -0000 1.3 +++ ld/testsuite/ld-discard/extern.s 22 Sep 2003 16:03:44 -0000 @@ -2,7 +2,7 @@ .section .data.exit,"aw" data: .globl text - .section .text.exit,"aw" + .section .text.exit,"ax" text: .text .globl _start Index: ld/testsuite/ld-discard/static.s =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-discard/static.s,v retrieving revision 1.3 diff -u -p -r1.3 static.s --- ld/testsuite/ld-discard/static.s 13 Apr 2003 14:42:22 -0000 1.3 +++ ld/testsuite/ld-discard/static.s 22 Sep 2003 16:03:44 -0000 @@ -1,6 +1,6 @@ .section .data.exit,"aw" data: - .section .text.exit,"aw" + .section .text.exit,"ax" text: .text .globl _start