Use _bfd_elf_copy_private_bfd_data

PR binutils/16318
	* elf32-arm.c (elf32_arm_copy_private_bfd_data): Call
	_bfd_elf_copy_private_bfd_data.
	* elf32-bfin.c (bfin_elf_copy_private_bfd_data): Removed.
	(elf32_bfinfdpic_copy_private_bfd_data): Likewise.
	(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
	* elf32-frv.c (frv_elf_copy_private_bfd_data): Removed.
	(elf32_frvfdpic_copy_private_bfd_data): Likewise.
	(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
	* elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Removed.
	(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
	* elf32-lm32.c (lm32_elf_copy_private_bfd_data): Removed.
	(lm32_elf_fdpic_copy_private_bfd_data): Call
	_bfd_elf_copy_private_bfd_data.
	* elf32-mep.c (mep_elf_copy_private_bfd_data): Removed.
	(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
	* elf32-msp430.c (elf32_msp430_copy_private_bfd_data): Removed.
	(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
	* elf32-mt.c (mt_elf_copy_private_bfd_data): Removed.
	(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
	* elf32-sh.c (sh_elf_set_private_flags): Removed.
	(sh_elf_copy_private_data): Call _bfd_elf_copy_private_bfd_data
	and sh_elf_set_mach_from_flags.
	*  elfnn-aarch64.c (elfNN_aarch64_copy_private_bfd_data): Removed.
	(bfd_elfNN_bfd_copy_private_bfd_data): Don't define.
This commit is contained in:
H.J. Lu
2013-12-17 11:48:18 -08:00
parent 337e86d7c5
commit e234935207
11 changed files with 34 additions and 231 deletions

View File

@ -1,3 +1,31 @@
2013-12-17 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/16318
* elf32-arm.c (elf32_arm_copy_private_bfd_data): Call
_bfd_elf_copy_private_bfd_data.
* elf32-bfin.c (bfin_elf_copy_private_bfd_data): Removed.
(elf32_bfinfdpic_copy_private_bfd_data): Likewise.
(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
* elf32-frv.c (frv_elf_copy_private_bfd_data): Removed.
(elf32_frvfdpic_copy_private_bfd_data): Likewise.
(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
* elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Removed.
(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
* elf32-lm32.c (lm32_elf_copy_private_bfd_data): Removed.
(lm32_elf_fdpic_copy_private_bfd_data): Call
_bfd_elf_copy_private_bfd_data.
* elf32-mep.c (mep_elf_copy_private_bfd_data): Removed.
(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
* elf32-msp430.c (elf32_msp430_copy_private_bfd_data): Removed.
(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
* elf32-mt.c (mt_elf_copy_private_bfd_data): Removed.
(bfd_elf32_bfd_copy_private_bfd_data): Don't define.
* elf32-sh.c (sh_elf_set_private_flags): Removed.
(sh_elf_copy_private_data): Call _bfd_elf_copy_private_bfd_data
and sh_elf_set_mach_from_flags.
* elfnn-aarch64.c (elfNN_aarch64_copy_private_bfd_data): Removed.
(bfd_elfNN_bfd_copy_private_bfd_data): Don't define.
2013-12-17 H.J. Lu <hongjiu.lu@intel.com> 2013-12-17 H.J. Lu <hongjiu.lu@intel.com>
* peXXigen.c (rsrc_process_section): Rename index to indx. * peXXigen.c (rsrc_process_section): Rename index to indx.

View File

@ -11158,14 +11158,7 @@ elf32_arm_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
elf_elfheader (obfd)->e_flags = in_flags; elf_elfheader (obfd)->e_flags = in_flags;
elf_flags_init (obfd) = TRUE; elf_flags_init (obfd) = TRUE;
/* Also copy the EI_OSABI field. */ return _bfd_elf_copy_private_bfd_data (ibfd, obfd);
elf_elfheader (obfd)->e_ident[EI_OSABI] =
elf_elfheader (ibfd)->e_ident[EI_OSABI];
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
} }
/* Values for Tag_ABI_PCS_R9_use. */ /* Values for Tag_ABI_PCS_R9_use. */

View File

@ -4931,45 +4931,6 @@ elf32_bfin_set_private_flags (bfd * abfd, flagword flags)
return TRUE; return TRUE;
} }
/* Copy backend specific data from one object module to another. */
static bfd_boolean
bfin_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
BFD_ASSERT (!elf_flags_init (obfd)
|| elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
static bfd_boolean
elf32_bfinfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
if (! bfin_elf_copy_private_bfd_data (ibfd, obfd))
return FALSE;
if (! elf_tdata (ibfd) || ! elf_tdata (ibfd)->phdr
|| ! elf_tdata (obfd) || ! elf_tdata (obfd)->phdr)
return TRUE;
return TRUE;
}
/* Display the flags field. */ /* Display the flags field. */
static bfd_boolean static bfd_boolean
elf32_bfin_print_private_bfd_data (bfd * abfd, void * ptr) elf32_bfin_print_private_bfd_data (bfd * abfd, void * ptr)
@ -5749,9 +5710,6 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] =
#undef elf_backend_always_size_sections #undef elf_backend_always_size_sections
#define elf_backend_always_size_sections \ #define elf_backend_always_size_sections \
elf32_bfinfdpic_always_size_sections elf32_bfinfdpic_always_size_sections
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data \
elf32_bfinfdpic_copy_private_bfd_data
#undef elf_backend_create_dynamic_sections #undef elf_backend_create_dynamic_sections
#define elf_backend_create_dynamic_sections \ #define elf_backend_create_dynamic_sections \

View File

@ -6313,27 +6313,6 @@ frv_elf_set_private_flags (bfd *abfd, flagword flags)
return TRUE; return TRUE;
} }
/* Copy backend specific data from one object module to another. */
static bfd_boolean
frv_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
BFD_ASSERT (!elf_flags_init (obfd)
|| elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
/* Return true if the architecture described by elf header flag /* Return true if the architecture described by elf header flag
EXTENSION is an extension of the architecture described by BASE. */ EXTENSION is an extension of the architecture described by BASE. */
@ -6361,23 +6340,6 @@ frv_elf_arch_extension_p (flagword base, flagword extension)
return FALSE; return FALSE;
} }
static bfd_boolean
elf32_frvfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
if (! frv_elf_copy_private_bfd_data (ibfd, obfd))
return FALSE;
if (! elf_tdata (ibfd) || ! elf_tdata (ibfd)->phdr
|| ! elf_tdata (obfd) || ! elf_tdata (obfd)->phdr)
return TRUE;
return TRUE;
}
/* Merge backend specific data from an object file to the output /* Merge backend specific data from an object file to the output
object file when linking. */ object file when linking. */
@ -6833,7 +6795,6 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#define bfd_elf32_bfd_reloc_type_lookup frv_reloc_type_lookup #define bfd_elf32_bfd_reloc_type_lookup frv_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup frv_reloc_name_lookup #define bfd_elf32_bfd_reloc_name_lookup frv_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags frv_elf_set_private_flags #define bfd_elf32_bfd_set_private_flags frv_elf_set_private_flags
#define bfd_elf32_bfd_copy_private_bfd_data frv_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data frv_elf_merge_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data frv_elf_merge_private_bfd_data
#define bfd_elf32_bfd_print_private_bfd_data frv_elf_print_private_bfd_data #define bfd_elf32_bfd_print_private_bfd_data frv_elf_print_private_bfd_data
@ -6871,9 +6832,6 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#undef elf_backend_always_size_sections #undef elf_backend_always_size_sections
#define elf_backend_always_size_sections \ #define elf_backend_always_size_sections \
elf32_frvfdpic_always_size_sections elf32_frvfdpic_always_size_sections
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data \
elf32_frvfdpic_copy_private_bfd_data
#undef elf_backend_create_dynamic_sections #undef elf_backend_create_dynamic_sections
#define elf_backend_create_dynamic_sections \ #define elf_backend_create_dynamic_sections \

View File

@ -763,27 +763,6 @@ iq2000_elf_set_private_flags (bfd *abfd, flagword flags)
return TRUE; return TRUE;
} }
/* Copy backend specific data from one object module to another. */
static bfd_boolean
iq2000_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
BFD_ASSERT (!elf_flags_init (obfd)
|| elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
/* Merge backend specific data from an object /* Merge backend specific data from an object
file to the output object file when linking. */ file to the output object file when linking. */
@ -931,7 +910,6 @@ iq2000_elf_object_p (bfd *abfd)
#define bfd_elf32_bfd_reloc_type_lookup iq2000_reloc_type_lookup #define bfd_elf32_bfd_reloc_type_lookup iq2000_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup iq2000_reloc_name_lookup #define bfd_elf32_bfd_reloc_name_lookup iq2000_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags iq2000_elf_set_private_flags #define bfd_elf32_bfd_set_private_flags iq2000_elf_set_private_flags
#define bfd_elf32_bfd_copy_private_bfd_data iq2000_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data iq2000_elf_merge_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data iq2000_elf_merge_private_bfd_data
#define bfd_elf32_bfd_print_private_bfd_data iq2000_elf_print_private_bfd_data #define bfd_elf32_bfd_print_private_bfd_data iq2000_elf_print_private_bfd_data

View File

@ -2626,26 +2626,6 @@ lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
return TRUE; return TRUE;
} }
static bfd_boolean
lm32_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
BFD_ASSERT (!elf_flags_init (obfd)
|| elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
static bfd_boolean static bfd_boolean
lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd) lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{ {
@ -2655,7 +2635,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour) || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE; return TRUE;
if (! lm32_elf_copy_private_bfd_data (ibfd, obfd)) if (! _bfd_elf_copy_private_bfd_data (ibfd, obfd))
return FALSE; return FALSE;
if (! elf_tdata (ibfd) || ! elf_tdata (ibfd)->phdr if (! elf_tdata (ibfd) || ! elf_tdata (ibfd)->phdr

View File

@ -580,22 +580,6 @@ mep_elf_set_private_flags (bfd * abfd,
return TRUE; return TRUE;
} }
static bfd_boolean
mep_elf_copy_private_bfd_data (bfd * ibfd, bfd * obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
/* Merge backend specific data from an object file to the output /* Merge backend specific data from an object file to the output
object file when linking. */ object file when linking. */
@ -778,7 +762,6 @@ mep_elf_fake_sections (bfd * abfd ATTRIBUTE_UNUSED,
#define bfd_elf32_bfd_reloc_type_lookup mep_reloc_type_lookup #define bfd_elf32_bfd_reloc_type_lookup mep_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup mep_reloc_name_lookup #define bfd_elf32_bfd_reloc_name_lookup mep_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags mep_elf_set_private_flags #define bfd_elf32_bfd_set_private_flags mep_elf_set_private_flags
#define bfd_elf32_bfd_copy_private_bfd_data mep_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data mep_elf_merge_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data mep_elf_merge_private_bfd_data
#define bfd_elf32_bfd_print_private_bfd_data mep_elf_print_private_bfd_data #define bfd_elf32_bfd_print_private_bfd_data mep_elf_print_private_bfd_data

View File

@ -2392,17 +2392,6 @@ elf32_msp430_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
return elf32_msp430_merge_mspabi_attributes (ibfd, obfd); return elf32_msp430_merge_mspabi_attributes (ibfd, obfd);
} }
/* Copy backend specific data from one object module to another. */
static bfd_boolean
elf32_msp430_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
static bfd_boolean static bfd_boolean
msp430_elf_is_target_special_symbol (bfd *abfd, asymbol *sym) msp430_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
{ {
@ -2439,7 +2428,6 @@ msp430_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
#define elf_backend_obj_attrs_handle_unknown elf32_msp430_obj_attrs_handle_unknown #define elf_backend_obj_attrs_handle_unknown elf32_msp430_obj_attrs_handle_unknown
#undef elf_backend_obj_attrs_arg_type #undef elf_backend_obj_attrs_arg_type
#define elf_backend_obj_attrs_arg_type elf32_msp430_obj_attrs_arg_type #define elf_backend_obj_attrs_arg_type elf32_msp430_obj_attrs_arg_type
#define bfd_elf32_bfd_copy_private_bfd_data elf32_msp430_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data elf32_msp430_merge_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data elf32_msp430_merge_private_bfd_data
#define ELF_ARCH bfd_arch_msp430 #define ELF_ARCH bfd_arch_msp430

View File

@ -497,25 +497,6 @@ mt_elf_set_private_flags (bfd * abfd,
return TRUE; return TRUE;
} }
static bfd_boolean
mt_elf_copy_private_bfd_data (bfd * ibfd, bfd * obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
BFD_ASSERT (!elf_flags_init (obfd)
|| elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
/* Merge backend specific data from an object file to the output /* Merge backend specific data from an object file to the output
object file when linking. */ object file when linking. */
@ -615,7 +596,6 @@ mt_elf_print_private_bfd_data (bfd * abfd, void * ptr)
#define elf_backend_can_gc_sections 1 #define elf_backend_can_gc_sections 1
#define bfd_elf32_bfd_set_private_flags mt_elf_set_private_flags #define bfd_elf32_bfd_set_private_flags mt_elf_set_private_flags
#define bfd_elf32_bfd_copy_private_bfd_data mt_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data mt_elf_merge_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data mt_elf_merge_private_bfd_data
#define bfd_elf32_bfd_print_private_bfd_data mt_elf_print_private_bfd_data #define bfd_elf32_bfd_print_private_bfd_data mt_elf_print_private_bfd_data

View File

@ -6582,34 +6582,19 @@ sh_elf_get_flags_from_mach (unsigned long mach)
} }
#endif /* not sh_elf_set_mach_from_flags */ #endif /* not sh_elf_set_mach_from_flags */
#ifndef sh_elf_set_private_flags
/* Function to keep SH specific file flags. */
static bfd_boolean
sh_elf_set_private_flags (bfd *abfd, flagword flags)
{
BFD_ASSERT (! elf_flags_init (abfd)
|| elf_elfheader (abfd)->e_flags == flags);
elf_elfheader (abfd)->e_flags = flags;
elf_flags_init (abfd) = TRUE;
return sh_elf_set_mach_from_flags (abfd);
}
#endif /* not sh_elf_set_private_flags */
#ifndef sh_elf_copy_private_data #ifndef sh_elf_copy_private_data
/* Copy backend specific data from one object module to another */ /* Copy backend specific data from one object module to another */
static bfd_boolean static bfd_boolean
sh_elf_copy_private_data (bfd * ibfd, bfd * obfd) sh_elf_copy_private_data (bfd * ibfd, bfd * obfd)
{ {
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
if (! is_sh_elf (ibfd) || ! is_sh_elf (obfd)) if (! is_sh_elf (ibfd) || ! is_sh_elf (obfd))
return TRUE; return TRUE;
return sh_elf_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags); if (! _bfd_elf_copy_private_bfd_data (ibfd, obfd))
return FALSE;
return sh_elf_set_mach_from_flags (obfd);
} }
#endif /* not sh_elf_copy_private_data */ #endif /* not sh_elf_copy_private_data */

View File

@ -4538,31 +4538,6 @@ elfNN_aarch64_set_private_flags (bfd *abfd, flagword flags)
return TRUE; return TRUE;
} }
/* Copy backend specific data from one object module to another. */
static bfd_boolean
elfNN_aarch64_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
flagword in_flags;
if (!is_aarch64_elf (ibfd) || !is_aarch64_elf (obfd))
return TRUE;
in_flags = elf_elfheader (ibfd)->e_flags;
elf_elfheader (obfd)->e_flags = in_flags;
elf_flags_init (obfd) = TRUE;
/* Also copy the EI_OSABI field. */
elf_elfheader (obfd)->e_ident[EI_OSABI] =
elf_elfheader (ibfd)->e_ident[EI_OSABI];
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
/* Merge backend specific data from an object file to the output /* Merge backend specific data from an object file to the output
object file when linking. */ object file when linking. */
@ -7226,9 +7201,6 @@ const struct elf_size_info elfNN_aarch64_size_info =
#define bfd_elfNN_close_and_cleanup \ #define bfd_elfNN_close_and_cleanup \
elfNN_aarch64_close_and_cleanup elfNN_aarch64_close_and_cleanup
#define bfd_elfNN_bfd_copy_private_bfd_data \
elfNN_aarch64_copy_private_bfd_data
#define bfd_elfNN_bfd_free_cached_info \ #define bfd_elfNN_bfd_free_cached_info \
elfNN_aarch64_bfd_free_cached_info elfNN_aarch64_bfd_free_cached_info