MC: Simplify Mach-O and ELF object writer implementations.
- What was I thinking?????
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118992 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMAsmBackend.cpp b/lib/Target/ARM/ARMAsmBackend.cpp
index d5a2759..86b1e06 100644
--- a/lib/Target/ARM/ARMAsmBackend.cpp
+++ b/lib/Target/ARM/ARMAsmBackend.cpp
@@ -11,14 +11,12 @@
#include "ARM.h"
#include "ARMFixupKinds.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/MC/ELFObjectWriter.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MachObjectWriter.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/MachO.h"
#include "llvm/Support/ErrorHandling.h"
@@ -94,10 +92,10 @@
}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
- return new ELFObjectWriter(OS, /*Is64Bit=*/false,
- OSType, ELF::EM_ARM,
- /*IsLittleEndian=*/true,
- /*HasRelocationAddend=*/false);
+ return createELFObjectWriter(OS, /*Is64Bit=*/false,
+ OSType, ELF::EM_ARM,
+ /*IsLittleEndian=*/true,
+ /*HasRelocationAddend=*/false);
}
};
@@ -133,8 +131,9 @@
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
// FIXME: Subtarget info should be derived. Force v7 for now.
- return new MachObjectWriter(OS, /*Is64Bit=*/false, MachO::CPUTypeARM,
- MachO::CPUSubType_ARM_V7);
+ return createMachObjectWriter(OS, /*Is64Bit=*/false, MachO::CPUTypeARM,
+ MachO::CPUSubType_ARM_V7,
+ /*IsLittleEndian=*/true);
}
virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
diff --git a/lib/Target/MBlaze/MBlazeAsmBackend.cpp b/lib/Target/MBlaze/MBlazeAsmBackend.cpp
index 9167809..944ebf1 100644
--- a/lib/Target/MBlaze/MBlazeAsmBackend.cpp
+++ b/lib/Target/MBlaze/MBlazeAsmBackend.cpp
@@ -11,14 +11,12 @@
#include "MBlaze.h"
#include "MBlazeFixupKinds.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/MC/ELFObjectWriter.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MachObjectWriter.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
@@ -104,10 +102,10 @@
}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
- return new ELFObjectWriter(OS, /*Is64Bit=*/false,
- OSType, ELF::EM_MBLAZE,
- /*IsLittleEndian=*/false,
- /*HasRelocationAddend=*/true);
+ return createELFObjectWriter(OS, /*Is64Bit=*/false,
+ OSType, ELF::EM_MBLAZE,
+ /*IsLittleEndian=*/false,
+ /*HasRelocationAddend=*/true);
}
};
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp
index 42643a3..a030196 100644
--- a/lib/Target/X86/X86AsmBackend.cpp
+++ b/lib/Target/X86/X86AsmBackend.cpp
@@ -11,7 +11,6 @@
#include "X86.h"
#include "X86FixupKinds.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/MC/ELFObjectWriter.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectFormat.h"
@@ -19,7 +18,6 @@
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MachObjectWriter.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/MachO.h"
#include "llvm/Support/ErrorHandling.h"
@@ -310,10 +308,10 @@
}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
- return new ELFObjectWriter(OS, /*Is64Bit=*/false,
- OSType, ELF::EM_386,
- /*IsLittleEndian=*/true,
- /*HasRelocationAddend=*/false);
+ return createELFObjectWriter(OS, /*Is64Bit=*/false,
+ OSType, ELF::EM_386,
+ /*IsLittleEndian=*/true,
+ /*HasRelocationAddend=*/false);
}
};
@@ -327,10 +325,10 @@
}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
- return new ELFObjectWriter(OS, /*Is64Bit=*/true,
- OSType, ELF::EM_X86_64,
- /*IsLittleEndian=*/true,
- /*HasRelocationAddend=*/true);
+ return createELFObjectWriter(OS, /*Is64Bit=*/true,
+ OSType, ELF::EM_X86_64,
+ /*IsLittleEndian=*/true,
+ /*HasRelocationAddend=*/true);
}
};
@@ -397,8 +395,9 @@
}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
- return new MachObjectWriter(OS, /*Is64Bit=*/false, MachO::CPUTypeI386,
- MachO::CPUSubType_I386_ALL);
+ return createMachObjectWriter(OS, /*Is64Bit=*/false, MachO::CPUTypeI386,
+ MachO::CPUSubType_I386_ALL,
+ /*IsLittleEndian=*/true);
}
};
@@ -414,8 +413,9 @@
}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
- return new MachObjectWriter(OS, /*Is64Bit=*/true, MachO::CPUTypeX86_64,
- MachO::CPUSubType_I386_ALL);
+ return createMachObjectWriter(OS, /*Is64Bit=*/true, MachO::CPUTypeX86_64,
+ MachO::CPUSubType_I386_ALL,
+ /*IsLittleEndian=*/true);
}
virtual bool doesSectionRequireSymbols(const MCSection &Section) const {