From 119b75925c562202145d7bac7b676b98029c6cb9 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 24 Jul 2015 16:52:21 +0000 Subject: [PATCH] Add RISC-V ELF machine type definition EM_RISCV is now officially registered as e_machine 243. MFC after: 1 month Sponsored by: The FreeBSD Foundation --- contrib/elftoolchain/common/elfdefinitions.h | 3 ++- contrib/elftoolchain/readelf/readelf.c | 1 + sys/sys/elf_common.h | 1 + usr.bin/elfdump/elfdump.c | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/elftoolchain/common/elfdefinitions.h b/contrib/elftoolchain/common/elfdefinitions.h index 58554fef2ebf..21b415bb0693 100644 --- a/contrib/elftoolchain/common/elfdefinitions.h +++ b/contrib/elftoolchain/common/elfdefinitions.h @@ -813,7 +813,8 @@ _ELF_DEFINE_EM(EM_KM32, 210, "KM211 KM32 32-bit processor") \ _ELF_DEFINE_EM(EM_KMX32, 211, "KM211 KMX32 32-bit processor") \ _ELF_DEFINE_EM(EM_KMX16, 212, "KM211 KMX16 16-bit processor") \ _ELF_DEFINE_EM(EM_KMX8, 213, "KM211 KMX8 8-bit processor") \ -_ELF_DEFINE_EM(EM_KVARC, 214, "KM211 KMX32 KVARC processor") +_ELF_DEFINE_EM(EM_KVARC, 214, "KM211 KMX32 KVARC processor") \ +_ELF_DEFINE_EM(EM_RISCV, 243, "RISC-V") #undef _ELF_DEFINE_EM #define _ELF_DEFINE_EM(N, V, DESCR) N = V , diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index b1b81a34d4f7..f7f9e570ef6b 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -532,6 +532,7 @@ elf_machine(unsigned int mach) case EM_ARCA: return "Arca RISC Microprocessor"; case EM_UNICORE: return "Microprocessor series from PKU-Unity Ltd"; case EM_AARCH64: return "AArch64"; + case EM_RISCV: return "RISC-V"; default: snprintf(s_mach, sizeof(s_mach), "", mach); return (s_mach); diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index d429e86676a1..2e784d67a769 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -297,6 +297,7 @@ typedef struct { #define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */ #define EM_AARCH64 183 /* AArch64 (64-bit ARM) */ +#define EM_RISCV 243 /* RISC-V */ /* Non-standard or deprecated. */ #define EM_486 6 /* Intel i486. */ diff --git a/usr.bin/elfdump/elfdump.c b/usr.bin/elfdump/elfdump.c index cd10ce3141d3..2147fcb3179b 100644 --- a/usr.bin/elfdump/elfdump.c +++ b/usr.bin/elfdump/elfdump.c @@ -272,6 +272,7 @@ e_machines(u_int mach) case EM_IA_64: return "EM_IA_64"; case EM_X86_64: return "EM_X86_64"; case EM_AARCH64:return "EM_AARCH64"; + case EM_RISCV: return "EM_RISCV"; } snprintf(machdesc, sizeof(machdesc), "(unknown machine) -- type 0x%x", mach);