COFFModuleDefinition.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- COFFModuleDefinition.h ---------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // Windows-specific.
  15. // A parser for the module-definition file (.def file).
  16. // Parsed results are directly written to Config global variable.
  17. //
  18. // The format of module-definition files are described in this document:
  19. // https://msdn.microsoft.com/en-us/library/28d6s79h.aspx
  20. //
  21. //===----------------------------------------------------------------------===//
  22. #ifndef LLVM_OBJECT_COFF_MODULE_DEFINITION_H
  23. #define LLVM_OBJECT_COFF_MODULE_DEFINITION_H
  24. #include "llvm/Object/COFF.h"
  25. #include "llvm/Object/COFFImportFile.h"
  26. namespace llvm {
  27. namespace object {
  28. struct 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. // 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.
  45. Expected<COFFModuleDefinition>
  46. parseCOFFModuleDefinition(MemoryBufferRef MB, COFF::MachineTypes Machine,
  47. bool MingwDef = false);
  48. } // End namespace object.
  49. } // End namespace llvm.
  50. #endif
  51. #ifdef __GNUC__
  52. #pragma GCC diagnostic pop
  53. #endif