1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Add createELFObjectTargetWriter method to TargetAsmBackend, which enables construction of non-standard ELFObjectWriters that can be used in MCJIT.

llvm-svn: 127346
This commit is contained in:
Jan Sjödin 2011-03-09 18:44:41 +00:00
parent c2e23ec55c
commit c7c66d9f88
2 changed files with 18 additions and 4 deletions

View File

@ -16,6 +16,7 @@
#include "llvm/Support/DataTypes.h" #include "llvm/Support/DataTypes.h"
namespace llvm { namespace llvm {
class MCELFObjectTargetWriter;
class MCFixup; class MCFixup;
class MCInst; class MCInst;
class MCObjectWriter; class MCObjectWriter;
@ -40,6 +41,13 @@ public:
/// assembler backend to emit the final object file. /// assembler backend to emit the final object file.
virtual MCObjectWriter *createObjectWriter(raw_ostream &OS) const = 0; virtual MCObjectWriter *createObjectWriter(raw_ostream &OS) const = 0;
/// createELFObjectTargetWriter - Create a new ELFObjectTargetWriter to enable
/// non-standard ELFObjectWriters.
virtual MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
assert(0 && "createELFObjectTargetWriter is not supported by asm backend");
return 0;
}
/// hasReliableSymbolDifference - Check whether this target implements /// hasReliableSymbolDifference - Check whether this target implements
/// accurate relocations for differences between symbols. If not, differences /// accurate relocations for differences between symbols. If not, differences
/// between symbols will always be relocatable expressions and any references /// between symbols will always be relocatable expressions and any references

View File

@ -307,10 +307,13 @@ public:
: ELFX86AsmBackend(T, OSType) {} : ELFX86AsmBackend(T, OSType) {}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const { MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
return createELFObjectWriter(new X86ELFObjectWriter(false, OSType, return createELFObjectWriter(createELFObjectTargetWriter(),
ELF::EM_386, false),
OS, /*IsLittleEndian*/ true); OS, /*IsLittleEndian*/ true);
} }
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
return new X86ELFObjectWriter(false, OSType, ELF::EM_386, false);
}
}; };
class ELFX86_64AsmBackend : public ELFX86AsmBackend { class ELFX86_64AsmBackend : public ELFX86AsmBackend {
@ -319,10 +322,13 @@ public:
: ELFX86AsmBackend(T, OSType) {} : ELFX86AsmBackend(T, OSType) {}
MCObjectWriter *createObjectWriter(raw_ostream &OS) const { MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
return createELFObjectWriter(new X86ELFObjectWriter(true, OSType, return createELFObjectWriter(createELFObjectTargetWriter(),
ELF::EM_X86_64, true),
OS, /*IsLittleEndian*/ true); OS, /*IsLittleEndian*/ true);
} }
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
return new X86ELFObjectWriter(true, OSType, ELF::EM_386, true);
}
}; };
class WindowsX86AsmBackend : public X86AsmBackend { class WindowsX86AsmBackend : public X86AsmBackend {