Recognize EM_RISCV in e_machine_to_string

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>
This commit is contained in:
Mark Wielaard 2023-12-29 01:40:50 +01:00 committed by Dodji Seketeli
parent f16e4631c1
commit cdd1113632
2 changed files with 17 additions and 0 deletions

View File

@ -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],

View File

@ -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: