[llvm] r209336 - MC: introduce ability to restrict recorded relocations

Saleem Abdulrasool compnerd at compnerd.org
Wed May 21 16:17:51 PDT 2014


Author: compnerd
Date: Wed May 21 18:17:50 2014
New Revision: 209336

URL: http://llvm.org/viewvc/llvm-project?rev=209336&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/MC/MCWinCOFFObjectWriter.h
    llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp

Modified: llvm/trunk/include/llvm/MC/MCWinCOFFObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCWinCOFFObjectWriter.h?rev=209336&r1=209335&r2=209336&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCWinCOFFObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCWinCOFFObjectWriter.h Wed May 21 18:17:50 2014
@@ -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.

Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=209336&r1=209335&r2=209336&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Wed May 21 18:17:50 2014
@@ -808,7 +808,8 @@ void WinCOFFObjectWriter::RecordRelocati
     }
   }
 
-  coff_section->Relocations.push_back(Reloc);
+  if (TargetObjectWriter->recordRelocation(Fixup))
+    coff_section->Relocations.push_back(Reloc);
 }
 
 void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm,





More information about the llvm-commits mailing list