diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/ARM/ARMAsmBackend.cpp | 15 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86AsmBackend.cpp | 21 |
2 files changed, 32 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/ARMAsmBackend.cpp index df439a41b33..d113cf5b9ec 100644 --- a/llvm/lib/Target/ARM/ARMAsmBackend.cpp +++ b/llvm/lib/Target/ARM/ARMAsmBackend.cpp @@ -14,6 +14,7 @@ #include "llvm/MC/ELFObjectWriter.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionMachO.h" @@ -66,14 +67,19 @@ namespace { // FIXME: This should be in a separate file. // ELF is an ELF of course... class ELFARMAsmBackend : public ARMAsmBackend { + MCELFObjectFormat Format; + public: Triple::OSType OSType; ELFARMAsmBackend(const Target &T, Triple::OSType _OSType) : ARMAsmBackend(T), OSType(_OSType) { - HasAbsolutizedSet = true; HasScatteredSymbols = true; } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + void ApplyFixup(const MCFixup &Fixup, MCDataFragment &DF, uint64_t Value) const; @@ -98,14 +104,19 @@ void ELFARMAsmBackend::ApplyFixup(const MCFixup &Fixup, MCDataFragment &DF, // FIXME: This should be in a separate file. class DarwinARMAsmBackend : public ARMAsmBackend { + MCMachOObjectFormat Format; + public: DarwinARMAsmBackend(const Target &T) : ARMAsmBackend(T) { - HasAbsolutizedSet = true; HasScatteredSymbols = true; assert(0 && "DarwinARMAsmBackend::DarwinARMAsmBackend() unimplemented"); } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + void ApplyFixup(const MCFixup &Fixup, MCDataFragment &DF, uint64_t Value) const; diff --git a/llvm/lib/Target/X86/X86AsmBackend.cpp b/llvm/lib/Target/X86/X86AsmBackend.cpp index e641500abfb..853d3ed159f 100644 --- a/llvm/lib/Target/X86/X86AsmBackend.cpp +++ b/llvm/lib/Target/X86/X86AsmBackend.cpp @@ -14,6 +14,7 @@ #include "llvm/MC/ELFObjectWriter.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCSectionELF.h" @@ -186,15 +187,20 @@ bool X86AsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const { namespace { class ELFX86AsmBackend : public X86AsmBackend { + MCELFObjectFormat Format; + public: Triple::OSType OSType; ELFX86AsmBackend(const Target &T, Triple::OSType _OSType) : X86AsmBackend(T), OSType(_OSType) { - HasAbsolutizedSet = true; HasScatteredSymbols = true; HasReliableSymbolDifference = true; } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + virtual bool doesSectionRequireSymbols(const MCSection &Section) const { const MCSectionELF &ES = static_cast<const MCSectionELF&>(Section); return ES.getFlags() & MCSectionELF::SHF_MERGE; @@ -242,6 +248,8 @@ public: class WindowsX86AsmBackend : public X86AsmBackend { bool Is64Bit; + MCCOFFObjectFormat Format; + public: WindowsX86AsmBackend(const Target &T, bool is64Bit) : X86AsmBackend(T) @@ -249,6 +257,10 @@ public: HasScatteredSymbols = true; } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + unsigned getPointerSize() const { if (Is64Bit) return 8; @@ -267,13 +279,18 @@ public: }; class DarwinX86AsmBackend : public X86AsmBackend { + MCMachOObjectFormat Format; + public: DarwinX86AsmBackend(const Target &T) : X86AsmBackend(T) { - HasAbsolutizedSet = true; HasScatteredSymbols = true; } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + bool isVirtualSection(const MCSection &Section) const { const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section); return (SMO.getType() == MCSectionMachO::S_ZEROFILL || |