1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[SystemZ/ZOS] Add binary format goff and operating system zos to the triple

Adds the binary format goff and the operating system zos to the triple
class. goff is selected as default binary format if zos is choosen as
operating system. No further functionality is added.

Reviewers: efriedma, tahonermann, hubert.reinterpertcast, MaskRay

Reviewed By: efriedma, tahonermann, hubert.reinterpertcast

Differential Revision: https://reviews.llvm.org/D82081
This commit is contained in:
Kai Nacke 2020-06-19 13:43:35 +02:00 committed by Kai Nacke
parent 27e916d19d
commit b0aab57571
7 changed files with 54 additions and 2 deletions

View File

@ -173,6 +173,7 @@ public:
OpenBSD,
Solaris,
Win32,
ZOS,
Haiku,
Minix,
RTEMS,
@ -224,6 +225,7 @@ public:
COFF,
ELF,
GOFF,
MachO,
Wasm,
XCOFF,
@ -468,6 +470,8 @@ public:
return getSubArch() == Triple::ARMSubArch_v7k;
}
bool isOSzOS() const { return getOS() == Triple::ZOS; }
/// isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
bool isOSDarwin() const {
return isMacOSX() || isiOS() || isWatchOS();
@ -620,6 +624,9 @@ public:
return getObjectFormat() == Triple::COFF;
}
/// Tests whether the OS uses the GOFF binary format.
bool isOSBinFormatGOFF() const { return getObjectFormat() == Triple::GOFF; }
/// Tests whether the environment is MachO.
bool isOSBinFormatMachO() const {
return getObjectFormat() == Triple::MachO;

View File

@ -510,6 +510,8 @@ public:
S = createWasmStreamer(Ctx, std::move(TAB), std::move(OW),
std::move(Emitter), RelaxAll);
break;
case Triple::GOFF:
report_fatal_error("GOFF MCObjectStreamer not implemented yet");
case Triple::XCOFF:
S = createXCOFFStreamer(Ctx, std::move(TAB), std::move(OW),
std::move(Emitter), RelaxAll);

View File

@ -4740,6 +4740,9 @@ static const char *getSectionNameForBitcode(const Triple &T) {
case Triple::Wasm:
case Triple::UnknownObjectFormat:
return ".llvmbc";
case Triple::GOFF:
llvm_unreachable("GOFF is not yet implemented");
break;
case Triple::XCOFF:
llvm_unreachable("XCOFF is not yet implemented");
break;
@ -4756,6 +4759,9 @@ static const char *getSectionNameForCommandline(const Triple &T) {
case Triple::Wasm:
case Triple::UnknownObjectFormat:
return ".llvmcmd";
case Triple::GOFF:
llvm_unreachable("GOFF is not yet implemented");
break;
case Triple::XCOFF:
llvm_unreachable("XCOFF is not yet implemented");
break;

View File

@ -904,6 +904,9 @@ void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
Env = IsWasm;
initWasmMCObjectFileInfo(TT);
break;
case Triple::GOFF:
report_fatal_error("Cannot initialize MC for GOFF object file format");
break;
case Triple::XCOFF:
Env = IsXCOFF;
initXCOFFMCObjectFileInfo(TT);
@ -923,6 +926,7 @@ MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name,
case Triple::MachO:
case Triple::COFF:
case Triple::Wasm:
case Triple::GOFF:
case Triple::XCOFF:
case Triple::UnknownObjectFormat:
report_fatal_error("Cannot get DWARF comdat section for this object file "

View File

@ -215,6 +215,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
case WASI: return "wasi";
case WatchOS: return "watchos";
case Win32: return "windows";
case ZOS: return "zos";
}
llvm_unreachable("Invalid OSType");
@ -499,6 +500,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("solaris", Triple::Solaris)
.StartsWith("win32", Triple::Win32)
.StartsWith("windows", Triple::Win32)
.StartsWith("zos", Triple::ZOS)
.StartsWith("haiku", Triple::Haiku)
.StartsWith("minix", Triple::Minix)
.StartsWith("rtems", Triple::RTEMS)
@ -552,6 +554,7 @@ static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) {
.EndsWith("xcoff", Triple::XCOFF)
.EndsWith("coff", Triple::COFF)
.EndsWith("elf", Triple::ELF)
.EndsWith("goff", Triple::GOFF)
.EndsWith("macho", Triple::MachO)
.EndsWith("wasm", Triple::Wasm)
.Default(Triple::UnknownObjectFormat);
@ -643,6 +646,7 @@ static StringRef getObjectFormatTypeName(Triple::ObjectFormatType Kind) {
case Triple::UnknownObjectFormat: return "";
case Triple::COFF: return "coff";
case Triple::ELF: return "elf";
case Triple::GOFF: return "goff";
case Triple::MachO: return "macho";
case Triple::Wasm: return "wasm";
case Triple::XCOFF: return "xcoff";
@ -700,7 +704,6 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::sparcv9:
case Triple::spir64:
case Triple::spir:
case Triple::systemz:
case Triple::tce:
case Triple::tcele:
case Triple::thumbeb:
@ -714,6 +717,11 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
return Triple::XCOFF;
return Triple::ELF;
case Triple::systemz:
if (T.isOSzOS())
return Triple::GOFF;
return Triple::ELF;
case Triple::wasm32:
case Triple::wasm64:
return Triple::Wasm;

View File

@ -1950,9 +1950,10 @@ StringRef ModuleAddressSanitizer::getGlobalMetadataSection() const {
case Triple::ELF: return "asan_globals";
case Triple::MachO: return "__DATA,__asan_globals,regular";
case Triple::Wasm:
case Triple::GOFF:
case Triple::XCOFF:
report_fatal_error(
"ModuleAddressSanitizer not implemented for object file format.");
"ModuleAddressSanitizer not implemented for object file format");
case Triple::UnknownObjectFormat:
break;
}

View File

@ -136,6 +136,18 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::FreeBSD, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("s390x-ibm-zos");
EXPECT_EQ(Triple::systemz, T.getArch());
EXPECT_EQ(Triple::IBM, T.getVendor());
EXPECT_EQ(Triple::ZOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("systemz-ibm-zos");
EXPECT_EQ(Triple::systemz, T.getArch());
EXPECT_EQ(Triple::IBM, T.getVendor());
EXPECT_EQ(Triple::ZOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("arm-none-none-eabi");
EXPECT_EQ(Triple::arm, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
@ -1314,6 +1326,15 @@ TEST(TripleTest, FileFormat) {
EXPECT_EQ(Triple::ELF, Triple("i686-pc-windows-msvc-elf").getObjectFormat());
EXPECT_EQ(Triple::ELF, Triple("i686-pc-cygwin-elf").getObjectFormat());
EXPECT_EQ(Triple::ELF, Triple("systemz-ibm-linux").getObjectFormat());
EXPECT_EQ(Triple::ELF, Triple("systemz-ibm-unknown").getObjectFormat());
EXPECT_EQ(Triple::GOFF, Triple("s390x-ibm-zos").getObjectFormat());
EXPECT_EQ(Triple::GOFF, Triple("systemz-ibm-zos").getObjectFormat());
EXPECT_EQ(Triple::GOFF, Triple("s390x-ibm-zos-goff").getObjectFormat());
EXPECT_EQ(Triple::GOFF, Triple("s390x-unknown-zos-goff").getObjectFormat());
EXPECT_EQ(Triple::GOFF, Triple("s390x---goff").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-unknown").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-unknown").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm32-wasi").getObjectFormat());
@ -1360,6 +1381,9 @@ TEST(TripleTest, FileFormat) {
T.setObjectFormat(Triple::XCOFF);
EXPECT_EQ(Triple::XCOFF, T.getObjectFormat());
T.setObjectFormat(Triple::GOFF);
EXPECT_EQ(Triple::GOFF, T.getObjectFormat());
}
TEST(TripleTest, NormalizeWindows) {