diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-03-19 10:43:26 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-19 10:43:26 +0000 |
| commit | 4d7c8645fda8b52dd1d26703a1b8f4b4b9d18e40 (patch) | |
| tree | e899a491aee31babb6d1c3e0bda3f139e700d8fb /llvm/lib/MC | |
| parent | eaa367f5aebeecb9a06e0e09a4da6613ebdf8e30 (diff) | |
| download | bcm5719-llvm-4d7c8645fda8b52dd1d26703a1b8f4b4b9d18e40.tar.gz bcm5719-llvm-4d7c8645fda8b52dd1d26703a1b8f4b4b9d18e40.zip | |
MC: Add TargetAsmBackend::createObjectWriter.
- MCAssembler is now object-file independent, although we will surely need more work to fully support ELF/COFF.
llvm-svn: 98955
Diffstat (limited to 'llvm/lib/MC')
| -rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 74876a501dc..beecf7e6b85 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -15,7 +15,7 @@ #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" -#include "llvm/MC/MachObjectWriter.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Twine.h" @@ -541,12 +541,13 @@ void MCAssembler::Finish() { dump(); }); // FIXME: Factor out MCObjectWriter. - bool Is64Bit = StringRef(getBackend().getTarget().getName()) == "x86-64"; - MachObjectWriter MOW(OS, Is64Bit); + llvm::OwningPtr<MCObjectWriter> Writer(getBackend().createObjectWriter(OS)); + if (!Writer) + llvm_report_error("unable to create object writer!"); // Allow the object writer a chance to perform post-layout binding (for // example, to set the index fields in the symbol data). - MOW.ExecutePostLayoutBinding(*this); + Writer->ExecutePostLayoutBinding(*this); // Evaluate and apply the fixups, generating relocation entries as necessary. // @@ -570,7 +571,7 @@ void MCAssembler::Finish() { // The fixup was unresolved, we need a relocation. Inform the object // writer of the relocation, and give it an opportunity to adjust the // fixup value if need be. - MOW.RecordRelocation(*this, *DF, Fixup, Target, FixedValue); + Writer->RecordRelocation(*this, *DF, Fixup, Target, FixedValue); } getBackend().ApplyFixup(Fixup, *DF, FixedValue); @@ -579,8 +580,7 @@ void MCAssembler::Finish() { } // Write the object file. - MOW.WriteObject(*this); - + Writer->WriteObject(*this); OS.flush(); } |

