From e234935207c21a212b5a35928f50b578c65b9649 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 17 Dec 2013 11:48:18 -0800 Subject: 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. --- bfd/ChangeLog | 28 ++++++++++++++++++++++++++++ bfd/elf32-arm.c | 9 +-------- bfd/elf32-bfin.c | 42 ------------------------------------------ bfd/elf32-frv.c | 42 ------------------------------------------ bfd/elf32-iq2000.c | 22 ---------------------- bfd/elf32-lm32.c | 22 +--------------------- bfd/elf32-mep.c | 17 ----------------- bfd/elf32-msp430.c | 12 ------------ bfd/elf32-mt.c | 20 -------------------- bfd/elf32-sh.c | 23 ++++------------------- bfd/elfnn-aarch64.c | 28 ---------------------------- 11 files changed, 34 insertions(+), 231 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 19596a9..9c6bfd4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,33 @@ 2013-12-17 H.J. Lu + 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 + * peXXigen.c (rsrc_process_section): Rename index to indx. 2013-12-17 Nick Clifton diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 70d6ac0..b023499 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -11158,14 +11158,7 @@ elf32_arm_copy_private_bfd_data (bfd *ibfd, bfd *obfd) 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; + return _bfd_elf_copy_private_bfd_data (ibfd, obfd); } /* Values for Tag_ABI_PCS_R9_use. */ diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 73d0d09..6479386 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -4931,45 +4931,6 @@ elf32_bfin_set_private_flags (bfd * abfd, flagword flags) 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. */ static bfd_boolean 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 #define elf_backend_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 #define elf_backend_create_dynamic_sections \ diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index cf187ac..159abd1 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -6313,27 +6313,6 @@ frv_elf_set_private_flags (bfd *abfd, flagword flags) 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 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; } -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 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_name_lookup frv_reloc_name_lookup #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_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 #define elf_backend_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 #define elf_backend_create_dynamic_sections \ diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index ff7ef4a..0155ec4 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -763,27 +763,6 @@ iq2000_elf_set_private_flags (bfd *abfd, flagword flags) 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 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_name_lookup iq2000_reloc_name_lookup #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_print_private_bfd_data iq2000_elf_print_private_bfd_data diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 4ebe534..99aabea 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -2627,26 +2627,6 @@ lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) } 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 lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd) { unsigned i; @@ -2655,7 +2635,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd) || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return TRUE; - if (! lm32_elf_copy_private_bfd_data (ibfd, obfd)) + if (! _bfd_elf_copy_private_bfd_data (ibfd, obfd)) return FALSE; if (! elf_tdata (ibfd) || ! elf_tdata (ibfd)->phdr diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c index 2204488..b4a193d 100644 --- a/bfd/elf32-mep.c +++ b/bfd/elf32-mep.c @@ -580,22 +580,6 @@ mep_elf_set_private_flags (bfd * abfd, 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 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_name_lookup mep_reloc_name_lookup #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_print_private_bfd_data mep_elf_print_private_bfd_data diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index 533eea3..3d8d22f 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -2392,17 +2392,6 @@ elf32_msp430_merge_private_bfd_data (bfd * ibfd, bfd * 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 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 #undef elf_backend_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 ELF_ARCH bfd_arch_msp430 diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c index 597665c..00152a3 100644 --- a/bfd/elf32-mt.c +++ b/bfd/elf32-mt.c @@ -497,25 +497,6 @@ mt_elf_set_private_flags (bfd * abfd, 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 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 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_print_private_bfd_data mt_elf_print_private_bfd_data diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 7e6a18b..ac23a72 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -6582,34 +6582,19 @@ sh_elf_get_flags_from_mach (unsigned long mach) } #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 /* Copy backend specific data from one object module to another */ static bfd_boolean 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)) 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 */ diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 6a42bc5..22f95d3 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4538,31 +4538,6 @@ elfNN_aarch64_set_private_flags (bfd *abfd, flagword flags) 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 object file when linking. */ @@ -7226,9 +7201,6 @@ const struct elf_size_info elfNN_aarch64_size_info = #define bfd_elfNN_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 \ elfNN_aarch64_bfd_free_cached_info -- cgit v1.1