x86: Add _bfd_x86_elf_mkobject
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 1 Sep 2017 19:09:03 +0000 (12:09 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 1 Sep 2017 19:09:03 +0000 (12:09 -0700)
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
bfd/elf32-i386.c
bfd/elf64-x86-64.c
bfd/elfxx-x86.c
bfd/elfxx-x86.h

index cf2c530a65c1aeb714aa63b0ee0e33c7402cb7f1..e1cdd0abd799a6dae95e161076186648219944d3 100644 (file)
@@ -1,3 +1,15 @@
+2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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  <hongjiu.lu@intel.com>
 
        * elf32-i386.c (elf_i386_link_setup_gnu_properties): Updated.
index a0d428565960a5dc4e742eab3b8385d76b8ffa85..4efc066cde606d04ebebca8c7ce0083d6e85cfc0 100644 (file)
@@ -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
index 547173b0a700cc8e6a125278defaf53bacd0c370..bc08f647c4868710b9e06e3709ad880ce73f52cb 100644 (file)
@@ -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
 
index d43fe31ede64e907b1224849cd83e81c6986e8dd..91bd61557e31e83768b957f574d0ddd712b04f83 100644 (file)
 #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
index f0240b3474661676b65e3d8d869d821f346f3f27..bc01ad979e9ba76abc111164a67ea1ba4476f05d 100644 (file)
@@ -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 \