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