Index: include/llvm/MC/MCObjectStreamer.h =================================================================== --- include/llvm/MC/MCObjectStreamer.h +++ include/llvm/MC/MCObjectStreamer.h @@ -99,6 +99,11 @@ void ChangeSection(MCSection *Section, const MCExpr *Subsection) override; void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo& STI) override; + /// \brief EmitValueImpl with additional param, that allows to emit PCRelative + /// MCFixup. + void EmitValueImpl(const MCExpr *Value, unsigned Size, + SMLoc Loc, bool isPCRelative); + /// \brief Emit an instruction to a special fragment, because this instruction /// can change its size during relaxation. virtual void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &); Index: lib/MC/MCObjectStreamer.cpp =================================================================== --- lib/MC/MCObjectStreamer.cpp +++ lib/MC/MCObjectStreamer.cpp @@ -122,7 +122,7 @@ } void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, - SMLoc Loc) { + SMLoc Loc, bool isPCRelative) { MCStreamer::EmitValueImpl(Value, Size, Loc); MCDataFragment *DF = getOrCreateDataFragment(); flushPendingLabels(DF, DF->getContents().size()); @@ -138,10 +138,16 @@ } DF->getFixups().push_back( MCFixup::create(DF->getContents().size(), Value, - MCFixup::getKindForSize(Size, false), Loc)); + MCFixup::getKindForSize(Size, isPCRelative), Loc)); DF->getContents().resize(DF->getContents().size() + Size, 0); } + +void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, + SMLoc Loc) { + EmitValueImpl(Value, Size, Loc, false); +} + void MCObjectStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) { // We need to create a local symbol to avoid relocations. Frame.Begin = getContext().createTempSymbol();