LLVM  10.0.0svn
XCOFF.h
Go to the documentation of this file.
1 //===-- llvm/BinaryFormat/XCOFF.h - The XCOFF file format -------*- 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 file defines manifest constants for the XCOFF object file format.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_BINARYFORMAT_XCOFF_H
14 #define LLVM_BINARYFORMAT_XCOFF_H
15 
16 #include <cstdint>
17 
18 namespace llvm {
19 namespace XCOFF {
20 
21 // Constants used in the XCOFF definition.
23 
24 enum ReservedSectionNum { N_DEBUG = -2, N_ABS = -1, N_UNDEF = 0 };
25 
26 // x_smclas field of x_csect from system header: /usr/include/syms.h
27 /// Storage Mapping Class definitions.
28 enum StorageMappingClass : uint8_t {
29  // READ ONLY CLASSES
30  XMC_PR = 0, ///< Program Code
31  XMC_RO = 1, ///< Read Only Constant
32  XMC_DB = 2, ///< Debug Dictionary Table
33  XMC_GL = 6, ///< Global Linkage (Interfile Interface Code)
34  XMC_XO = 7, ///< Extended Operation (Pseudo Machine Instruction)
35  XMC_SV = 8, ///< Supervisor Call (32-bit process only)
36  XMC_SV64 = 17, ///< Supervisor Call for 64-bit process
37  XMC_SV3264 = 18, ///< Supervisor Call for both 32- and 64-bit processes
38  XMC_TI = 12, ///< Traceback Index csect
39  XMC_TB = 13, ///< Traceback Table csect
40 
41  // READ WRITE CLASSES
42  XMC_RW = 5, ///< Read Write Data
43  XMC_TC0 = 15, ///< TOC Anchor for TOC Addressability
44  XMC_TC = 3, ///< General TOC item
45  XMC_TD = 16, ///< Scalar data item in the TOC
46  XMC_DS = 10, ///< Descriptor csect
47  XMC_UA = 4, ///< Unclassified - Treated as Read Write
48  XMC_BS = 9, ///< BSS class (uninitialized static internal)
49  XMC_UC = 11, ///< Un-named Fortran Common
50 
51  XMC_TL = 20, ///< Initialized thread-local variable
52  XMC_UL = 21, ///< Uninitialized thread-local variable
53  XMC_TE = 22 ///< Symbol mapped at the end of TOC
54 };
55 
56 // Flags for defining the section type. Used for the s_flags field of
57 // the section header structure. Defined in the system header `scnhdr.h`.
59  STYP_PAD = 0x0008,
60  STYP_DWARF = 0x0010,
61  STYP_TEXT = 0x0020,
62  STYP_DATA = 0x0040,
63  STYP_BSS = 0x0080,
64  STYP_EXCEPT = 0x0100,
65  STYP_INFO = 0x0200,
66  STYP_TDATA = 0x0400,
67  STYP_TBSS = 0x0800,
68  STYP_LOADER = 0x1000,
69  STYP_DEBUG = 0x2000,
70  STYP_TYPCHK = 0x4000,
71  STYP_OVRFLO = 0x8000
72 };
73 
74 // STORAGE CLASSES, n_sclass field of syment.
75 // The values come from `storclass.h` and `dbxstclass.h`.
76 enum StorageClass : uint8_t {
77  // Storage classes used for symbolic debugging symbols.
78  C_FILE = 103, // File name
79  C_BINCL = 108, // Beginning of include file
80  C_EINCL = 109, // Ending of include file
81  C_GSYM = 128, // Global variable
82  C_STSYM = 133, // Statically allocated symbol
83  C_BCOMM = 135, // Beginning of common block
84  C_ECOMM = 137, // End of common block
85  C_ENTRY = 141, // Alternate entry
86  C_BSTAT = 143, // Beginning of static block
87  C_ESTAT = 144, // End of static block
88  C_GTLS = 145, // Global thread-local variable
89  C_STTLS = 146, // Static thread-local variable
90 
91  // Storage classes used for DWARF symbols.
92  C_DWARF = 112, // DWARF section symbol
93 
94  // Storage classes used for absolute symbols.
95  C_LSYM = 129, // Automatic variable allocated on stack
96  C_PSYM = 130, // Argument to subroutine allocated on stack
97  C_RSYM = 131, // Register variable
98  C_RPSYM = 132, // Argument to function or procedure stored in register
99  C_ECOML = 136, // Local member of common block
100  C_FUN = 142, // Function or procedure
101 
102  // Storage classes used for undefined external symbols or
103  // symbols of general sections.
104  C_EXT = 2, // External symbol
105  C_WEAKEXT = 111, // Weak external symbol
106 
107  // Storage classes used for symbols of general sections.
108  C_NULL = 0,
109  C_STAT = 3, // Static
110  C_BLOCK = 100, // ".bb" or ".eb"
111  C_FCN = 101, // ".bf" or ".ef"
112  C_HIDEXT = 107, // Un-named external symbol
113  C_INFO = 110, // Comment string in .info section
114  C_DECL = 140, // Declaration of object (type)
115 
116  // Storage classes - Obsolete/Undocumented.
117  C_AUTO = 1, // Automatic variable
118  C_REG = 4, // Register variable
119  C_EXTDEF = 5, // External definition
120  C_LABEL = 6, // Label
121  C_ULABEL = 7, // Undefined label
122  C_MOS = 8, // Member of structure
123  C_ARG = 9, // Function argument
124  C_STRTAG = 10, // Structure tag
125  C_MOU = 11, // Member of union
126  C_UNTAG = 12, // Union tag
127  C_TPDEF = 13, // Type definition
128  C_USTATIC = 14, // Undefined static
129  C_ENTAG = 15, // Enumeration tag
130  C_MOE = 16, // Member of enumeration
131  C_REGPARM = 17, // Register parameter
132  C_FIELD = 18, // Bit field
133  C_EOS = 102, // End of structure
134  C_LINE = 104,
135  C_ALIAS = 105, // Duplicate tag
136  C_HIDDEN = 106, // Special storage class for external
137  C_EFCN = 255, // Physical end of function
138 
139  // Storage classes - reserved
140  C_TCSYM = 134 // Reserved
141 };
142 
144  XTY_ER = 0, ///< External reference.
145  XTY_SD = 1, ///< Csect definition for initialized storage.
146  XTY_LD = 2, ///< Label definition.
147  ///< Defines an entry point to an initialized csect.
148  XTY_CM = 3 ///< Common csect definition. For uninitialized storage.
149 };
150 
151 struct FileHeader32 {
152  uint16_t Magic;
154  int32_t TimeStamp;
158  uint16_t Flags;
159 };
160 
171  int32_t Flags;
172 };
173 
174 enum CFileStringType : uint8_t {
175  XFT_FN = 0, ///< Specifies the source-file name.
176  XFT_CT = 1, ///< Specifies the compiler time stamp.
177  XFT_CV = 2, ///< Specifies the compiler version number.
178  XFT_CD = 128 ///< Specifies compiler-defined information.
179 };
180 
181 enum CFileLangId : uint8_t {
182  TB_C = 0, ///< C language.
183  TB_CPLUSPLUS = 9 ///< C++ language.
184 };
185 
186 enum CFileCpuId : uint8_t {
187  TCPU_PPC64 = 2, ///< PowerPC common architecture 64-bit mode.
188  TCPU_COM = 3, ///< POWER and PowerPC architecture common.
189  TCPU_970 = 19 ///< PPC970 - PowerPC 64-bit architecture.
190 };
191 
192 } // end namespace XCOFF
193 } // end namespace llvm
194 
195 #endif
Symbol mapped at the end of TOC.
Definition: XCOFF.h:53
C++ language.
Definition: XCOFF.h:183
This class represents lattice values for constants.
Definition: AllocatorList.h:23
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Supervisor Call for both 32- and 64-bit processes.
Definition: XCOFF.h:37
TOC Anchor for TOC Addressability.
Definition: XCOFF.h:43
Scalar data item in the TOC.
Definition: XCOFF.h:45
Read Write Data.
Definition: XCOFF.h:42
uint16_t NumberOfLineNumbers
Definition: XCOFF.h:170
Traceback Table csect.
Definition: XCOFF.h:39
Specifies the compiler time stamp.
Definition: XCOFF.h:176
SectionTypeFlags
Definition: XCOFF.h:58
StorageClass
Definition: XCOFF.h:76
PPC970 - PowerPC 64-bit architecture.
Definition: XCOFF.h:189
Global Linkage (Interfile Interface Code)
Definition: XCOFF.h:33
Common csect definition. For uninitialized storage.
Definition: XCOFF.h:148
uint32_t SymbolTableFileOffset
Definition: XCOFF.h:155
Supervisor Call for 64-bit process.
Definition: XCOFF.h:36
Specifies compiler-defined information.
Definition: XCOFF.h:178
External reference.
Definition: XCOFF.h:144
Program Code.
Definition: XCOFF.h:30
StorageMappingClass
Storage Mapping Class definitions.
Definition: XCOFF.h:28
Extended Operation (Pseudo Machine Instruction)
Definition: XCOFF.h:34
Uninitialized thread-local variable.
Definition: XCOFF.h:52
Initialized thread-local variable.
Definition: XCOFF.h:51
Un-named Fortran Common.
Definition: XCOFF.h:49
uint32_t FileOffsetToRelocations
Definition: XCOFF.h:167
General TOC item.
Definition: XCOFF.h:44
Label definition.
Definition: XCOFF.h:146
Traceback Index csect.
Definition: XCOFF.h:38
POWER and PowerPC architecture common.
Definition: XCOFF.h:188
Specifies the compiler version number.
Definition: XCOFF.h:177
Specifies the source-file name.
Definition: XCOFF.h:175
PowerPC common architecture 64-bit mode.
Definition: XCOFF.h:187
Supervisor Call (32-bit process only)
Definition: XCOFF.h:35
BSS class (uninitialized static internal)
Definition: XCOFF.h:48
Debug Dictionary Table.
Definition: XCOFF.h:32
uint16_t NumberOfSections
Definition: XCOFF.h:153
Unclassified - Treated as Read Write.
Definition: XCOFF.h:47
Read Only Constant.
Definition: XCOFF.h:31
Csect definition for initialized storage.
Definition: XCOFF.h:145
ReservedSectionNum
Definition: XCOFF.h:24
CFileStringType
Definition: XCOFF.h:174
uint16_t NumberOfRelocations
Definition: XCOFF.h:169
int32_t NumberOfSymbolTableEntries
Definition: XCOFF.h:156
uint16_t AuxiliaryHeaderSize
Definition: XCOFF.h:157
uint32_t FileOffsetToLineNumbers
Definition: XCOFF.h:168
C language.
Definition: XCOFF.h:182
Descriptor csect.
Definition: XCOFF.h:46