diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h @@ -37,7 +37,7 @@ VK_RISCV_CALL, VK_RISCV_CALL_PLT, VK_RISCV_32_PCREL, - VK_RISCV_Invalid + VK_RISCV_Invalid // Must be the last item }; private: diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp @@ -133,12 +133,19 @@ .Case("tprel_add", VK_RISCV_TPREL_ADD) .Case("tls_ie_pcrel_hi", VK_RISCV_TLS_GOT_HI) .Case("tls_gd_pcrel_hi", VK_RISCV_TLS_GD_HI) + .Case("call", VK_RISCV_CALL) + .Case("call_plt", VK_RISCV_CALL_PLT) + .Case("32_pcrel", VK_RISCV_32_PCREL) .Default(VK_RISCV_Invalid); } StringRef RISCVMCExpr::getVariantKindName(VariantKind Kind) { + assert(Kind < VariantKind::VK_RISCV_Invalid); + // When adding new item to VariantKind, getVariantKindForName must also be + // updated. switch (Kind) { - default: + case VK_RISCV_Invalid: + case VK_RISCV_None: llvm_unreachable("Invalid ELF symbol kind"); case VK_RISCV_LO: return "lo"; @@ -160,7 +167,14 @@ return "tls_ie_pcrel_hi"; case VK_RISCV_TLS_GD_HI: return "tls_gd_pcrel_hi"; + case VK_RISCV_CALL: + return "call"; + case VK_RISCV_CALL_PLT: + return "call_plt"; + case VK_RISCV_32_PCREL: + return "32_pcrel"; } + llvm_unreachable("Invalid ELF symbol kind"); } static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm) {