mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-04 18:24:38 +00:00
[x32] Add AsmBackend for X32 which uses ELF32 with x86_64 (the author is Pavel Chupin).
This is minimal change for backend required to have "hello world" compiled and working on x32 target (x86_64-linux-gnux32). More patches for x32 will follow. Differential Revision: http://reviews.llvm.org/D4181 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212716 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -366,6 +366,17 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ELFX86_X32AsmBackend : public ELFX86AsmBackend {
|
||||||
|
public:
|
||||||
|
ELFX86_X32AsmBackend(const Target &T, uint8_t OSABI, StringRef CPU)
|
||||||
|
: ELFX86AsmBackend(T, OSABI, CPU) {}
|
||||||
|
|
||||||
|
MCObjectWriter *createObjectWriter(raw_ostream &OS) const override {
|
||||||
|
return createX86ELFObjectWriter(OS, /*IsELF64*/ false, OSABI,
|
||||||
|
ELF::EM_X86_64);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ELFX86_64AsmBackend : public ELFX86AsmBackend {
|
class ELFX86_64AsmBackend : public ELFX86AsmBackend {
|
||||||
public:
|
public:
|
||||||
ELFX86_64AsmBackend(const Target &T, uint8_t OSABI, StringRef CPU)
|
ELFX86_64AsmBackend(const Target &T, uint8_t OSABI, StringRef CPU)
|
||||||
@ -824,5 +835,8 @@ MCAsmBackend *llvm::createX86_64AsmBackend(const Target &T,
|
|||||||
return new WindowsX86AsmBackend(T, true, CPU);
|
return new WindowsX86AsmBackend(T, true, CPU);
|
||||||
|
|
||||||
uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS());
|
uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS());
|
||||||
|
|
||||||
|
if (TheTriple.getEnvironment() == Triple::GNUX32)
|
||||||
|
return new ELFX86_X32AsmBackend(T, OSABI, CPU);
|
||||||
return new ELFX86_64AsmBackend(T, OSABI, CPU);
|
return new ELFX86_64AsmBackend(T, OSABI, CPU);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user