diff options
Diffstat (limited to 'llvm/lib/Target/Mips')
4 files changed, 27 insertions, 31 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 01e4d17..259b71b 100644 --- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -2101,7 +2101,7 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc, TOut.getStreamer().emitRelocDirective( *TmpExpr, inMicroMipsMode() ? "R_MICROMIPS_JALR" : "R_MIPS_JALR", - RelocJalrExpr, IDLoc, *STI); + RelocJalrExpr); TOut.getStreamer().emitLabel(TmpLabel); } diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index ad8f5f0..7abe9c9 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -385,11 +385,12 @@ void MipsELFObjectWriter::sortRelocs(std::vector<ELFRelocationEntry> &Relocs) { if (hasRelocationAddend()) return; - // Sort relocations by the address they are applied to. - llvm::sort(Relocs, - [](const ELFRelocationEntry &A, const ELFRelocationEntry &B) { - return A.Offset < B.Offset; - }); + // Sort relocations by r_offset. There might be more than one at an offset + // with composed relocations or .reloc directives. + llvm::stable_sort( + Relocs, [](const ELFRelocationEntry &A, const ELFRelocationEntry &B) { + return A.Offset < B.Offset; + }); // Place relocations in a list for reorder convenience. Hi16 contains the // iterators of high-part relocations. diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index b89d689..feb4eb3 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -1033,45 +1033,40 @@ MCELFStreamer &MipsTargetELFStreamer::getStreamer() { } void MipsTargetELFStreamer::emitGPRel32Value(const MCExpr *Value) { - MCFragment *DF = getStreamer().getOrCreateDataFragment(); - DF->addFixup(MCFixup::create(DF->getContents().size(), Value, - Mips::fixup_Mips_GPREL32)); - DF->appendContents(4, 0); + auto &S = getStreamer(); + S.addFixup(Value, Mips::fixup_Mips_GPREL32); + S.appendContents(4, 0); } void MipsTargetELFStreamer::emitGPRel64Value(const MCExpr *Value) { - MCFragment *DF = getStreamer().getOrCreateDataFragment(); - DF->addFixup(MCFixup::create(DF->getContents().size(), Value, - Mips::fixup_Mips_GPREL32)); - DF->appendContents(8, 0); + auto &S = getStreamer(); + // fixup_Mips_GPREL32 desginates R_MIPS_GPREL32+R_MIPS_64 on MIPS64. + S.addFixup(Value, Mips::fixup_Mips_GPREL32); + S.appendContents(8, 0); } void MipsTargetELFStreamer::emitDTPRel32Value(const MCExpr *Value) { - MCFragment *DF = getStreamer().getOrCreateDataFragment(); - DF->addFixup(MCFixup::create(DF->getContents().size(), Value, - Mips::fixup_Mips_DTPREL32)); - DF->appendContents(4, 0); + auto &S = getStreamer(); + S.addFixup(Value, Mips::fixup_Mips_DTPREL32); + S.appendContents(4, 0); } void MipsTargetELFStreamer::emitDTPRel64Value(const MCExpr *Value) { - MCFragment *DF = getStreamer().getOrCreateDataFragment(); - DF->addFixup(MCFixup::create(DF->getContents().size(), Value, - Mips::fixup_Mips_DTPREL64)); - DF->appendContents(8, 0); + auto &S = getStreamer(); + S.addFixup(Value, Mips::fixup_Mips_DTPREL64); + S.appendContents(8, 0); } void MipsTargetELFStreamer::emitTPRel32Value(const MCExpr *Value) { - MCFragment *DF = getStreamer().getOrCreateDataFragment(); - DF->addFixup(MCFixup::create(DF->getContents().size(), Value, - Mips::fixup_Mips_TPREL32)); - DF->appendContents(4, 0); + auto &S = getStreamer(); + S.addFixup(Value, Mips::fixup_Mips_TPREL32); + S.appendContents(4, 0); } void MipsTargetELFStreamer::emitTPRel64Value(const MCExpr *Value) { - MCFragment *DF = getStreamer().getOrCreateDataFragment(); - DF->addFixup(MCFixup::create(DF->getContents().size(), Value, - Mips::fixup_Mips_TPREL64)); - DF->appendContents(8, 0); + auto &S = getStreamer(); + S.addFixup(Value, Mips::fixup_Mips_TPREL64); + S.appendContents(8, 0); } void MipsTargetELFStreamer::emitDirectiveSetMicroMips() { diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp index c18ba44..ca03310 100644 --- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -166,7 +166,7 @@ static void emitDirectiveRelocJalr(const MachineInstr &MI, OutStreamer.emitRelocDirective( *OffsetExpr, Subtarget.inMicroMipsMode() ? "R_MICROMIPS_JALR" : "R_MIPS_JALR", - CaleeExpr, SMLoc(), *TM.getMCSubtargetInfo()); + CaleeExpr); OutStreamer.emitLabel(OffsetLabel); return; } |