[1/2] Recognize EM_RISCV in e_machine_to_string
Commit Message
Check that EM_RISCV is defined in elf.h and if it is then recognize
it in e_machine_to_string, producing "elf-riscv".
* configure.ac: Defining HAVE_EM_RISCV_MACRO if EM_RISCV
is defined in elf.h.
* src/abg-dwarf-reader.cc (e_machine_to_string): Handle
EM_RISCV if HAVE_EM_RISCV_MACRO is defined.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
configure.ac | 12 ++++++++++++
src/abg-elf-helpers.cc | 5 +++++
2 files changed, 17 insertions(+)
@@ -947,6 +947,18 @@ if test x$HAS_EM_TILEGX = xyes; then
[Defined to 1 if elf.h has EM_TILEGX macro defined])
fi
+HAS_EM_RISCV=no
+AC_CHECK_DECL([EM_RISCV],
+ [HAS_EM_RISCV=yes],
+ [HAS_EM_RISCV=no],
+ [[#include <elf.h>]])
+
+if test x$HAS_EM_RISCV = xyes; then
+ AC_DEFINE([HAVE_EM_RISCV_MACRO],
+ 1,
+ [Defined to 1 if elf.h has EM_RISCV macro defined])
+fi
+
HAS_R_AARCH64_ABS64=no
AC_CHECK_DECL([R_AARCH64_ABS64],
[HAS_R_AARCH64_ABS64=yes],
@@ -287,6 +287,11 @@ e_machine_to_string(GElf_Half e_machine)
return "elf-tilera-tilegx";
#endif
+#ifdef HAVE_EM_RISCV_MACRO
+ case EM_RISCV:
+ return "elf-riscv";
+#endif
+
case EM_NUM:
return "elf-last-arch-number";
case EM_ALPHA: