diff options
author | Matt Fleming <matt@console-pimps.org> | 2010-08-16 18:36:14 +0000 |
---|---|---|
committer | Matt Fleming <matt@console-pimps.org> | 2010-08-16 18:36:14 +0000 |
commit | 453db50333723cb59c64970b6860caa0a7c0b8c2 (patch) | |
tree | 091ce723358caef219d41f1891051b55e64d7308 /lib/Target | |
parent | 6b2e257e74b2c8e2f93bb244e0c80cb73005b74a (diff) |
Hookup ELF support for X86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/X86/X86AsmBackend.cpp | 17 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetMachine.cpp | 3 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp index 248eeac7ff..6455a18a3f 100644 --- a/lib/Target/X86/X86AsmBackend.cpp +++ b/lib/Target/X86/X86AsmBackend.cpp @@ -11,6 +11,7 @@ #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/MCObjectWriter.h" @@ -191,10 +192,6 @@ public: HasScatteredSymbols = true; } - MCObjectWriter *createObjectWriter(raw_ostream &OS) const { - return 0; - } - bool isVirtualSection(const MCSection &Section) const { const MCSectionELF &SE = static_cast<const MCSectionELF&>(Section); return SE.getType() == MCSectionELF::SHT_NOBITS;; @@ -205,12 +202,24 @@ class ELFX86_32AsmBackend : public ELFX86AsmBackend { public: ELFX86_32AsmBackend(const Target &T) : ELFX86AsmBackend(T) {} + + MCObjectWriter *createObjectWriter(raw_ostream &OS) const { + return new ELFObjectWriter(OS, /*Is64Bit=*/false, + /*IsLittleEndian=*/true, + /*HasRelocationAddend=*/false); + } }; class ELFX86_64AsmBackend : public ELFX86AsmBackend { public: ELFX86_64AsmBackend(const Target &T) : ELFX86AsmBackend(T) {} + + MCObjectWriter *createObjectWriter(raw_ostream &OS) const { + return new ELFObjectWriter(OS, /*Is64Bit=*/true, + /*IsLittleEndian=*/true, + /*HasRelocationAddend=*/true); + } }; class WindowsX86AsmBackend : public X86AsmBackend { diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 560f070abd..3c8e7f1d33 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -54,8 +54,7 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, case Triple::Win32: return createWinCOFFStreamer(Ctx, TAB, *_Emitter, _OS, RelaxAll); default: - // FIXME: default to ELF. - report_fatal_error("object emission not implemented for this target."); + return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); } } |