From: H.J. Lu Date: Fri, 1 Sep 2017 19:09:03 +0000 (-0700) Subject: x86: Add _bfd_x86_elf_mkobject X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=39946cc227a1bfbae6d6a2a968f4935d9f8b92a7;p=binutils-gdb.git 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cf2c530a65c..e1cdd0abd79 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +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. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index a0d42856596..4efc066cde6 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 547173b0a70..bc08f647c48 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 d43fe31ede6..91bd61557e3 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 f0240b34746..bc01ad979e9 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 \