RISC-V: Add elfNN_riscv_mkobject to initialize RISC-V tdata.
authorNelson Chu <nelson.chu@sifive.com>
Wed, 13 May 2020 08:05:45 +0000 (16:05 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Thu, 14 May 2020 02:39:54 +0000 (10:39 +0800)
For now we only have one char pointer in RISC-V tdata, so it should be fine.
But once we need more elements in tdata, then we may get some uninitialize
or unexpected values.  I do meet the same problem when extending the RISC-V
tdata.

bfd/
elfnn-riscv.c (elfNN_riscv_mkobject):  New function.  We need this
to initialize RISC-V tdata.

bfd/ChangeLog
bfd/elfnn-riscv.c

index 34932e777f9954d49738a0d323ef4df6a800f190..06a9f125af7247787ad8cd5ae30eed816a10377b 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-14  Nelson Chu  <nelson.chu@sifive.com>
+
+       * elfnn-riscv.c (elfNN_riscv_mkobject):  New function.  We need this
+       to initialize RISC-V tdata.
+
 2020-05-12  Gunther Nikl  <gnikl@justmail.de>
 
        * aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
index 473bf50f2de75272215e1f189c5aa0286f78ea3c..a9e8132505ba969027ac6aed9d336251fc9a2755 100644 (file)
@@ -98,6 +98,14 @@ struct _bfd_riscv_elf_obj_tdata
    && elf_tdata (bfd) != NULL                          \
    && elf_object_id (bfd) == RISCV_ELF_DATA)
 
+static bfd_boolean
+elfNN_riscv_mkobject (bfd *abfd)
+{
+  return bfd_elf_allocate_object (abfd,
+                                 sizeof (struct _bfd_riscv_elf_obj_tdata),
+                                 RISCV_ELF_DATA);
+}
+
 #include "elf/common.h"
 #include "elf/internal.h"
 
@@ -4363,6 +4371,7 @@ riscv_elf_obj_attrs_arg_type (int tag)
 #define elf_info_to_howto_rel               NULL
 #define elf_info_to_howto                   riscv_info_to_howto_rela
 #define bfd_elfNN_bfd_relax_section         _bfd_riscv_relax_section
+#define bfd_elfNN_mkobject                  elfNN_riscv_mkobject
 
 #define elf_backend_init_index_section      _bfd_elf_init_1_index_section
 
This page took 0.028558 seconds and 4 git commands to generate.