deffile.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* deffile.h - header for .DEF file parser
  2. Copyright (C) 1998-2022 Free Software Foundation, Inc.
  3. Written by DJ Delorie dj@cygnus.com
  4. This file is part of the GNU Binutils.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. The program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GLD; see the file COPYING. If not, write to the Free
  15. Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
  16. 02110-1301, USA. */
  17. #ifndef DEFFILE_H
  18. #define DEFFILE_H
  19. /* DEF storage definitions. Note that any ordinal may be zero, and
  20. any pointer may be NULL, if not defined by the DEF file. */
  21. typedef struct def_file_section {
  22. char *name; /* always set */
  23. char *class; /* may be NULL */
  24. char flag_read, flag_write, flag_execute, flag_shared;
  25. } def_file_section;
  26. typedef struct def_file_export {
  27. char *name; /* always set */
  28. char *internal_name; /* always set, may == name */
  29. char *its_name; /* optional export table name referred to. */
  30. int ordinal; /* -1 if not specified */
  31. int hint;
  32. char flag_private, flag_constant, flag_noname, flag_data, flag_forward;
  33. } def_file_export;
  34. typedef struct def_file_module {
  35. struct def_file_module *next;
  36. void *user_data;
  37. char name[1]; /* extended via malloc */
  38. } def_file_module;
  39. typedef struct def_file_import {
  40. char *internal_name; /* always set */
  41. def_file_module *module; /* always set */
  42. char *name; /* may be NULL; either this or ordinal will be set */
  43. char *its_name; /* optional import table name referred to. */
  44. int ordinal; /* may be -1 */
  45. int data; /* = 1 if data */
  46. } def_file_import;
  47. typedef struct def_file_aligncomm {
  48. struct def_file_aligncomm *next; /* Chain pointer. */
  49. char *symbol_name; /* Name of common symbol. */
  50. unsigned int alignment; /* log-2 alignment. */
  51. } def_file_aligncomm;
  52. typedef struct def_file {
  53. /* From the NAME or LIBRARY command. */
  54. char *name;
  55. int is_dll; /* -1 if NAME/LIBRARY not given */
  56. bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */
  57. /* From the DESCRIPTION command. */
  58. char *description;
  59. /* From the STACK/HEAP command, -1 if unspecified. */
  60. int stack_reserve, stack_commit;
  61. int heap_reserve, heap_commit;
  62. /* From the SECTION/SEGMENT commands. */
  63. int num_section_defs;
  64. def_file_section *section_defs;
  65. /* From the EXPORTS commands. */
  66. int num_exports;
  67. def_file_export *exports;
  68. /* Used by imports for module names. */
  69. def_file_module *modules;
  70. /* From the IMPORTS commands. */
  71. int num_imports;
  72. def_file_import *imports;
  73. /* From the VERSION command, -1 if not specified. */
  74. int version_major, version_minor;
  75. /* Only expected from .drectve sections, not .DEF files. */
  76. def_file_aligncomm *aligncomms;
  77. } def_file;
  78. extern def_file *def_file_empty (void);
  79. /* The second arg may be NULL. If not, this .def is appended to it. */
  80. extern def_file *def_file_parse (const char *, def_file *);
  81. extern void def_file_free (def_file *);
  82. extern def_file_export *def_file_add_export (def_file *, const char *,
  83. const char *, int,
  84. const char *, int *);
  85. extern def_file_import *def_file_add_import (def_file *, const char *,
  86. const char *, int, const char *,
  87. const char *, int *);
  88. extern int def_file_add_import_from (def_file *fdef,
  89. int num_imports,
  90. const char *name,
  91. const char *module,
  92. int ordinal,
  93. const char *internal_name,
  94. const char *its_name);
  95. extern def_file_import *def_file_add_import_at (def_file *, int, const char *,
  96. const char *, int, const char *,
  97. const char *);
  98. extern void def_file_add_directive (def_file *, const char *, int);
  99. extern def_file_module *def_get_module (def_file *, const char *);
  100. #ifdef DEF_FILE_PRINT
  101. extern void def_file_print (FILE *, def_file *);
  102. #endif
  103. #endif /* DEFFILE_H */