Fix relocation selection for foo-. on mips.
[oota-llvm.git] / lib / Target / Mips / MCTargetDesc / MipsELFObjectWriter.cpp
index 1c0a5ebdcffff7ba954ba9178546b3eefb931121..4df92d067ea659586a35e0ed99460fd9c9941cba 100644 (file)
@@ -70,7 +70,7 @@ unsigned MipsELFObjectWriter::GetRelocType(const MCValue &Target,
   switch (Kind) {
   case Mips::fixup_Mips_32:
   case FK_Data_4:
-    return ELF::R_MIPS_32;
+    return IsPCRel ? ELF::R_MIPS_PC32 : ELF::R_MIPS_32;
   case Mips::fixup_Mips_64:
   case FK_Data_8:
     return ELF::R_MIPS_64;