Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* deffile.h - header for .DEF file parser |
f96b4a7b | 2 | Copyright 1998, 1999, 2000, 2002, 2003, 2007 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 */ | |
37 | int ordinal; /* -1 if not specified */ | |
38 | int hint; | |
a8d701fd | 39 | char flag_private, flag_constant, flag_noname, flag_data, flag_forward; |
e47d05ad KH |
40 | } def_file_export; |
41 | ||
42 | typedef struct def_file_module { | |
43 | struct def_file_module *next; | |
44 | void *user_data; | |
45 | char name[1]; /* extended via malloc */ | |
46 | } def_file_module; | |
47 | ||
48 | typedef struct def_file_import { | |
49 | char *internal_name; /* always set */ | |
50 | def_file_module *module; /* always set */ | |
51 | char *name; /* may be NULL; either this or ordinal will be set */ | |
52 | int ordinal; /* may be -1 */ | |
939ba9d0 | 53 | int data; /* = 1 if data */ |
e47d05ad KH |
54 | } def_file_import; |
55 | ||
c1711530 DK |
56 | typedef struct def_file_aligncomm { |
57 | struct def_file_aligncomm *next; /* Chain pointer. */ | |
58 | char *symbol_name; /* Name of common symbol. */ | |
59 | unsigned int alignment; /* log-2 alignment. */ | |
60 | } def_file_aligncomm; | |
61 | ||
e47d05ad | 62 | typedef struct def_file { |
939ba9d0 | 63 | /* From the NAME or LIBRARY command. */ |
e47d05ad KH |
64 | char *name; |
65 | int is_dll; /* -1 if NAME/LIBRARY not given */ | |
66 | bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */ | |
67 | ||
939ba9d0 | 68 | /* From the DESCRIPTION command. */ |
e47d05ad KH |
69 | char *description; |
70 | ||
939ba9d0 | 71 | /* From the STACK/HEAP command, -1 if unspecified. */ |
e47d05ad KH |
72 | int stack_reserve, stack_commit; |
73 | int heap_reserve, heap_commit; | |
74 | ||
939ba9d0 | 75 | /* From the SECTION/SEGMENT commands. */ |
e47d05ad KH |
76 | int num_section_defs; |
77 | def_file_section *section_defs; | |
78 | ||
939ba9d0 | 79 | /* From the EXPORTS commands. */ |
e47d05ad KH |
80 | int num_exports; |
81 | def_file_export *exports; | |
82 | ||
939ba9d0 | 83 | /* Used by imports for module names. */ |
e47d05ad KH |
84 | def_file_module *modules; |
85 | ||
939ba9d0 | 86 | /* From the IMPORTS commands. */ |
e47d05ad KH |
87 | int num_imports; |
88 | def_file_import *imports; | |
89 | ||
939ba9d0 | 90 | /* From the VERSION command, -1 if not specified. */ |
e47d05ad | 91 | int version_major, version_minor; |
c1711530 DK |
92 | |
93 | /* Only expected from .drectve sections, not .DEF files. */ | |
94 | def_file_aligncomm *aligncomms; | |
95 | ||
e47d05ad | 96 | } def_file; |
252b5132 | 97 | |
1579bae1 | 98 | extern def_file *def_file_empty (void); |
252b5132 | 99 | |
939ba9d0 | 100 | /* The second arg may be NULL. If not, this .def is appended to it. */ |
1579bae1 AM |
101 | extern def_file *def_file_parse (const char *, def_file *); |
102 | extern void def_file_free (def_file *); | |
103 | extern def_file_export *def_file_add_export (def_file *, const char *, | |
104 | const char *, int); | |
105 | extern def_file_import *def_file_add_import (def_file *, const char *, | |
106 | const char *, int, const char *); | |
107 | extern void def_file_add_directive (def_file *, const char *, int); | |
108 | extern def_file_module *def_get_module (def_file *, const char *); | |
252b5132 | 109 | #ifdef DEF_FILE_PRINT |
1579bae1 | 110 | extern void def_file_print (FILE *, def_file *); |
252b5132 | 111 | #endif |
1069dd8d ILT |
112 | |
113 | #endif /* DEFFILE_H */ |