MC/Mach-O: Shuffle enums a bit to make it harder to inadvertently use the wrong
[oota-llvm.git] / lib / MC / ELFObjectWriter.cpp
index a6503b7cacb7bee85e416cb79c44ed9bdab5d483..bb523cefedcc6781cdcb3dc06978ef3a53a697ee 100644 (file)
@@ -344,20 +344,6 @@ namespace {
                                           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 isAbsolute(bool IsSet, const MCSymbol &A,
-                            const MCSymbol &B) const {
-      // On ELF A - B is absolute if A and B are in the same section.
-      return &A.getSection() == &B.getSection();
-    }
-
     virtual bool IsFixupFullyResolved(const MCAssembler &Asm,
                               const MCValue Target,
                               bool IsPCRel,
@@ -532,6 +518,15 @@ static uint64_t SymbolValue(MCSymbolData &Data, const MCAsmLayout &Layout) {
     return Data.getCommonAlignment();
 
   const MCSymbol &Symbol = Data.getSymbol();
+
+  if (Symbol.isAbsolute() && Symbol.isVariable()) {
+    if (const MCExpr *Value = Symbol.getVariableValue()) {
+      int64_t IntValue;
+      if (Value->EvaluateAsAbsolute(IntValue, Layout))
+       return (uint64_t)IntValue;
+    }
+  }
+
   if (!Symbol.isInSection())
     return 0;