forked from OSchip/llvm-project
[Triple] Add triple for Fuchsia
Fuchsia is a new operating system. Differential Revision: https://reviews.llvm.org/D25116 llvm-svn: 283419
This commit is contained in:
parent
936b1e774f
commit
e023d62e76
|
@ -144,6 +144,7 @@ public:
|
|||
Darwin,
|
||||
DragonFly,
|
||||
FreeBSD,
|
||||
Fuchsia,
|
||||
IOS,
|
||||
KFreeBSD,
|
||||
Linux,
|
||||
|
@ -462,6 +463,10 @@ public:
|
|||
return getOS() == Triple::FreeBSD;
|
||||
}
|
||||
|
||||
bool isOSFuchsia() const {
|
||||
return getOS() == Triple::Fuchsia;
|
||||
}
|
||||
|
||||
bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
|
||||
|
||||
bool isOSSolaris() const {
|
||||
|
|
|
@ -168,6 +168,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
|
|||
case Darwin: return "darwin";
|
||||
case DragonFly: return "dragonfly";
|
||||
case FreeBSD: return "freebsd";
|
||||
case Fuchsia: return "fuchsia";
|
||||
case IOS: return "ios";
|
||||
case KFreeBSD: return "kfreebsd";
|
||||
case Linux: return "linux";
|
||||
|
@ -438,6 +439,7 @@ static Triple::OSType parseOS(StringRef OSName) {
|
|||
.StartsWith("darwin", Triple::Darwin)
|
||||
.StartsWith("dragonfly", Triple::DragonFly)
|
||||
.StartsWith("freebsd", Triple::FreeBSD)
|
||||
.StartsWith("fuchsia", Triple::Fuchsia)
|
||||
.StartsWith("ios", Triple::IOS)
|
||||
.StartsWith("kfreebsd", Triple::KFreeBSD)
|
||||
.StartsWith("linux", Triple::Linux)
|
||||
|
|
|
@ -54,6 +54,8 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
|
|||
return make_unique<X86FreeBSDTargetObjectFile>();
|
||||
if (TT.isOSLinux() || TT.isOSNaCl())
|
||||
return make_unique<X86LinuxNaClTargetObjectFile>();
|
||||
if (TT.isOSFuchsia())
|
||||
return make_unique<X86FuchsiaTargetObjectFile>();
|
||||
if (TT.isOSBinFormatELF())
|
||||
return make_unique<X86ELFTargetObjectFile>();
|
||||
if (TT.isKnownWindowsMSVCEnvironment() || TT.isWindowsCoreCLREnvironment())
|
||||
|
|
|
@ -72,6 +72,13 @@ X86FreeBSDTargetObjectFile::Initialize(MCContext &Ctx,
|
|||
InitializeELF(TM.Options.UseInitArray);
|
||||
}
|
||||
|
||||
void
|
||||
X86FuchsiaTargetObjectFile::Initialize(MCContext &Ctx,
|
||||
const TargetMachine &TM) {
|
||||
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
|
||||
InitializeELF(TM.Options.UseInitArray);
|
||||
}
|
||||
|
||||
void
|
||||
X86LinuxNaClTargetObjectFile::Initialize(MCContext &Ctx,
|
||||
const TargetMachine &TM) {
|
||||
|
|
|
@ -55,6 +55,11 @@ namespace llvm {
|
|||
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
||||
};
|
||||
|
||||
/// \brief This implementation is used for Fuchsia on x86-64.
|
||||
class X86FuchsiaTargetObjectFile : public X86ELFTargetObjectFile {
|
||||
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
||||
};
|
||||
|
||||
/// X86LinuxNaClTargetObjectFile - This implementation is used for linux and
|
||||
/// Native Client on x86 and x86-64.
|
||||
class X86LinuxNaClTargetObjectFile : public X86ELFTargetObjectFile {
|
||||
|
|
|
@ -200,6 +200,12 @@ TEST(TripleTest, ParsedIDs) {
|
|||
EXPECT_EQ(Triple::CloudABI, T.getOS());
|
||||
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
|
||||
|
||||
T = Triple("x86_64-unknown-fuchsia");
|
||||
EXPECT_EQ(Triple::x86_64, T.getArch());
|
||||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
||||
EXPECT_EQ(Triple::Fuchsia, T.getOS());
|
||||
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
|
||||
|
||||
T = Triple("wasm32-unknown-unknown");
|
||||
EXPECT_EQ(Triple::wasm32, T.getArch());
|
||||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
||||
|
|
Loading…
Reference in New Issue