summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/ELFWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-31 17:42:42 +0000
committerChris Lattner <sabre@nondot.org>2009-07-31 17:42:42 +0000
commit51d5b43cda213e3cac83700e39e47657c55fd362 (patch)
tree461ddaf686fedc49ae6b1a21211f4aa0def27a0c /llvm/lib/CodeGen/ELFWriter.cpp
parentfe4e34707cae1e634b572441baad8ef7457fbf11 (diff)
downloadbcm5719-llvm-51d5b43cda213e3cac83700e39e47657c55fd362.tar.gz
bcm5719-llvm-51d5b43cda213e3cac83700e39e47657c55fd362.zip
refactor section construction in TLOF to be through an explicit
initialize method, which can be called when an MCContext is available. llvm-svn: 77687
Diffstat (limited to 'llvm/lib/CodeGen/ELFWriter.cpp')
-rw-r--r--llvm/lib/CodeGen/ELFWriter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp
index bf2d0bd94cf..230c5ac4be8 100644
--- a/llvm/lib/CodeGen/ELFWriter.cpp
+++ b/llvm/lib/CodeGen/ELFWriter.cpp
@@ -42,6 +42,7 @@
#include "llvm/CodeGen/ObjectCodeEmitter.h"
#include "llvm/CodeGen/MachineCodeEmitter.h"
#include "llvm/CodeGen/MachineConstantPool.h"
+#include "llvm/MC/MCContext.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetELFWriterInfo.h"
@@ -73,6 +74,7 @@ ObjectCodeEmitter *llvm::AddELFWriter(PassManagerBase &PM,
ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm)
: MachineFunctionPass(&ID), O(o), TM(tm),
+ OutContext(*new MCContext()),
is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64),
isLittleEndian(TM.getTargetData()->isLittleEndian()),
ElfHdr(isLittleEndian, is64Bit) {
@@ -89,11 +91,17 @@ ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm)
ELFWriter::~ELFWriter() {
delete ElfCE;
+ delete &OutContext;
}
// doInitialization - Emit the file header and all of the global variables for
// the module to the ELF file.
bool ELFWriter::doInitialization(Module &M) {
+ // Initialize TargetLoweringObjectFile.
+ const TargetLoweringObjectFile &TLOF =
+ TM.getTargetLowering()->getObjFileLowering();
+ const_cast<TargetLoweringObjectFile&>(TLOF).Initialize(OutContext, TM);
+
Mang = new Mangler(M);
// ELF Header
OpenPOWER on IntegriCloud