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