From 39946cc227a1bfbae6d6a2a968f4935d9f8b92a7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 1 Sep 2017 12:09:03 -0700 Subject: [PATCH] x86: Add _bfd_x86_elf_mkobject Share _bfd_x86_elf_mkobject in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_mkobject): Removed. (bfd_elf32_mkobject): Likewise. * elf64-x86-64.c (elf_x86_64_mkobject): Likewise. (bfd_elf64_mkobject): Likewise. (bfd_elf32_mkobject): Likewise. * elfxx-x86.c (_bfd_x86_elf_mkobject): New function. (_bfd_x86_elf_mkobject): New. (bfd_elf64_mkobject): Likewise. (bfd_elf32_mkobject): Likewise. --- bfd/ChangeLog | 12 ++++++++++++ bfd/elf32-i386.c | 10 ---------- bfd/elf64-x86-64.c | 10 ---------- bfd/elfxx-x86.c | 8 ++++++++ bfd/elfxx-x86.h | 7 +++++++ 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cf2c530..e1cdd0a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,17 @@ 2017-09-01 H.J. Lu + * elf32-i386.c (elf_i386_mkobject): Removed. + (bfd_elf32_mkobject): Likewise. + * elf64-x86-64.c (elf_x86_64_mkobject): Likewise. + (bfd_elf64_mkobject): Likewise. + (bfd_elf32_mkobject): Likewise. + * elfxx-x86.c (_bfd_x86_elf_mkobject): New function. + (_bfd_x86_elf_mkobject): New. + (bfd_elf64_mkobject): Likewise. + (bfd_elf32_mkobject): Likewise. + +2017-09-01 H.J. Lu + * elf32-i386.c (elf_i386_link_setup_gnu_properties): Updated. Call _bfd_x86_elf_link_setup_gnu_properties. * elf64-x86-64.c (elf_x86_lazy_plt_layout): Initialize diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index a0d4285..4efc066 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -873,14 +873,6 @@ static const struct elf_i386_backend_data elf_i386_arch_bed = && elf_tdata (bfd) != NULL \ && elf_object_id (bfd) == I386_ELF_DATA) -static bfd_boolean -elf_i386_mkobject (bfd *abfd) -{ - return bfd_elf_allocate_object (abfd, - sizeof (struct elf_x86_obj_tdata), - I386_ELF_DATA); -} - #define elf_i386_compute_jump_table_size(htab) \ ((htab)->elf.srelplt->reloc_count * 4) @@ -5879,8 +5871,6 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info) #define elf_info_to_howto elf_i386_info_to_howto_rel #define elf_info_to_howto_rel elf_i386_info_to_howto_rel -#define bfd_elf32_mkobject elf_i386_mkobject - #define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name #define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup #define bfd_elf32_bfd_reloc_name_lookup elf_i386_reloc_name_lookup diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 547173b..bc08f64 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -985,13 +985,6 @@ static const struct elf_x86_64_backend_data elf_x86_64_arch_bed = && elf_tdata (bfd) != NULL \ && elf_object_id (bfd) == X86_64_ELF_DATA) -static bfd_boolean -elf_x86_64_mkobject (bfd *abfd) -{ - return bfd_elf_allocate_object (abfd, sizeof (struct elf_x86_obj_tdata), - X86_64_ELF_DATA); -} - #define elf_x86_64_compute_jump_table_size(htab) \ ((htab)->elf.srelplt->reloc_count * GOT_ENTRY_SIZE) @@ -6478,7 +6471,6 @@ elf_x86_64_special_sections[]= #define elf_backend_size_dynamic_sections elf_x86_64_size_dynamic_sections #define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_object_p elf64_x86_64_elf_object_p -#define bfd_elf64_mkobject elf_x86_64_mkobject #define bfd_elf64_get_synthetic_symtab elf_x86_64_get_synthetic_symtab #define elf_backend_section_from_shdr \ @@ -6766,8 +6758,6 @@ elf32_x86_64_nacl_elf_object_p (bfd *abfd) elf_x86_64_reloc_type_lookup #define bfd_elf32_bfd_reloc_name_lookup \ elf_x86_64_reloc_name_lookup -#define bfd_elf32_mkobject \ - elf_x86_64_mkobject #define bfd_elf32_get_synthetic_symtab \ elf_x86_64_get_synthetic_symtab diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index d43fe31..91bd615 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -31,6 +31,14 @@ #define ELF64_DYNAMIC_INTERPRETER "/lib/ld64.so.1" #define ELFX32_DYNAMIC_INTERPRETER "/lib/ldx32.so.1" +bfd_boolean +_bfd_x86_elf_mkobject (bfd *abfd) +{ + return bfd_elf_allocate_object (abfd, + sizeof (struct elf_x86_obj_tdata), + get_elf_backend_data (abfd)->target_id); +} + /* _TLS_MODULE_BASE_ needs to be treated especially when linking executables. Rather than setting it to the beginning of the TLS section, we have to set it to the end. This function may be called diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h index f0240b3..bc01ad9 100644 --- a/bfd/elfxx-x86.h +++ b/bfd/elfxx-x86.h @@ -365,6 +365,9 @@ struct elf_x86_plt #define elf_x86_local_tlsdesc_gotent(abfd) \ (elf_x86_tdata (abfd)->local_tlsdesc_gotent) +extern bfd_boolean _bfd_x86_elf_mkobject + (bfd *); + extern void _bfd_x86_elf_set_tls_module_base (struct bfd_link_info *); @@ -426,6 +429,10 @@ extern bfd_boolean _bfd_x86_elf_merge_gnu_properties extern bfd * _bfd_x86_elf_link_setup_gnu_properties (struct bfd_link_info *, struct elf_x86_plt_layout_table *); +#define bfd_elf64_mkobject \ + _bfd_x86_elf_mkobject +#define bfd_elf32_mkobject \ + _bfd_x86_elf_mkobject #define bfd_elf64_bfd_link_hash_table_create \ _bfd_x86_elf_link_hash_table_create #define bfd_elf32_bfd_link_hash_table_create \ -- 2.7.4