This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/4] RISC-V/bfd: Hook elf_backend_object_p to set the mach type.
- From: Palmer Dabbelt <palmer at dabbelt dot com>
- To: patches at groups dot riscv dot org
- To: binutils at sourceware dot org
- To: Tristan Gingold <gingold at adacore dot com>
- Cc: Kuan-Lin Chen <rufus at andestech dot com>
- Date: Wed, 3 May 2017 22:06:15 -0700
- Subject: [PATCH 1/4] RISC-V/bfd: Hook elf_backend_object_p to set the mach type.
- Authentication-results: sourceware.org; auth=none
- References: <20170504050618.22460-1-palmer@dabbelt.com>
From: Kuan-Lin Chen <rufus@andestech.com>
---
bfd/ChangeLog | 4 ++++
bfd/elfnn-riscv.c | 14 ++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 76f7b82..0ba4d25 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2017-01-17 Kuan-Lin Chen <kuanlinchentw@gmail.com>
+
+ * elfnn-riscv.c (riscv_elf_object_p): New function.
+
2017-04-26 Maciej W. Rozycki <macro@imgtec.com>
PR ld/21334
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index ff25ebd..d1e62d0 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -3205,6 +3205,19 @@ riscv_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
return TRUE;
}
+/* Set the right mach type. */
+static bfd_boolean
+riscv_elf_object_p (bfd *abfd)
+{
+ /* There are only two mach types in RISCV currently. */
+ if (strcmp (abfd->xvec->name, "elf32-littleriscv") == 0)
+ bfd_default_set_arch_mach (abfd, bfd_arch_riscv, bfd_mach_riscv32);
+ else
+ bfd_default_set_arch_mach (abfd, bfd_arch_riscv, bfd_mach_riscv64);
+
+ return TRUE;
+}
+
#define TARGET_LITTLE_SYM riscv_elfNN_vec
#define TARGET_LITTLE_NAME "elfNN-littleriscv"
@@ -3230,6 +3243,7 @@ riscv_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#define elf_backend_plt_sym_val riscv_elf_plt_sym_val
#define elf_backend_grok_prstatus riscv_elf_grok_prstatus
#define elf_backend_grok_psinfo riscv_elf_grok_psinfo
+#define elf_backend_object_p riscv_elf_object_p
#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
--
2.10.2