summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
index 7887a144fb7..e47868db1a4 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -476,10 +476,12 @@ void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm,
bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
unsigned Type) const {
- // This must be a compound relocation from the N64 ABI.
- // FIXME: Return false iff all sub-relocations return false.
+ // If it's a compound relocation for N64 then we need the relocation if any
+ // sub-relocation needs it.
if (!isUInt<8>(Type))
- return true;
+ return needsRelocateWithSymbol(Sym, Type & 0xff) ||
+ needsRelocateWithSymbol(Sym, (Type >> 8) & 0xff) ||
+ needsRelocateWithSymbol(Sym, (Type >> 16) & 0xff);
switch (Type) {
default:
@@ -524,6 +526,7 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
case ELF::R_MIPS_GPREL16:
case ELF::R_MIPS_GPREL32:
case ELF::R_MIPS_PC16:
+ case ELF::R_MIPS_SUB:
return false;
// FIXME: Many of these relocations should probably return false but this
@@ -538,7 +541,6 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
case ELF::R_MIPS_GOT_OFST:
case ELF::R_MIPS_GOT_HI16:
case ELF::R_MIPS_GOT_LO16:
- case ELF::R_MIPS_SUB:
case ELF::R_MIPS_INSERT_A:
case ELF::R_MIPS_INSERT_B:
case ELF::R_MIPS_DELETE:
@@ -626,7 +628,6 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
case ELF::R_MIPS16_TLS_TPREL_LO16:
llvm_unreachable("Unsupported MIPS16 relocation");
return true;
-
}
}
OpenPOWER on IntegriCloud