Remove the MCObjectFormat class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/CMakeLists.txt b/lib/MC/CMakeLists.txt
index ccec2dc..c17e150 100644
--- a/lib/MC/CMakeLists.txt
+++ b/lib/MC/CMakeLists.txt
@@ -20,7 +20,6 @@
MCMachObjectTargetWriter.cpp
MCNullStreamer.cpp
MCObjectStreamer.cpp
- MCObjectFormat.cpp
MCObjectWriter.cpp
MCPureStreamer.cpp
MCSection.cpp
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 10e67d2..a6503b7 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -352,6 +352,12 @@
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,
diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp
index 3533da2..22d8740 100644
--- a/lib/MC/MCExpr.cpp
+++ b/lib/MC/MCExpr.cpp
@@ -14,7 +14,6 @@
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Debug.h"
@@ -388,8 +387,8 @@
if (Asm && A && B) {
const MCSymbol &SA = A->getSymbol();
const MCSymbol &SB = B->getSymbol();
- const MCObjectFormat &F = Asm->getBackend().getObjectFormat();
- if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) {
+ if (SA.isDefined() && SB.isDefined() &&
+ Asm->getWriter().isAbsolute(InSet, SA, SB)) {
MCSymbolData &AD = Asm->getSymbolData(A->getSymbol());
MCSymbolData &BD = Asm->getSymbolData(B->getSymbol());
diff --git a/lib/MC/MCObjectFormat.cpp b/lib/MC/MCObjectFormat.cpp
deleted file mode 100644
index aeff334..0000000
--- a/lib/MC/MCObjectFormat.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- lib/MC/MCObjectFormat.cpp - MCObjectFormat implementation ----------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/MC/MCObjectFormat.h"
-#include "llvm/MC/MCSymbol.h"
-
-using namespace llvm;
-
-MCObjectFormat::~MCObjectFormat() {
-}
-
-bool MCELFObjectFormat::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();
-}
-
-bool MCMachOObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
- const MCSymbol &B) const {
- // On MachO A - B is absolute only if in a set.
- return IsSet;
-}
-
-bool MCCOFFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
- const MCSymbol &B) const {
- // On COFF A - B is absolute if A and B are in the same section.
- return &A.getSection() == &B.getSection();
-}
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp
index 6ebc782..42cf43f 100644
--- a/lib/MC/MachObjectWriter.cpp
+++ b/lib/MC/MachObjectWriter.cpp
@@ -1123,6 +1123,12 @@
UndefinedSymbolData);
}
+ bool isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On MachO A - B is absolute only if in a set.
+ return IsSet;
+ }
+
bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
const MCSymbolRefExpr *A,
const MCSymbolRefExpr *B) const {
diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp
index 0ad086c..7f75662 100644
--- a/lib/MC/WinCOFFObjectWriter.cpp
+++ b/lib/MC/WinCOFFObjectWriter.cpp
@@ -187,6 +187,12 @@
return false;
}
+ virtual bool isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On COFF 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,