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:
parent
c2e23ec55c
commit
c7c66d9f88
@ -16,6 +16,7 @@
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
|
||||
namespace llvm {
|
||||
class MCELFObjectTargetWriter;
|
||||
class MCFixup;
|
||||
class MCInst;
|
||||
class MCObjectWriter;
|
||||
@ -40,6 +41,13 @@ public:
|
||||
/// assembler backend to emit the final object file.
|
||||
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
|
||||
/// accurate relocations for differences between symbols. If not, differences
|
||||
/// between symbols will always be relocatable expressions and any references
|
||||
|
@ -307,10 +307,13 @@ public:
|
||||
: ELFX86AsmBackend(T, OSType) {}
|
||||
|
||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||
return createELFObjectWriter(new X86ELFObjectWriter(false, OSType,
|
||||
ELF::EM_386, false),
|
||||
return createELFObjectWriter(createELFObjectTargetWriter(),
|
||||
OS, /*IsLittleEndian*/ true);
|
||||
}
|
||||
|
||||
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
|
||||
return new X86ELFObjectWriter(false, OSType, ELF::EM_386, false);
|
||||
}
|
||||
};
|
||||
|
||||
class ELFX86_64AsmBackend : public ELFX86AsmBackend {
|
||||
@ -319,10 +322,13 @@ public:
|
||||
: ELFX86AsmBackend(T, OSType) {}
|
||||
|
||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||
return createELFObjectWriter(new X86ELFObjectWriter(true, OSType,
|
||||
ELF::EM_X86_64, true),
|
||||
return createELFObjectWriter(createELFObjectTargetWriter(),
|
||||
OS, /*IsLittleEndian*/ true);
|
||||
}
|
||||
|
||||
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
|
||||
return new X86ELFObjectWriter(true, OSType, ELF::EM_386, true);
|
||||
}
|
||||
};
|
||||
|
||||
class WindowsX86AsmBackend : public X86AsmBackend {
|
||||
|
Loading…
Reference in New Issue
Block a user