1//===--- COFFModuleDefinition.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// Windows-specific.
11// A parser for the module-definition file (.def file).
12// Parsed results are directly written to Config global variable.
13//
14// The format of module-definition files are described in this document:
15// https://msdn.microsoft.com/en-us/library/28d6s79h.aspx
16//
17//===----------------------------------------------------------------------===//
18
19#ifndef LLVM_OBJECT_COFF_MODULE_DEFINITION_H
20#define LLVM_OBJECT_COFF_MODULE_DEFINITION_H
21
22#include "llvm/Object/COFF.h"
23#include "llvm/Object/COFFImportFile.h"
24
25namespace llvm {
26namespace object {
27
28struct COFFModuleDefinition {
29  std::vector<COFFShortExport> Exports;
30  std::string OutputFile;
31  std::string ImportName;
32  uint64_t ImageBase = 0;
33  uint64_t StackReserve = 0;
34  uint64_t StackCommit = 0;
35  uint64_t HeapReserve = 0;
36  uint64_t HeapCommit = 0;
37  uint32_t MajorImageVersion = 0;
38  uint32_t MinorImageVersion = 0;
39  uint32_t MajorOSVersion = 0;
40  uint32_t MinorOSVersion = 0;
41};
42
43// mingw and wine def files do not mangle _ for x86 which
44// is a consequence of legacy binutils' dlltool functionality.
45// This MingwDef flag should be removed once mingw stops this pratice.
46Expected<COFFModuleDefinition>
47parseCOFFModuleDefinition(MemoryBufferRef MB, COFF::MachineTypes Machine,
48                          bool MingwDef = false);
49
50} // End namespace object.
51} // End namespace llvm.
52
53#endif
54