1 //===- RawTypes.h -----------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_PDB_RAW_RAWTYPES_H
11 #define LLVM_DEBUGINFO_PDB_RAW_RAWTYPES_H
12 
13 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
14 #include "llvm/Support/Endian.h"
15 
16 namespace llvm {
17 namespace pdb {
18 // This struct is defined as "SO" in langapi/include/pdb.h.
19 struct SectionOffset {
20   support::ulittle32_t Off;
21   support::ulittle16_t Isect;
22   char Padding[2];
23 };
24 
25 // This is HRFile.
26 struct PSHashRecord {
27   support::ulittle32_t Off; // Offset in the symbol record stream
28   support::ulittle32_t CRef;
29 };
30 
31 // This struct is defined as `SC` in include/dbicommon.h
32 struct SectionContrib {
33   support::ulittle16_t ISect;
34   char Padding[2];
35   support::little32_t Off;
36   support::little32_t Size;
37   support::ulittle32_t Characteristics;
38   support::ulittle16_t Imod;
39   char Padding2[2];
40   support::ulittle32_t DataCrc;
41   support::ulittle32_t RelocCrc;
42 };
43 
44 // This struct is defined as `SC2` in include/dbicommon.h
45 struct SectionContrib2 {
46   // To guarantee SectionContrib2 is standard layout, we cannot use inheritance.
47   SectionContrib Base;
48   support::ulittle32_t ISectCoff;
49 };
50 
51 // This corresponds to the `OMFSegMap` structure.
52 struct SecMapHeader {
53   support::ulittle16_t SecCount;    // Number of segment descriptors in table
54   support::ulittle16_t SecCountLog; // Number of logical segment descriptors
55 };
56 
57 // This corresponds to the `OMFSegMapDesc` structure.  The definition is not
58 // present in the reference implementation, but the layout is derived from
59 // code that accesses the fields.
60 struct SecMapEntry {
61   support::ulittle16_t Flags; // Descriptor flags.  See OMFSegDescFlags
62   support::ulittle16_t Ovl;   // Logical overlay number.
63   support::ulittle16_t Group; // Group index into descriptor array.
64   support::ulittle16_t Frame;
65   support::ulittle16_t SecName;       // Byte index of the segment or group name
66                                       // in the sstSegName table, or 0xFFFF.
67   support::ulittle16_t ClassName;     // Byte index of the class name in the
68                                       // sstSegName table, or 0xFFFF.
69   support::ulittle32_t Offset;        // Byte offset of the logical segment
70                                       // within the specified physical segment.
71                                       // If group is set in flags, offset is the
72                                       // offset of the group.
73   support::ulittle32_t SecByteLength; // Byte count of the segment or group.
74 };
75 
76 // Used for serialized hash table in TPI stream.
77 // In the reference, it is an array of TI and cbOff pair.
78 struct TypeIndexOffset {
79   codeview::TypeIndex Type;
80   support::ulittle32_t Offset;
81 };
82 
83 } // namespace pdb
84 } // namespace llvm
85 
86 #endif
87