diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2010-08-25 14:53:45 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2010-08-25 14:53:45 +0000 |
commit | ae95ffa628f6a762098e298444e15b744e7f7d99 (patch) | |
tree | 9b6a4db0a7b27eb3135d6b71d18010783937290a | |
parent | PR threads/10729 (diff) | |
download | binutils-gdb-ae95ffa628f6a762098e298444e15b744e7f7d99.tar.gz binutils-gdb-ae95ffa628f6a762098e298444e15b744e7f7d99.tar.bz2 binutils-gdb-ae95ffa628f6a762098e298444e15b744e7f7d99.zip |
Add target_id to elf_backend_data.
2010-08-25 H.J. Lu <hongjiu.lu@intel.com>
PR ld/11944
* elf-bfd.h (elf_backend_data): Add target_id.
(bfd_elf_make_generic_object): Renamed to ...
(bfd_elf_make_object): This.
* elf.c (bfd_elf_make_generic_object): Removed.
(bfd_elf_make_object): New.
(bfd_elf_mkcorefile): Really treat it as an object file.
* elf-m10300.c (ELF_TARGET_ID): New.
* elf32-arm.c (ELF_TARGET_ID): Likewise.
* elf32-bfin.c (ELF_TARGET_ID): Likewise.
* elf32-cris.c (ELF_TARGET_ID): Likewise.
* elf32-frv.c (ELF_TARGET_ID): Likewise.
* elf32-i386.c (ELF_TARGET_ID): Likewise.
* elf32-lm32.c (ELF_TARGET_ID): Likewise.
* elf32-m32r.c (ELF_TARGET_ID): Likewise.
* elf32-m68hc11.c (ELF_TARGET_ID): Likewise.
* elf32-m68hc12.c (ELF_TARGET_ID): Likewise.
* elf32-m68k.c (ELF_TARGET_ID): Likewise.
* elf32-microblaze.c (ELF_TARGET_ID): Likewise.
* elf32-ppc.c (ELF_TARGET_ID): Likewise.
* elf32-s390.c (ELF_TARGET_ID): Likewise.
* elf32-sh.c (ELF_TARGET_ID): Likewise.
* elf32-sparc.c (ELF_TARGET_ID): Likewise.
* elf32-spu.c (ELF_TARGET_ID): Likewise.
* elf32-tic6x.c (ELF_TARGET_ID): Likewise.
* elf32-xtensa.c (ELF_TARGET_ID): Likewise.
* elf64-alpha.c (ELF_TARGET_ID): Likewise.
* elf64-hppa.c (ELF_TARGET_ID): Likewise.
* elf64-ppc.c (ELF_TARGET_ID): Likewise.
* elf64-s390.c (ELF_TARGET_ID): Likewise.
* elf64-x86-64.c (ELF_TARGET_ID): Likewise.
* elfxx-ia64.c (ELF_TARGET_ID): Likewise.
* elf32-hppa.c (elf32_hppa_mkobject): Removed.
(bfd_elf32_mkobject): Likewise.
(ELF_TARGET_ID): New.
* elf32-mips.c (ELF_TARGET_ID): New.
(bfd_elf32_mkobject): Removed.
* elf64-mips.c (ELF_TARGET_ID): New.
(bfd_elf64_mkobject): Removed.
* elfn32-mips.c (ELF_TARGET_ID): New.
(bfd_elf32_mkobject): Removed.
* elfxx-mips.c (_bfd_mips_elf_mkobject): Removed.
* elfxx-mips.h (_bfd_mips_elf_mkobject): Likewise.
* elfxx-target.h (bfd_elfNN_mkobject): Default to
bfd_elf_make_object.
(ELF_TARGET_ID): New. Default to GENERIC_ELF_DATA.
(elfNN_bed): Initialize target_id.
36 files changed, 103 insertions, 29 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index dc696e72ccd..31e4b4c186c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,61 @@ +2010-08-25 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/11944 + * elf-bfd.h (elf_backend_data): Add target_id. + (bfd_elf_make_generic_object): Renamed to ... + (bfd_elf_make_object): This. + + * elf.c (bfd_elf_make_generic_object): Removed. + (bfd_elf_make_object): New. + (bfd_elf_mkcorefile): Really treat it as an object file. + + * elf-m10300.c (ELF_TARGET_ID): New. + * elf32-arm.c (ELF_TARGET_ID): Likewise. + * elf32-bfin.c (ELF_TARGET_ID): Likewise. + * elf32-cris.c (ELF_TARGET_ID): Likewise. + * elf32-frv.c (ELF_TARGET_ID): Likewise. + * elf32-i386.c (ELF_TARGET_ID): Likewise. + * elf32-lm32.c (ELF_TARGET_ID): Likewise. + * elf32-m32r.c (ELF_TARGET_ID): Likewise. + * elf32-m68hc11.c (ELF_TARGET_ID): Likewise. + * elf32-m68hc12.c (ELF_TARGET_ID): Likewise. + * elf32-m68k.c (ELF_TARGET_ID): Likewise. + * elf32-microblaze.c (ELF_TARGET_ID): Likewise. + * elf32-ppc.c (ELF_TARGET_ID): Likewise. + * elf32-s390.c (ELF_TARGET_ID): Likewise. + * elf32-sh.c (ELF_TARGET_ID): Likewise. + * elf32-sparc.c (ELF_TARGET_ID): Likewise. + * elf32-spu.c (ELF_TARGET_ID): Likewise. + * elf32-tic6x.c (ELF_TARGET_ID): Likewise. + * elf32-xtensa.c (ELF_TARGET_ID): Likewise. + * elf64-alpha.c (ELF_TARGET_ID): Likewise. + * elf64-hppa.c (ELF_TARGET_ID): Likewise. + * elf64-ppc.c (ELF_TARGET_ID): Likewise. + * elf64-s390.c (ELF_TARGET_ID): Likewise. + * elf64-x86-64.c (ELF_TARGET_ID): Likewise. + * elfxx-ia64.c (ELF_TARGET_ID): Likewise. + + * elf32-hppa.c (elf32_hppa_mkobject): Removed. + (bfd_elf32_mkobject): Likewise. + (ELF_TARGET_ID): New. + + * elf32-mips.c (ELF_TARGET_ID): New. + (bfd_elf32_mkobject): Removed. + + * elf64-mips.c (ELF_TARGET_ID): New. + (bfd_elf64_mkobject): Removed. + + * elfn32-mips.c (ELF_TARGET_ID): New. + (bfd_elf32_mkobject): Removed. + + * elfxx-mips.c (_bfd_mips_elf_mkobject): Removed. + * elfxx-mips.h (_bfd_mips_elf_mkobject): Likewise. + + * elfxx-target.h (bfd_elfNN_mkobject): Default to + bfd_elf_make_object. + (ELF_TARGET_ID): New. Default to GENERIC_ELF_DATA. + (elfNN_bed): Initialize target_id. + 2010-08-25 Julian Brown <julian@codesourcery.com> * elf32-arm.c (arm_stub_required_alignment): New. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 2220d4db5c2..dbcebd2c6bb 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -689,6 +689,10 @@ struct elf_backend_data /* The architecture for this backend. */ enum bfd_architecture arch; + /* An identifier used to distinguish different target specific + extensions to elf_obj_tdata and elf_link_hash_table structures. */ + enum elf_target_id target_id; + /* The ELF machine code (EM_xxxx) for this backend. */ int elf_machine_code; @@ -1739,7 +1743,7 @@ extern bfd_reloc_status_type bfd_elf_generic_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); extern bfd_boolean bfd_elf_allocate_object (bfd *, size_t, enum elf_target_id); -extern bfd_boolean bfd_elf_make_generic_object +extern bfd_boolean bfd_elf_make_object (bfd *); extern bfd_boolean bfd_elf_mkcorefile (bfd *); diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index f151c21d278..a4da9d52a62 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -4893,6 +4893,7 @@ _bfd_mn10300_elf_reloc_type_class (const Elf_Internal_Rela *rela) #define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec #define TARGET_LITTLE_NAME "elf32-mn10300" #define ELF_ARCH bfd_arch_mn10300 +#define ELF_TARGET_ID MN10300_ELF_DATA #define ELF_MACHINE_CODE EM_MN10300 #define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300 #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf.c b/bfd/elf.c index 9c56e2e7b1f..f4e505876a4 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -250,17 +250,18 @@ bfd_elf_allocate_object (bfd *abfd, bfd_boolean -bfd_elf_make_generic_object (bfd *abfd) +bfd_elf_make_object (bfd *abfd) { + const struct elf_backend_data *bed = get_elf_backend_data (abfd); return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata), - GENERIC_ELF_DATA); + bed->target_id); } bfd_boolean bfd_elf_mkcorefile (bfd *abfd) { /* I think this can be done just like an object file. */ - return bfd_elf_make_generic_object (abfd); + return abfd->xvec->_bfd_set_format[(int) bfd_object] (abfd); } static char * diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 390c0af0601..f81831995a3 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -13900,6 +13900,7 @@ const struct elf_size_info elf32_arm_size_info = }; #define ELF_ARCH bfd_arch_arm +#define ELF_TARGET_ID ARM_ELF_DATA #define ELF_MACHINE_CODE EM_ARM #ifdef __QNXTARGET__ #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index a9b41fab25f..7334340fd98 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -2991,6 +2991,7 @@ elf32_avr_build_stubs (struct bfd_link_info *info) } #define ELF_ARCH bfd_arch_avr +#define ELF_TARGET_ID AVR_ELF_DATA #define ELF_MACHINE_CODE EM_AVR #define ELF_MACHINE_ALT1 EM_AVR_OLD #define ELF_MAXPAGESIZE 1 diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index e8cdf22d868..ac41d63b3fa 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -5764,6 +5764,7 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] = #define TARGET_LITTLE_SYM bfd_elf32_bfin_vec #define TARGET_LITTLE_NAME "elf32-bfin" #define ELF_ARCH bfd_arch_bfin +#define ELF_TARGET_ID BFIN_ELF_DATA #define ELF_MACHINE_CODE EM_BLACKFIN #define ELF_MAXPAGESIZE 0x1000 #define elf_symbol_leading_char '_' diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 0129d6a8148..71634c93ebd 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -4364,6 +4364,7 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBUTE_UNUSED, } #define ELF_ARCH bfd_arch_cris +#define ELF_TARGET_ID CRIS_ELF_DATA #define ELF_MACHINE_CODE EM_CRIS #define ELF_MAXPAGESIZE 0x2000 diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 811d5f5b3ae..2acc9173ce7 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -6994,6 +6994,7 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } #define ELF_ARCH bfd_arch_frv +#define ELF_TARGET_ID FRV_ELF_DATA #define ELF_MACHINE_CODE EM_CYGNUS_FRV #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 794de8282ca..1a6fef88273 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -336,15 +336,6 @@ struct elf32_hppa_link_hash_table #define eh_name(eh) \ (eh ? eh->root.root.string : "<undef>") -/* Override the generic function because we want to mark our BFDs. */ - -static bfd_boolean -elf32_hppa_mkobject (bfd *abfd) -{ - return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata), - HPPA32_ELF_DATA); -} - /* Assorted hash table functions. */ /* Initialize an entry in the stub hash table. */ @@ -4649,7 +4640,6 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) #define elf_info_to_howto_rel elf_hppa_info_to_howto_rel /* Stuff for the BFD linker. */ -#define bfd_elf32_mkobject elf32_hppa_mkobject #define bfd_elf32_bfd_final_link elf32_hppa_final_link #define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create #define bfd_elf32_bfd_link_hash_table_free elf32_hppa_link_hash_table_free @@ -4687,6 +4677,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) #define TARGET_BIG_SYM bfd_elf32_hppa_vec #define TARGET_BIG_NAME "elf32-hppa" #define ELF_ARCH bfd_arch_hppa +#define ELF_TARGET_ID HPPA32_ELF_DATA #define ELF_MACHINE_CODE EM_PARISC #define ELF_MAXPAGESIZE 0x1000 #define ELF_OSABI ELFOSABI_HPUX diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 581f218c8ca..7a426d51274 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -4692,6 +4692,7 @@ elf_i386_add_symbol_hook (bfd * abfd, #define TARGET_LITTLE_SYM bfd_elf32_i386_vec #define TARGET_LITTLE_NAME "elf32-i386" #define ELF_ARCH bfd_arch_i386 +#define ELF_TARGET_ID I386_ELF_DATA #define ELF_MACHINE_CODE EM_386 #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 727fc7a3569..49b21307547 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -2853,6 +2853,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd) #define ELF_ARCH bfd_arch_lm32 +#define ELF_TARGET_ID LM32_ELF_DATA #define ELF_MACHINE_CODE EM_LATTICEMICO32 #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index e079c4a1005..28eff7666ce 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -4080,6 +4080,7 @@ m32r_elf_reloc_type_class (const Elf_Internal_Rela *rela) } #define ELF_ARCH bfd_arch_m32r +#define ELF_TARGET_ID M32R_ELF_DATA #define ELF_MACHINE_CODE EM_M32R #define ELF_MACHINE_ALT1 EM_CYGNUS_M32R #define ELF_MAXPAGESIZE 0x1 /* Explicitly requested by Mitsubishi. */ diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 79a19440444..63d0786bb60 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1285,6 +1285,7 @@ static const struct bfd_elf_special_section elf32_m68hc11_special_sections[] = }; #define ELF_ARCH bfd_arch_m68hc11 +#define ELF_TARGET_ID M68HC11_ELF_DATA #define ELF_MACHINE_CODE EM_68HC11 #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c index ba9293ba535..1788856f8f5 100644 --- a/bfd/elf32-m68hc12.c +++ b/bfd/elf32-m68hc12.c @@ -564,6 +564,7 @@ static const struct bfd_elf_special_section elf32_m68hc12_special_sections[] = }; #define ELF_ARCH bfd_arch_m68hc12 +#define ELF_TARGET_ID M68HC11_ELF_DATA #define ELF_MACHINE_CODE EM_68HC12 #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 975207fb5de..73236121761 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -469,6 +469,7 @@ reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) #define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup #define bfd_elf32_bfd_reloc_name_lookup reloc_name_lookup #define ELF_ARCH bfd_arch_m68k +#define ELF_TARGET_ID M68K_ELF_DATA /* Functions for the m68k ELF linker. */ diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index e4c319d2d4d..a64926a51ef 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -3026,6 +3026,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, #define TARGET_BIG_NAME "elf32-microblaze" #define ELF_ARCH bfd_arch_microblaze +#define ELF_TARGET_ID MICROBLAZE_ELF_DATA #define ELF_MACHINE_CODE EM_MICROBLAZE #define ELF_MACHINE_ALT1 EM_MICROBLAZE_OLD #define ELF_MAXPAGESIZE 0x4 /* 4k, if we ever have 'em. */ diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index aabf2847fed..aed0b4c9742 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -1605,6 +1605,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { }; #define ELF_ARCH bfd_arch_mips +#define ELF_TARGET_ID MIPS_ELF_DATA #define ELF_MACHINE_CODE EM_MIPS #define elf_backend_collect TRUE @@ -1676,7 +1677,6 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf32_bfd_get_relocated_section_contents \ _bfd_elf_mips_get_relocated_section_contents -#define bfd_elf32_mkobject _bfd_mips_elf_mkobject #define bfd_elf32_bfd_link_hash_table_create \ _bfd_mips_elf_link_hash_table_create #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index eb8d5404e5f..ef0e15927e9 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -8927,6 +8927,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #define TARGET_BIG_SYM bfd_elf32_powerpc_vec #define TARGET_BIG_NAME "elf32-powerpc" #define ELF_ARCH bfd_arch_powerpc +#define ELF_TARGET_ID PPC32_ELF_DATA #define ELF_MACHINE_CODE EM_PPC #ifdef __QNXTARGET__ #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 4f9e0b33636..bc8e054a841 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -3496,6 +3496,7 @@ elf32_s390_merge_private_bfd_data (bfd *ibfd, bfd *obfd) #define TARGET_BIG_SYM bfd_elf32_s390_vec #define TARGET_BIG_NAME "elf32-s390" #define ELF_ARCH bfd_arch_s390 +#define ELF_TARGET_ID S390_ELF_DATA #define ELF_MACHINE_CODE EM_S390 #define ELF_MACHINE_ALT1 EM_S390_OLD #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index e48017e13ae..023ed7ede7b 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -7569,6 +7569,7 @@ sh_elf_encode_eh_address (bfd *abfd, #endif #define ELF_ARCH bfd_arch_sh +#define ELF_TARGET_ID SH_ELF_DATA #define ELF_MACHINE_CODE EM_SH #ifdef __QNXTARGET__ #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 80102e9284f..adfe9247180 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -188,6 +188,7 @@ elf32_sparc_add_symbol_hook (bfd * abfd, #define TARGET_BIG_SYM bfd_elf32_sparc_vec #define TARGET_BIG_NAME "elf32-sparc" #define ELF_ARCH bfd_arch_sparc +#define ELF_TARGET_ID SPARC_ELF_DATA #define ELF_MACHINE_CODE EM_SPARC #define ELF_MACHINE_ALT1 EM_SPARC32PLUS #define ELF_MAXPAGESIZE 0x10000 diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index fb3a4faa411..8615e468ef3 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -5445,6 +5445,7 @@ spu_elf_size_sections (bfd * output_bfd, struct bfd_link_info *info) #define TARGET_BIG_SYM bfd_elf32_spu_vec #define TARGET_BIG_NAME "elf32-spu" #define ELF_ARCH bfd_arch_spu +#define ELF_TARGET_ID SPU_ELF_DATA #define ELF_MACHINE_CODE EM_SPU /* This matches the alignment need for DMA. */ #define ELF_MAXPAGESIZE 0x80 diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index dc837fba236..3815ff1f2d6 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -1753,6 +1753,7 @@ elf32_tic6x_merge_private_bfd_data (bfd *ibfd, bfd *obfd) #define TARGET_BIG_SYM bfd_elf32_tic6x_be_vec #define TARGET_BIG_NAME "elf32-tic6x-be" #define ELF_ARCH bfd_arch_tic6x +#define ELF_TARGET_ID TIC6X_ELF_DATA #define ELF_MACHINE_CODE EM_TI_C6000 #define ELF_MAXPAGESIZE 1 #define bfd_elf32_bfd_reloc_type_lookup elf32_tic6x_reloc_type_lookup diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 12788ec5fac..9b9b5de06a8 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -10766,6 +10766,7 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] = { NULL, 0, 0, 0, 0 } }; +#define ELF_TARGET_ID XTENSA_ELF_DATA #ifndef ELF_ARCH #define TARGET_LITTLE_SYM bfd_elf32_xtensa_le_vec #define TARGET_LITTLE_NAME "elf32-xtensa-le" diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 083beb14727..bd9a617de6d 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -5334,6 +5334,7 @@ static const struct elf_size_info alpha_elf_size_info = #define TARGET_LITTLE_SYM bfd_elf64_alpha_vec #define TARGET_LITTLE_NAME "elf64-alpha" #define ELF_ARCH bfd_arch_alpha +#define ELF_TARGET_ID ALPHA_ELF_DATA #define ELF_MACHINE_CODE EM_ALPHA #define ELF_MAXPAGESIZE 0x10000 #define ELF_COMMONPAGESIZE 0x2000 diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index e76593db34f..ba6b1f84c72 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -4045,6 +4045,7 @@ const struct elf_size_info hppa64_elf_size_info = #define TARGET_BIG_SYM bfd_elf64_hppa_vec #define TARGET_BIG_NAME "elf64-hppa" #define ELF_ARCH bfd_arch_hppa +#define ELF_TARGET_ID HPPA64_ELF_DATA #define ELF_MACHINE_CODE EM_PARISC /* This is not strictly correct. The maximum page size for PA2.0 is 64M. But everything still uses 4k. */ diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 33d7a87d105..bb079cf33e9 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -3207,6 +3207,7 @@ const struct elf_size_info mips_elf64_size_info = }; #define ELF_ARCH bfd_arch_mips +#define ELF_TARGET_ID MIPS_ELF_DATA #define ELF_MACHINE_CODE EM_MIPS #define elf_backend_collect TRUE @@ -3285,7 +3286,6 @@ const struct elf_size_info mips_elf64_size_info = #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf64_bfd_get_relocated_section_contents \ _bfd_elf_mips_get_relocated_section_contents -#define bfd_elf64_mkobject _bfd_mips_elf_mkobject #define bfd_elf64_bfd_link_hash_table_create \ _bfd_mips_elf_link_hash_table_create #define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 954d18df3a1..2073bdc11da 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -61,6 +61,7 @@ static bfd_vma opd_entry_value #define TARGET_BIG_SYM bfd_elf64_powerpc_vec #define TARGET_BIG_NAME "elf64-powerpc" #define ELF_ARCH bfd_arch_powerpc +#define ELF_TARGET_ID PPC64_ELF_DATA #define ELF_MACHINE_CODE EM_PPC64 #define ELF_MAXPAGESIZE 0x10000 #define ELF_COMMONPAGESIZE 0x1000 diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index e994e461061..2f253b93ed2 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -3415,6 +3415,7 @@ const struct elf_size_info s390_elf64_size_info = #define TARGET_BIG_SYM bfd_elf64_s390_vec #define TARGET_BIG_NAME "elf64-s390" #define ELF_ARCH bfd_arch_s390 +#define ELF_TARGET_ID S390_ELF_DATA #define ELF_MACHINE_CODE EM_S390 #define ELF_MACHINE_ALT1 EM_S390_OLD #define ELF_MAXPAGESIZE 0x1000 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index f11584b8a92..9da73a1f500 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -4456,6 +4456,7 @@ static const struct bfd_elf_special_section #define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec #define TARGET_LITTLE_NAME "elf64-x86-64" #define ELF_ARCH bfd_arch_i386 +#define ELF_TARGET_ID X86_64_ELF_DATA #define ELF_MACHINE_CODE EM_X86_64 #define ELF_MAXPAGESIZE 0x200000 #define ELF_MINPAGESIZE 0x1000 diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 0aa25e72808..8338bbb3814 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -2431,6 +2431,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { }; #define ELF_ARCH bfd_arch_mips +#define ELF_TARGET_ID MIPS_ELF_DATA #define ELF_MACHINE_CODE EM_MIPS #define elf_backend_collect TRUE @@ -2504,7 +2505,6 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf32_bfd_get_relocated_section_contents \ _bfd_elf_mips_get_relocated_section_contents -#define bfd_elf32_mkobject _bfd_mips_elf_mkobject #define bfd_elf32_bfd_link_hash_table_create \ _bfd_mips_elf_link_hash_table_create #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 0646ed1a8fc..c8588b97511 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -5996,6 +5996,7 @@ elfNN_vms_close_and_cleanup (bfd *abfd) #define TARGET_BIG_SYM bfd_elfNN_ia64_big_vec #define TARGET_BIG_NAME "elfNN-ia64-big" #define ELF_ARCH bfd_arch_ia64 +#define ELF_TARGET_ID IA64_ELF_DATA #define ELF_MACHINE_CODE EM_IA_64 #define ELF_MACHINE_ALT1 1999 /* EAS2.3 */ #define ELF_MACHINE_ALT2 1998 /* EAS2.2 */ diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index e9a9c27e100..78f96c19e46 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -11520,15 +11520,6 @@ error_return: return NULL; } -/* Allocate ABFD's target-dependent data. */ - -bfd_boolean -_bfd_mips_elf_mkobject (bfd *abfd) -{ - return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata), - MIPS_ELF_DATA); -} - /* Create a MIPS ELF linker hash table. */ struct bfd_link_hash_table * diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 096bd132478..85cbfb842c8 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -92,8 +92,6 @@ extern bfd_boolean _bfd_mips_elf_set_section_contents extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, bfd_boolean, asymbol **); -extern bfd_boolean _bfd_mips_elf_mkobject - (bfd *); extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create (bfd *); extern struct bfd_link_hash_table *_bfd_mips_vxworks_link_hash_table_create diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index ebce6a8f07a..00fd693ba71 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -278,7 +278,7 @@ #endif #ifndef bfd_elfNN_mkobject -#define bfd_elfNN_mkobject bfd_elf_make_generic_object +#define bfd_elfNN_mkobject bfd_elf_make_object #endif #ifndef bfd_elfNN_mkcorefile @@ -305,6 +305,10 @@ #define elf_info_to_howto_rel 0 #endif +#ifndef ELF_TARGET_ID +#define ELF_TARGET_ID GENERIC_ELF_DATA +#endif + #ifndef ELF_OSABI #define ELF_OSABI ELFOSABI_NONE #endif @@ -638,6 +642,7 @@ extern const struct elf_size_info _bfd_elfNN_size_info; static struct elf_backend_data elfNN_bed = { ELF_ARCH, /* arch */ + ELF_TARGET_ID, /* target_id */ ELF_MACHINE_CODE, /* elf_machine_code */ ELF_OSABI, /* elf_osabi */ ELF_MAXPAGESIZE, /* maxpagesize */ |