diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-07-27 06:46:15 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-07-27 06:46:15 +0000 |
commit | dfd30187c685c2c5200ee795c64885c0a39dc2d0 (patch) | |
tree | 36c95782b4b8f18693c12fd5646f43ee94470e52 /lib/Target/X86/X86AsmBackend.cpp | |
parent | 082d587d35a41ee06985d7867b72fb2632962281 (diff) | |
download | external_llvm-dfd30187c685c2c5200ee795c64885c0a39dc2d0.zip external_llvm-dfd30187c685c2c5200ee795c64885c0a39dc2d0.tar.gz external_llvm-dfd30187c685c2c5200ee795c64885c0a39dc2d0.tar.bz2 |
Make MC use Windows COFF on Windows and add tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86AsmBackend.cpp')
-rw-r--r-- | lib/Target/X86/X86AsmBackend.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp index 2cf65c1..e572620 100644 --- a/lib/Target/X86/X86AsmBackend.cpp +++ b/lib/Target/X86/X86AsmBackend.cpp @@ -14,6 +14,7 @@ #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCObjectWriter.h" +#include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MachObjectWriter.h" @@ -212,6 +213,24 @@ public: : ELFX86AsmBackend(T) {} }; +class WindowsX86AsmBackend : public X86AsmBackend { +public: + WindowsX86AsmBackend(const Target &T) + : X86AsmBackend(T) { + HasAbsolutizedSet = true; + HasScatteredSymbols = true; + } + + MCObjectWriter *createObjectWriter(raw_ostream &OS) const { + return createWinCOFFObjectWriter (OS); + } + + bool isVirtualSection(const MCSection &Section) const { + const MCSectionCOFF &SE = static_cast<const MCSectionCOFF&>(Section); + return SE.getCharacteristics() & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA; + } +}; + class DarwinX86AsmBackend : public X86AsmBackend { public: DarwinX86AsmBackend(const Target &T) @@ -290,6 +309,8 @@ TargetAsmBackend *llvm::createX86_32AsmBackend(const Target &T, switch (Triple(TT).getOS()) { case Triple::Darwin: return new DarwinX86_32AsmBackend(T); + case Triple::Win32: + return new WindowsX86AsmBackend(T); default: return new ELFX86_32AsmBackend(T); } |