Reduce the exposure of Triple::OSType in the ELF object writer. This will

avoid including ADT/Triple.h in many places when the target specific bits are
moved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147059 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2011-12-21 17:00:36 +00:00
parent d4304031cb
commit dc9a8a378d
8 changed files with 72 additions and 56 deletions

View File

@@ -31,8 +31,8 @@ using namespace llvm;
namespace {
class ARMELFObjectWriter : public MCELFObjectTargetWriter {
public:
ARMELFObjectWriter(Triple::OSType OSType)
: MCELFObjectTargetWriter(/*Is64Bit*/ false, OSType, ELF::EM_ARM,
ARMELFObjectWriter(uint8_t OSABI)
: MCELFObjectTargetWriter(/*Is64Bit*/ false, OSABI, ELF::EM_ARM,
/*HasRelocationAddend*/ false) {}
};
@@ -447,16 +447,16 @@ namespace {
// ELF is an ELF of course...
class ELFARMAsmBackend : public ARMAsmBackend {
public:
Triple::OSType OSType;
uint8_t OSABI;
ELFARMAsmBackend(const Target &T, const StringRef TT,
Triple::OSType _OSType)
: ARMAsmBackend(T, TT), OSType(_OSType) { }
uint8_t _OSABI)
: ARMAsmBackend(T, TT), OSABI(_OSABI) { }
void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
uint64_t Value) const;
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
return createELFObjectWriter(new ARMELFObjectWriter(OSType), OS,
return createELFObjectWriter(new ARMELFObjectWriter(OSABI), OS,
/*IsLittleEndian*/ true);
}
};
@@ -580,5 +580,6 @@ MCAsmBackend *llvm::createARMAsmBackend(const Target &T, StringRef TT) {
if (TheTriple.isOSWindows())
assert(0 && "Windows not supported on ARM");
return new ELFARMAsmBackend(T, TT, Triple(TT).getOS());
uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(Triple(TT).getOS());
return new ELFARMAsmBackend(T, TT, OSABI);
}