From: Saleem Abdulrasool Date: Wed, 21 May 2014 23:17:50 +0000 (+0000) Subject: MC: introduce ability to restrict recorded relocations X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=159ccc8f51f7cb090058cfd0dcb64453f5681606;p=oota-llvm.git MC: introduce ability to restrict recorded relocations Add support to allow a target specific COFF object writer to restrict the recorded resolutions in the emitted object files. This is motivated by the need in Windows on ARM, where an intermediate relocation needs to be prevented from being emitted in the object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209336 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCWinCOFFObjectWriter.h b/include/llvm/MC/MCWinCOFFObjectWriter.h index 213481c9090..dad7bb59703 100644 --- a/include/llvm/MC/MCWinCOFFObjectWriter.h +++ b/include/llvm/MC/MCWinCOFFObjectWriter.h @@ -30,6 +30,7 @@ namespace llvm { virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup, bool IsCrossSection) const = 0; + virtual bool recordRelocation(const MCFixup &) const { return true; } }; /// \brief Construct a new Win COFF writer instance. diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 2cc027bfa13..961cbc6a8f7 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -808,7 +808,8 @@ void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm, } } - coff_section->Relocations.push_back(Reloc); + if (TargetObjectWriter->recordRelocation(Fixup)) + coff_section->Relocations.push_back(Reloc); } void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm,