[mips] Implement missing relocations in the integrated assembler.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 31 Mar 2014 15:15:02 +0000 (15:15 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 31 Mar 2014 15:15:02 +0000 (15:15 +0000)
%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
test/MC/Mips/xgot.s

index 7a731eb3a091093f96389488bba74a41c3f43a6d..4147675772107f6501b658336d8619199201c73c 100644 (file)
@@ -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;
 }
 
index ec564c617a3528132532dfbea7ce3f31313e80f6..072e662c5ce6efa3abd03f924d434218bbba3c24 100644 (file)
@@ -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: ]