Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* deffile.h - header for .DEF file parser |
a35bc64f | 2 | Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. |
252b5132 RH |
3 | Written by DJ Delorie dj@cygnus.com |
4 | ||
5 | This file is part of GLD, the Gnu Linker. | |
6 | ||
7 | GLD is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2, or (at your option) | |
10 | any later version. | |
11 | ||
12 | GLD is distributed in the hope that it will be useful, | |
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 | |
19 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
21 | ||
1069dd8d ILT |
22 | #ifndef DEFFILE_H |
23 | #define DEFFILE_H | |
24 | ||
252b5132 RH |
25 | #include "ansidecl.h" |
26 | ||
27 | /* DEF storage definitions. Note that any ordinal may be zero, and | |
5cc18311 | 28 | any pointer may be NULL, if not defined by the DEF file. */ |
252b5132 | 29 | |
e47d05ad KH |
30 | typedef struct def_file_section { |
31 | char *name; /* always set */ | |
32 | char *class; /* may be NULL */ | |
33 | char flag_read, flag_write, flag_execute, flag_shared; | |
34 | } def_file_section; | |
35 | ||
36 | typedef struct def_file_export { | |
37 | char *name; /* always set */ | |
38 | char *internal_name; /* always set, may == name */ | |
39 | int ordinal; /* -1 if not specified */ | |
40 | int hint; | |
41 | char flag_private, flag_constant, flag_noname, flag_data; | |
42 | } def_file_export; | |
43 | ||
44 | typedef struct def_file_module { | |
45 | struct def_file_module *next; | |
46 | void *user_data; | |
47 | char name[1]; /* extended via malloc */ | |
48 | } def_file_module; | |
49 | ||
50 | typedef struct def_file_import { | |
51 | char *internal_name; /* always set */ | |
52 | def_file_module *module; /* always set */ | |
53 | char *name; /* may be NULL; either this or ordinal will be set */ | |
54 | int ordinal; /* may be -1 */ | |
939ba9d0 | 55 | int data; /* = 1 if data */ |
e47d05ad KH |
56 | } def_file_import; |
57 | ||
58 | typedef struct def_file { | |
939ba9d0 | 59 | /* From the NAME or LIBRARY command. */ |
e47d05ad KH |
60 | char *name; |
61 | int is_dll; /* -1 if NAME/LIBRARY not given */ | |
62 | bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */ | |
63 | ||
939ba9d0 | 64 | /* From the DESCRIPTION command. */ |
e47d05ad KH |
65 | char *description; |
66 | ||
939ba9d0 | 67 | /* From the STACK/HEAP command, -1 if unspecified. */ |
e47d05ad KH |
68 | int stack_reserve, stack_commit; |
69 | int heap_reserve, heap_commit; | |
70 | ||
939ba9d0 | 71 | /* From the SECTION/SEGMENT commands. */ |
e47d05ad KH |
72 | int num_section_defs; |
73 | def_file_section *section_defs; | |
74 | ||
939ba9d0 | 75 | /* From the EXPORTS commands. */ |
e47d05ad KH |
76 | int num_exports; |
77 | def_file_export *exports; | |
78 | ||
939ba9d0 | 79 | /* Used by imports for module names. */ |
e47d05ad KH |
80 | def_file_module *modules; |
81 | ||
939ba9d0 | 82 | /* From the IMPORTS commands. */ |
e47d05ad KH |
83 | int num_imports; |
84 | def_file_import *imports; | |
85 | ||
939ba9d0 | 86 | /* From the VERSION command, -1 if not specified. */ |
e47d05ad KH |
87 | int version_major, version_minor; |
88 | } def_file; | |
252b5132 RH |
89 | |
90 | extern def_file *def_file_empty PARAMS ((void)); | |
91 | ||
939ba9d0 NC |
92 | /* The second arg may be NULL. If not, this .def is appended to it. */ |
93 | extern def_file * def_file_parse | |
94 | PARAMS ((const char *, def_file *)); | |
95 | extern void def_file_free | |
96 | PARAMS ((def_file *)); | |
97 | extern def_file_export * def_file_add_export | |
98 | PARAMS ((def_file *, const char *, const char *, int)); | |
99 | extern def_file_import * def_file_add_import | |
100 | PARAMS ((def_file *, const char *, const char *, int, const char *)); | |
101 | extern void def_file_add_directive | |
102 | PARAMS ((def_file *, const char *, int)); | |
a35bc64f NC |
103 | extern def_file_module *def_get_module |
104 | PARAMS ((def_file *, const char *)); | |
252b5132 | 105 | #ifdef DEF_FILE_PRINT |
939ba9d0 NC |
106 | extern void def_file_print |
107 | PARAMS ((FILE *, def_file *)); | |
252b5132 | 108 | #endif |
1069dd8d ILT |
109 | |
110 | #endif /* DEFFILE_H */ |