COFFModuleDefinition.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //===--- COFFModuleDefinition.h ---------------------------------*- 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. // 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. #ifndef LLVM_OBJECT_COFFMODULEDEFINITION_H
  18. #define LLVM_OBJECT_COFFMODULEDEFINITION_H
  19. #include "llvm/Object/COFF.h"
  20. #include "llvm/Object/COFFImportFile.h"
  21. namespace llvm {
  22. namespace object {
  23. struct COFFModuleDefinition {
  24. std::vector<COFFShortExport> Exports;
  25. std::string OutputFile;
  26. std::string ImportName;
  27. uint64_t ImageBase = 0;
  28. uint64_t StackReserve = 0;
  29. uint64_t StackCommit = 0;
  30. uint64_t HeapReserve = 0;
  31. uint64_t HeapCommit = 0;
  32. uint32_t MajorImageVersion = 0;
  33. uint32_t MinorImageVersion = 0;
  34. uint32_t MajorOSVersion = 0;
  35. uint32_t MinorOSVersion = 0;
  36. };
  37. // mingw and wine def files do not mangle _ for x86 which
  38. // is a consequence of legacy binutils' dlltool functionality.
  39. // This MingwDef flag should be removed once mingw stops this pratice.
  40. Expected<COFFModuleDefinition>
  41. parseCOFFModuleDefinition(MemoryBufferRef MB, COFF::MachineTypes Machine,
  42. bool MingwDef = false);
  43. } // End namespace object.
  44. } // End namespace llvm.
  45. #endif