From e7c7ba0782d5dcafcd7b4e4be4cc098bff000a27 Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Mon, 31 Mar 2014 15:15:02 +0000 Subject: [PATCH] [mips] Implement missing relocations in the integrated assembler. %got_hi, %got_lo, %call_hi, %call_lo, %higher, and %highest are now recognised by MipsAsmParser::getVariantKind(). To prevent future issues with missing entries in this StringSwitch, I've added an assertion to the default case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205200 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp | 8 ++++++++ test/MC/Mips/xgot.s | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 7a731eb3a09..41476757721 100644 --- a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -2277,8 +2277,16 @@ MCSymbolRefExpr::VariantKind MipsAsmParser::getVariantKind(StringRef Symbol) { .Case("got_ofst", MCSymbolRefExpr::VK_Mips_GOT_OFST) .Case("hi(%neg(%gp_rel", MCSymbolRefExpr::VK_Mips_GPOFF_HI) .Case("lo(%neg(%gp_rel", MCSymbolRefExpr::VK_Mips_GPOFF_LO) + .Case("got_hi", MCSymbolRefExpr::VK_Mips_GOT_HI16) + .Case("got_lo", MCSymbolRefExpr::VK_Mips_GOT_LO16) + .Case("call_hi", MCSymbolRefExpr::VK_Mips_CALL_HI16) + .Case("call_lo", MCSymbolRefExpr::VK_Mips_CALL_LO16) + .Case("higher", MCSymbolRefExpr::VK_Mips_HIGHER) + .Case("highest", MCSymbolRefExpr::VK_Mips_HIGHEST) .Default(MCSymbolRefExpr::VK_None); + assert (VK != MCSymbolRefExpr::VK_None); + return VK; } diff --git a/test/MC/Mips/xgot.s b/test/MC/Mips/xgot.s index ec564c617a3..072e662c5ce 100644 --- a/test/MC/Mips/xgot.s +++ b/test/MC/Mips/xgot.s @@ -1,8 +1,5 @@ // RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o - | llvm-readobj -r | FileCheck %s -// Expected failure since the mips backend can't handle this yet. -// XFAIL: * - // Check that the appropriate relocations were created. // For the xgot case we want to see R_MIPS_[GOT|CALL]_[HI|LO]16. @@ -12,8 +9,8 @@ // CHECK: 0x{{[0-9,A-F]+}} R_MIPS_GOT_HI16 // CHECK: 0x{{[0-9,A-F]+}} R_MIPS_GOT_LO16 // CHECK: 0x{{[0-9,A-F]+}} R_MIPS_CALL_HI16 -// CHECK: 0x{{[0-9,A-F]+}} R_MIPS_CALL_LO16 // CHECK: 0x{{[0-9,A-F]+}} R_MIPS_GOT16 +// CHECK: 0x{{[0-9,A-F]+}} R_MIPS_CALL_LO16 // CHECK: 0x{{[0-9,A-F]+}} R_MIPS_LO16 // CHECK: ]