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.

llvm-svn: 209336
This commit is contained in:
Saleem Abdulrasool 2014-05-21 23:17:50 +00:00
parent 1ea9db2dce
commit 54bed12082
2 changed files with 3 additions and 1 deletions

View File

@ -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.

View File

@ -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,