]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* deffile.h - header for .DEF file parser |
fd67aa11 | 2 | Copyright (C) 1998-2024 Free Software Foundation, Inc. |
252b5132 RH |
3 | Written by DJ Delorie dj@cygnus.com |
4 | ||
f96b4a7b | 5 | This file is part of the GNU Binutils. |
252b5132 | 6 | |
f96b4a7b | 7 | This program is free software; you can redistribute it and/or modify |
252b5132 | 8 | it under the terms of the GNU General Public License as published by |
f96b4a7b | 9 | the Free Software Foundation; either version 3, or (at your option) |
252b5132 RH |
10 | any later version. |
11 | ||
f96b4a7b | 12 | The program is distributed in the hope that it will be useful, |
252b5132 RH |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GLD; see the file COPYING. If not, write to the Free | |
75be928b NC |
19 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
20 | 02110-1301, USA. */ | |
252b5132 | 21 | |
1069dd8d ILT |
22 | #ifndef DEFFILE_H |
23 | #define DEFFILE_H | |
24 | ||
252b5132 | 25 | /* DEF storage definitions. Note that any ordinal may be zero, and |
5cc18311 | 26 | any pointer may be NULL, if not defined by the DEF file. */ |
252b5132 | 27 | |
e47d05ad KH |
28 | typedef struct def_file_section { |
29 | char *name; /* always set */ | |
30 | char *class; /* may be NULL */ | |
31 | char flag_read, flag_write, flag_execute, flag_shared; | |
32 | } def_file_section; | |
33 | ||
34 | typedef struct def_file_export { | |
35 | char *name; /* always set */ | |
36 | char *internal_name; /* always set, may == name */ | |
370dfff4 | 37 | char *its_name; /* optional export table name referred to. */ |
e47d05ad KH |
38 | int ordinal; /* -1 if not specified */ |
39 | int hint; | |
a8d701fd | 40 | char flag_private, flag_constant, flag_noname, flag_data, flag_forward; |
e47d05ad KH |
41 | } def_file_export; |
42 | ||
43 | typedef struct def_file_module { | |
44 | struct def_file_module *next; | |
45 | void *user_data; | |
46 | char name[1]; /* extended via malloc */ | |
47 | } def_file_module; | |
48 | ||
49 | typedef struct def_file_import { | |
50 | char *internal_name; /* always set */ | |
51 | def_file_module *module; /* always set */ | |
52 | char *name; /* may be NULL; either this or ordinal will be set */ | |
370dfff4 | 53 | char *its_name; /* optional import table name referred to. */ |
e47d05ad | 54 | int ordinal; /* may be -1 */ |
939ba9d0 | 55 | int data; /* = 1 if data */ |
e47d05ad KH |
56 | } def_file_import; |
57 | ||
c1711530 DK |
58 | typedef struct def_file_aligncomm { |
59 | struct def_file_aligncomm *next; /* Chain pointer. */ | |
60 | char *symbol_name; /* Name of common symbol. */ | |
61 | unsigned int alignment; /* log-2 alignment. */ | |
62 | } def_file_aligncomm; | |
63 | ||
37513c1e | 64 | typedef struct def_file_exclude_symbol { |
37513c1e MS |
65 | char *symbol_name; /* Name of excluded symbol. */ |
66 | } def_file_exclude_symbol; | |
67 | ||
e47d05ad | 68 | typedef struct def_file { |
939ba9d0 | 69 | /* From the NAME or LIBRARY command. */ |
e47d05ad KH |
70 | char *name; |
71 | int is_dll; /* -1 if NAME/LIBRARY not given */ | |
72 | bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */ | |
73 | ||
939ba9d0 | 74 | /* From the DESCRIPTION command. */ |
e47d05ad KH |
75 | char *description; |
76 | ||
939ba9d0 | 77 | /* From the STACK/HEAP command, -1 if unspecified. */ |
e47d05ad KH |
78 | int stack_reserve, stack_commit; |
79 | int heap_reserve, heap_commit; | |
80 | ||
939ba9d0 | 81 | /* From the SECTION/SEGMENT commands. */ |
e47d05ad KH |
82 | int num_section_defs; |
83 | def_file_section *section_defs; | |
84 | ||
939ba9d0 | 85 | /* From the EXPORTS commands. */ |
e47d05ad | 86 | int num_exports; |
825a844f | 87 | unsigned int max_exports; |
e47d05ad KH |
88 | def_file_export *exports; |
89 | ||
939ba9d0 | 90 | /* Used by imports for module names. */ |
e47d05ad KH |
91 | def_file_module *modules; |
92 | ||
939ba9d0 | 93 | /* From the IMPORTS commands. */ |
e47d05ad | 94 | int num_imports; |
825a844f | 95 | unsigned int max_imports; |
e47d05ad KH |
96 | def_file_import *imports; |
97 | ||
939ba9d0 | 98 | /* From the VERSION command, -1 if not specified. */ |
e47d05ad | 99 | int version_major, version_minor; |
c1711530 DK |
100 | |
101 | /* Only expected from .drectve sections, not .DEF files. */ | |
102 | def_file_aligncomm *aligncomms; | |
61f6b650 MS |
103 | |
104 | /* From EXCLUDE_SYMBOLS or embedded directives. */ | |
a33a94cf | 105 | unsigned int num_exclude_symbols, max_exclude_symbols; |
37513c1e | 106 | def_file_exclude_symbol *exclude_symbols; |
c1711530 | 107 | |
e47d05ad | 108 | } def_file; |
252b5132 | 109 | |
1579bae1 | 110 | extern def_file *def_file_empty (void); |
252b5132 | 111 | |
939ba9d0 | 112 | /* The second arg may be NULL. If not, this .def is appended to it. */ |
1579bae1 AM |
113 | extern def_file *def_file_parse (const char *, def_file *); |
114 | extern void def_file_free (def_file *); | |
115 | extern def_file_export *def_file_add_export (def_file *, const char *, | |
7fcab871 | 116 | const char *, int, |
825a844f | 117 | const char *, bool *); |
1579bae1 | 118 | extern def_file_import *def_file_add_import (def_file *, const char *, |
7fcab871 | 119 | const char *, int, const char *, |
825a844f | 120 | const char *, bool *); |
9d8e8f44 EB |
121 | extern int def_file_add_import_from (def_file *fdef, |
122 | int num_imports, | |
123 | const char *name, | |
124 | const char *module, | |
125 | int ordinal, | |
126 | const char *internal_name, | |
127 | const char *its_name); | |
128 | extern def_file_import *def_file_add_import_at (def_file *, int, const char *, | |
129 | const char *, int, const char *, | |
130 | const char *); | |
1579bae1 AM |
131 | extern void def_file_add_directive (def_file *, const char *, int); |
132 | extern def_file_module *def_get_module (def_file *, const char *); | |
252b5132 | 133 | #ifdef DEF_FILE_PRINT |
1579bae1 | 134 | extern void def_file_print (FILE *, def_file *); |
252b5132 | 135 | #endif |
1069dd8d ILT |
136 | |
137 | #endif /* DEFFILE_H */ |