[llvm-commits] [PATCH 5/5] Hookup the ELF support for X86.
Matt Fleming
matt at console-pimps.org
Mon Jul 26 13:00:23 PDT 2010
---
lib/Target/X86/X86AsmBackend.cpp | 17 +++++++++++++----
lib/Target/X86/X86TargetMachine.cpp | 2 ++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp
index 2cf65c1..b6a14b2 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"
@@ -190,10 +191,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;;
@@ -204,12 +201,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 DarwinX86AsmBackend : public X86AsmBackend {
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index 900b516..6e16083 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/lib/Target/X86/X86TargetMachine.cpp
@@ -46,6 +46,8 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
bool RelaxAll) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
+ case Triple::Linux:
+ return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);
default:
return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);
}
--
1.6.4.rc0
More information about the llvm-commits
mailing list