[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
This commit is contained in:
Daniel Sanders 2014-03-31 15:15:02 +00:00
parent 857d651ba4
commit e7c7ba0782
2 changed files with 9 additions and 4 deletions

View 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;
}

View 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: ]