diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp index 4d3e966f7f5032..652ad2a0736e47 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp @@ -107,8 +107,9 @@ class ELFLinkGraphBuilder_aarch64 : public ELFLinkGraphBuilder { return ELFLd64GOTLo12; } - return make_error("Unsupported aarch64 relocation:" + - formatv("{0:d}", Type)); + return make_error( + "Unsupported aarch64 relocation:" + formatv("{0:d}: ", Type) + + object::getELFRelocationTypeName(ELF::EM_AARCH64, Type)); } Error addRelocations() override { diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp index e772ae834e29b5..197ab71f52741d 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp @@ -471,8 +471,9 @@ class ELFLinkGraphBuilder_riscv : public ELFLinkGraphBuilder { return EdgeKind_riscv::R_RISCV_32_PCREL; } - return make_error("Unsupported riscv relocation:" + - formatv("{0:d}", Type)); + return make_error( + "Unsupported riscv relocation:" + formatv("{0:d}: ", Type) + + object::getELFRelocationTypeName(ELF::EM_RISCV, Type)); } Error addRelocations() override { diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp index ca9a2964ff146b..8f21274bd1a3c0 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp @@ -97,17 +97,6 @@ Error buildTables_ELF_x86_64(LinkGraph &G) { } } // namespace -static const char *getELFX86_64RelocName(uint32_t Type) { - switch (Type) { -#define ELF_RELOC(Name, Number) \ - case Number: \ - return #Name; -#include "llvm/BinaryFormat/ELFRelocs/x86_64.def" -#undef ELF_RELOC - } - return "Unrecognized ELF/x86-64 relocation type"; -} - namespace llvm { namespace jitlink { @@ -146,9 +135,9 @@ class ELFLinkGraphBuilder_x86_64 : public ELFLinkGraphBuilder { case ELF::R_X86_64_TLSGD: return ELF_x86_64_Edges::ELFX86RelocationKind::PCRel32TLV; } - return make_error("Unsupported x86-64 relocation type " + - formatv("{0:d}: ", Type) + - getELFX86_64RelocName(Type)); + return make_error( + "Unsupported x86-64 relocation type " + formatv("{0:d}: ", Type) + + object::getELFRelocationTypeName(ELF::EM_X86_64, Type)); } Error addRelocations() override {