mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -46,6 +46,8 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
|
||||
bool RelaxAll) {
|
||||
Triple TheTriple(TT);
|
||||
switch (TheTriple.getOS()) {
|
||||
case Triple::Win32:
|
||||
return createWinCOFFStreamer(Ctx, TAB, *_Emitter, _OS);
|
||||
default:
|
||||
return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);
|
||||
}
|
||||
|
Reference in New Issue
Block a user