aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorKuan-Lin Chen <rufus@andestech.com>2017-01-17 09:46:28 +0800
committerKuan-Lin Chen <kuanlinchentw@gmail.com>2017-01-17 16:43:31 +0800
commit640d6bfddb82560687d8796aa7f0675c93bb062f (patch)
tree382a5c0f26c323089112cc389fcab15b50d08c2b /bfd
parentf964e51d907b008bfdddd0824a56e420737212a3 (diff)
downloadgdb-640d6bfddb82560687d8796aa7f0675c93bb062f.zip
gdb-640d6bfddb82560687d8796aa7f0675c93bb062f.tar.gz
gdb-640d6bfddb82560687d8796aa7f0675c93bb062f.tar.bz2
RISC-V/bfd: Hook elf_backend_object_p to set the mach type.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elfnn-riscv.c14
2 files changed, 18 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ef7d68c..3fae9dd 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-01-12 H.J. Lu <hongjiu.lu@intel.com>
PR ld/21038
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index f414429..320d318 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -3191,6 +3191,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"
@@ -3216,6 +3229,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