1 //===-- llvm/BinaryFormat/GOFF.h - GOFF definitions --------------*- C++-*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This header contains common, non-processor-specific data structures and 10 // constants for the GOFF file format. 11 // 12 // GOFF specifics can be found in MVS Program Management: Advanced Facilities. 13 // See 14 // https://www.ibm.com/docs/en/zos/3.1.0?topic=facilities-generalized-object-file-format-goff 15 // 16 //===----------------------------------------------------------------------===// 17 18 #ifndef LLVM_BINARYFORMAT_GOFF_H 19 #define LLVM_BINARYFORMAT_GOFF_H 20 21 #include "llvm/Support/DataTypes.h" 22 23 namespace llvm { 24 25 namespace GOFF { 26 27 /// \brief Length of the parts of a physical GOFF record. 28 constexpr uint8_t RecordLength = 80; 29 constexpr uint8_t RecordPrefixLength = 3; 30 constexpr uint8_t PayloadLength = 77; 31 constexpr uint8_t RecordContentLength = RecordLength - RecordPrefixLength; 32 33 /// \brief Maximum data length before starting a new card for RLD and TXT data. 34 /// 35 /// The maximum number of bytes that can be included in an RLD or TXT record and 36 /// their continuations is a SIGNED 16 bit int despite what the spec says. The 37 /// number of bytes we allow ourselves to attach to a card is thus arbitrarily 38 /// limited to 32K-1 bytes. 39 constexpr uint16_t MaxDataLength = 32 * 1024 - 1; 40 41 /// \brief Prefix byte on every record. This indicates GOFF format. 42 constexpr uint8_t PTVPrefix = 0x03; 43 44 enum RecordType : uint8_t { 45 RT_ESD = 0, 46 RT_TXT = 1, 47 RT_RLD = 2, 48 RT_LEN = 3, 49 RT_END = 4, 50 RT_HDR = 15, 51 }; 52 53 enum ESDSymbolType : uint8_t { 54 ESD_ST_SectionDefinition = 0, 55 ESD_ST_ElementDefinition = 1, 56 ESD_ST_LabelDefinition = 2, 57 ESD_ST_PartReference = 3, 58 ESD_ST_ExternalReference = 4, 59 }; 60 61 enum ESDNameSpaceId : uint8_t { 62 ESD_NS_ProgramManagementBinder = 0, 63 ESD_NS_NormalName = 1, 64 ESD_NS_PseudoRegister = 2, 65 ESD_NS_Parts = 3 66 }; 67 68 enum ESDReserveQwords : uint8_t { 69 ESD_RQ_0 = 0, 70 ESD_RQ_1 = 1, 71 ESD_RQ_2 = 2, 72 ESD_RQ_3 = 3 73 }; 74 75 enum ESDAmode : uint8_t { 76 ESD_AMODE_None = 0, 77 ESD_AMODE_24 = 1, 78 ESD_AMODE_31 = 2, 79 ESD_AMODE_ANY = 3, 80 ESD_AMODE_64 = 4, 81 ESD_AMODE_MIN = 16, 82 }; 83 84 enum ESDRmode : uint8_t { 85 ESD_RMODE_None = 0, 86 ESD_RMODE_24 = 1, 87 ESD_RMODE_31 = 3, 88 ESD_RMODE_64 = 4, 89 }; 90 91 enum ESDTextStyle : uint8_t { 92 ESD_TS_ByteOriented = 0, 93 ESD_TS_Structured = 1, 94 ESD_TS_Unstructured = 2, 95 }; 96 97 enum ESDBindingAlgorithm : uint8_t { 98 ESD_BA_Concatenate = 0, 99 ESD_BA_Merge = 1, 100 }; 101 102 enum ESDTaskingBehavior : uint8_t { 103 ESD_TA_Unspecified = 0, 104 ESD_TA_NonReus = 1, 105 ESD_TA_Reus = 2, 106 ESD_TA_Rent = 3, 107 }; 108 109 enum ESDExecutable : uint8_t { 110 ESD_EXE_Unspecified = 0, 111 ESD_EXE_DATA = 1, 112 ESD_EXE_CODE = 2, 113 }; 114 115 enum ESDDuplicateSymbolSeverity : uint8_t { 116 ESD_DSS_NoWarning = 0, 117 ESD_DSS_Warning = 1, 118 ESD_DSS_Error = 2, 119 ESD_DSS_Reserved = 3, 120 }; 121 122 enum ESDBindingStrength : uint8_t { 123 ESD_BST_Strong = 0, 124 ESD_BST_Weak = 1, 125 }; 126 127 enum ESDLoadingBehavior : uint8_t { 128 ESD_LB_Initial = 0, 129 ESD_LB_Deferred = 1, 130 ESD_LB_NoLoad = 2, 131 ESD_LB_Reserved = 3, 132 }; 133 134 enum ESDBindingScope : uint8_t { 135 ESD_BSC_Unspecified = 0, 136 ESD_BSC_Section = 1, 137 ESD_BSC_Module = 2, 138 ESD_BSC_Library = 3, 139 ESD_BSC_ImportExport = 4, 140 }; 141 142 enum ESDLinkageType : uint8_t { ESD_LT_OS = 0, ESD_LT_XPLink = 1 }; 143 144 enum ESDAlignment : uint8_t { 145 ESD_ALIGN_Byte = 0, 146 ESD_ALIGN_Halfword = 1, 147 ESD_ALIGN_Fullword = 2, 148 ESD_ALIGN_Doubleword = 3, 149 ESD_ALIGN_Quadword = 4, 150 ESD_ALIGN_32byte = 5, 151 ESD_ALIGN_64byte = 6, 152 ESD_ALIGN_128byte = 7, 153 ESD_ALIGN_256byte = 8, 154 ESD_ALIGN_512byte = 9, 155 ESD_ALIGN_1024byte = 10, 156 ESD_ALIGN_2Kpage = 11, 157 ESD_ALIGN_4Kpage = 12, 158 }; 159 160 enum ENDEntryPointRequest : uint8_t { 161 END_EPR_None = 0, 162 END_EPR_EsdidOffset = 1, 163 END_EPR_ExternalName = 2, 164 END_EPR_Reserved = 3, 165 }; 166 167 // \brief Subsections of the primary C_CODE section in the object file. 168 enum SubsectionKind : uint8_t { 169 SK_PPA1 = 2, 170 SK_PPA2 = 4, 171 }; 172 } // end namespace GOFF 173 174 } // end namespace llvm 175 176 #endif // LLVM_BINARYFORMAT_GOFF_H 177