From ce61d01fd9a4bf7ac42352e8d519d040012d3ef1 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 4 Jul 2005 01:53:44 +0000 Subject: PR 1004 bfd/ * elf-bfd.h (struct elf_backend_data): Add get_sec_type_attr. Delete special_sections. (_bfd_elf_get_special_section): Declare. (bfd_elf_special_section): Update prototype. * elf.c (special_sections): Remove unused outer entries. (get_special_section): Delete. (_bfd_elf_get_special_section): New function. (_bfd_elf_get_sec_type_attr): Replace "name" arg with "sec". Update special_sections indexing. (_bfd_elf_new_section_hook): Call backend get_sec_type_attr. * elf32-arm.c (symbian_special_sections_d): Delete. (symbian_special_sections_g, symbian_special_sections_h): Delete. (symbian_special_sections_i, symbian_special_sections_f): Delete. (symbian_special_sections_p): Delete. (elf32_arm_symbian_special_sections): Merge above to here. (elf32_arm_symbian_get_sec_type_attr): New function. (elf_backend_special_sections): Don't define. (elf_backend_get_sec_type_attr): Define. * elf32-m32r.c: Similarly to elf32-arm.c. * elf32-m68hc11.c: Likewise. * elf32-m68hc12.c: Likewise. * elf32-mcore.c: Likewise. * elf32-sh64.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elf32-ppc.c: Likewise. (bfd_elf_special_section ppc_alt_plt): New. Use it if .plt loadable. * elfxx-mips.h (_bfd_mips_elf_get_sec_type_attr): Declare. (_bfd_mips_elf_special_sections, elf_backend_special_sections): Delete. (elf_backend_get_sec_type_attr): Define. * elfxx-target.h (elf_backend_get_sec_type_attr): Define. (elf_backend_special_sections): Don't define. (elfNN_bed): Update. binutils/ * objcopy.c (copy_object): Use bfd_make_section_with_flags. (write_debugging_info): Likewise. (setup_section): Use bfd_make_section_anyway_with_flags. gas/ * config/obj-elf.c (obj_elf_change_section): Use backend get_sec_type_attr. --- bfd/elf32-m68hc12.c | 69 ++++++++++++++--------------------------------------- 1 file changed, 18 insertions(+), 51 deletions(-) (limited to 'bfd/elf32-m68hc12.c') diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c index 213ead23b7..6a3a86edfa 100644 --- a/bfd/elf32-m68hc12.c +++ b/bfd/elf32-m68hc12.c @@ -535,65 +535,32 @@ m68hc12_elf_set_mach_from_flags (bfd *abfd) Page0 accesses are faster on the M68HC12. - The .vectors is the section that represents the interrupt vectors. */ -static struct bfd_elf_special_section const - m68hc12_special_sections_e[] = +static struct bfd_elf_special_section const elf32_m68hc12_special_sections[] = { { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, 0, 0, 0 } -}; - -static struct bfd_elf_special_section const - m68hc12_special_sections_s[]= -{ + { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, { NULL, 0, 0, 0, 0 } }; -static struct bfd_elf_special_section const - m68hc12_special_sections_p[]= +static const struct bfd_elf_special_section * +elf32_m68hc12_get_sec_type_attr (bfd *abfd, asection *sec) { - { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, 0, 0, 0 } -}; + const struct bfd_elf_special_section const *ssect; -static struct bfd_elf_special_section const - m68hc12_special_sections_v[]= -{ - { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, - { NULL, 0, 0, 0, 0 } -}; + /* See if this is one of the special sections. */ + if (sec->name == NULL) + return NULL; -static struct bfd_elf_special_section const * - elf32_m68hc12_special_sections[27] = -{ - NULL, /* 'a' */ - NULL, /* 'b' */ - NULL, /* 'c' */ - NULL, /* 'd' */ - m68hc12_special_sections_e, /* 'e' */ - NULL, /* 'f' */ - NULL, /* 'g' */ - NULL, /* 'h' */ - NULL, /* 'i' */ - NULL, /* 'j' */ - NULL, /* 'k' */ - NULL, /* 'l' */ - NULL, /* 'm' */ - NULL, /* 'n' */ - NULL, /* 'o' */ - m68hc12_special_sections_p, /* 'p' */ - NULL, /* 'q' */ - NULL, /* 'r' */ - m68hc12_special_sections_s, /* 's' */ - NULL, /* 't' */ - NULL, /* 'u' */ - m68hc12_special_sections_v, /* 'v' */ - NULL, /* 'w' */ - NULL, /* 'x' */ - NULL, /* 'y' */ - NULL, /* 'z' */ - NULL /* other */ -}; + ssect = _bfd_elf_get_special_section (sec->name, + elf32_m68hc12_special_sections, + sec->use_rela_p); + if (ssect != NULL) + return ssect; + + return _bfd_elf_get_sec_type_attr (abfd, sec); +} #define ELF_ARCH bfd_arch_m68hc12 #define ELF_MACHINE_CODE EM_68HC12 @@ -611,7 +578,7 @@ static struct bfd_elf_special_section const * #define elf_backend_object_p m68hc12_elf_set_mach_from_flags #define elf_backend_final_write_processing 0 #define elf_backend_can_gc_sections 1 -#define elf_backend_special_sections elf32_m68hc12_special_sections +#define elf_backend_get_sec_type_attr elf32_m68hc12_get_sec_type_attr #define elf_backend_post_process_headers elf32_m68hc11_post_process_headers #define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook -- cgit v1.2.1