MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format specific...
authorDaniel Dunbar <daniel@zuster.org>
Fri, 17 Dec 2010 04:54:54 +0000 (04:54 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 17 Dec 2010 04:54:54 +0000 (04:54 +0000)
 - Currently just has stub implementations for Mach-O, ELF, and COFF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122037 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCObjectWriter.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MachObjectWriter.cpp
lib/MC/WinCOFFObjectWriter.cpp

index bae3368f9694bcbf4b30033308368583fd649b15..60625b4b53603d602cf78471bcba983e4e319c3c 100644 (file)
@@ -20,6 +20,7 @@ class MCAsmLayout;
 class MCAssembler;
 class MCFixup;
 class MCFragment;
+class MCSymbolRefExpr;
 class MCValue;
 class raw_ostream;
 
@@ -77,6 +78,16 @@ public:
                                 const MCFixup &Fixup, MCValue Target,
                                 uint64_t &FixedValue) = 0;
 
+  /// \brief Check whether the difference (A - B) between two symbol
+  /// references is fully resolved.
+  ///
+  /// Clients are not required to answer precisely and may conservatively return
+  /// false, even when a difference is fully resolved.
+  virtual bool
+  IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
+                                     const MCSymbolRefExpr *A,
+                                     const MCSymbolRefExpr *B) const = 0;
+
   /// Check if a fixup is fully resolved.
   ///
   /// This routine is used by the assembler to let the file format decide
index 1369d827b1434064cfdbd45e611578167d1dcd79..b9804d474b327aae8d0198288b7e933ab8a5c846 100644 (file)
@@ -333,8 +333,17 @@ namespace {
                           uint64_t Size, uint32_t Link, uint32_t Info,
                           uint64_t Alignment, uint64_t EntrySize);
 
-    virtual void WriteRelocationsFragment(const MCAssembler &Asm, MCDataFragment *F,
-                                  const MCSectionData *SD);
+    virtual void WriteRelocationsFragment(const MCAssembler &Asm,
+                                          MCDataFragment *F,
+                                          const MCSectionData *SD);
+
+    virtual bool
+    IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
+                                       const MCSymbolRefExpr *A,
+                                       const MCSymbolRefExpr *B) const {
+      // FIXME: Implement this!
+      return false;
+    }
 
     virtual bool IsFixupFullyResolved(const MCAssembler &Asm,
                               const MCValue Target,
index d050ef0bd49cf5c2b732059063b0c295ec1ff297..e12daa708bcdc8b15f17078c5d3a05554ed77b1c 100644 (file)
@@ -1123,6 +1123,12 @@ public:
                        UndefinedSymbolData);
   }
 
+  bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
+                                          const MCSymbolRefExpr *A,
+                                          const MCSymbolRefExpr *B) const {
+    return false;
+  }
+
   bool IsFixupFullyResolved(const MCAssembler &Asm,
                             const MCValue Target,
                             bool IsPCRel,
index 3a88a03f8bdaad6b28f0fd80abf6dfe5101a8d30..0ad086cbee092dd815fb1e2b08ba928749ea1658 100644 (file)
@@ -179,6 +179,14 @@ public:
                         MCValue Target,
                         uint64_t &FixedValue);
 
+  virtual bool
+  IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
+                                     const MCSymbolRefExpr *A,
+                                     const MCSymbolRefExpr *B) const {
+    // FIXME: Implement this!
+    return false;
+  }
+
   virtual bool IsFixupFullyResolved(const MCAssembler &Asm,
                                     const MCValue Target,
                                     bool IsPCRel,