]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LoongArch: Add elfNN_loongarch_mkobject to initialize LoongArch tdata
authorXin Wang <yw987194828@gmail.com>
Fri, 6 Sep 2024 01:00:12 +0000 (09:00 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Thu, 24 Oct 2024 02:47:05 +0000 (10:47 +0800)
LoongArch: Add elfNN_loongarch_mkobject to initialize LoongArch tdata.

(cherry picked from commit 28489a70d4660d67e71d75e82286a6e1a7003b93)

bfd/elfnn-loongarch.c

index 08a4357d4b943a53e3adbb74e1fa6f3e6e217068..dae68911733c7b2453fb2557ab3986b0e977720c 100644 (file)
@@ -84,6 +84,14 @@ struct _bfd_loongarch_elf_obj_tdata
    && elf_tdata (bfd) != NULL                                          \
    && elf_object_id (bfd) == LARCH_ELF_DATA)
 
+static bool
+elfNN_loongarch_object (bfd *abfd)
+{
+  return bfd_elf_allocate_object (abfd,
+                                 sizeof (struct _bfd_loongarch_elf_obj_tdata),
+                                 LARCH_ELF_DATA);
+}
+
 struct loongarch_elf_link_hash_table
 {
   struct elf_link_hash_table elf;
@@ -5338,6 +5346,8 @@ elf_loongarch64_hash_symbol (struct elf_link_hash_entry *h)
 #define bfd_elfNN_bfd_reloc_name_lookup loongarch_reloc_name_lookup
 #define elf_info_to_howto_rel NULL /* Fall through to elf_info_to_howto.  */
 #define elf_info_to_howto loongarch_info_to_howto_rela
+#define bfd_elfNN_mkobject                                               \
+  elfNN_loongarch_object
 #define bfd_elfNN_bfd_merge_private_bfd_data                             \
   elfNN_loongarch_merge_private_bfd_data