Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* deffile.h - header for .DEF file parser |
aa820537 AM |
2 | Copyright 1998, 1999, 2000, 2002, 2003, 2005, 2006, 2007, 2009 |
3 | Free Software Foundation, Inc. | |
252b5132 RH |
4 | Written by DJ Delorie dj@cygnus.com |
5 | ||
f96b4a7b | 6 | This file is part of the GNU Binutils. |
252b5132 | 7 | |
f96b4a7b | 8 | This program is free software; you can redistribute it and/or modify |
252b5132 | 9 | it under the terms of the GNU General Public License as published by |
f96b4a7b | 10 | the Free Software Foundation; either version 3, or (at your option) |
252b5132 RH |
11 | any later version. |
12 | ||
f96b4a7b | 13 | The program is distributed in the hope that it will be useful, |
252b5132 RH |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GLD; see the file COPYING. If not, write to the Free | |
75be928b NC |
20 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
21 | 02110-1301, USA. */ | |
252b5132 | 22 | |
1069dd8d ILT |
23 | #ifndef DEFFILE_H |
24 | #define DEFFILE_H | |
25 | ||
252b5132 | 26 | /* DEF storage definitions. Note that any ordinal may be zero, and |
5cc18311 | 27 | any pointer may be NULL, if not defined by the DEF file. */ |
252b5132 | 28 | |
e47d05ad KH |
29 | typedef struct def_file_section { |
30 | char *name; /* always set */ | |
31 | char *class; /* may be NULL */ | |
32 | char flag_read, flag_write, flag_execute, flag_shared; | |
33 | } def_file_section; | |
34 | ||
35 | typedef struct def_file_export { | |
36 | char *name; /* always set */ | |
37 | char *internal_name; /* always set, may == name */ | |
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 */ | |
53 | int ordinal; /* may be -1 */ | |
939ba9d0 | 54 | int data; /* = 1 if data */ |
e47d05ad KH |
55 | } def_file_import; |
56 | ||
c1711530 DK |
57 | typedef struct def_file_aligncomm { |
58 | struct def_file_aligncomm *next; /* Chain pointer. */ | |
59 | char *symbol_name; /* Name of common symbol. */ | |
60 | unsigned int alignment; /* log-2 alignment. */ | |
61 | } def_file_aligncomm; | |
62 | ||
e47d05ad | 63 | typedef struct def_file { |
939ba9d0 | 64 | /* From the NAME or LIBRARY command. */ |
e47d05ad KH |
65 | char *name; |
66 | int is_dll; /* -1 if NAME/LIBRARY not given */ | |
67 | bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */ | |
68 | ||
939ba9d0 | 69 | /* From the DESCRIPTION command. */ |
e47d05ad KH |
70 | char *description; |
71 | ||
939ba9d0 | 72 | /* From the STACK/HEAP command, -1 if unspecified. */ |
e47d05ad KH |
73 | int stack_reserve, stack_commit; |
74 | int heap_reserve, heap_commit; | |
75 | ||
939ba9d0 | 76 | /* From the SECTION/SEGMENT commands. */ |
e47d05ad KH |
77 | int num_section_defs; |
78 | def_file_section *section_defs; | |
79 | ||
939ba9d0 | 80 | /* From the EXPORTS commands. */ |
e47d05ad KH |
81 | int num_exports; |
82 | def_file_export *exports; | |
83 | ||
939ba9d0 | 84 | /* Used by imports for module names. */ |
e47d05ad KH |
85 | def_file_module *modules; |
86 | ||
939ba9d0 | 87 | /* From the IMPORTS commands. */ |
e47d05ad KH |
88 | int num_imports; |
89 | def_file_import *imports; | |
90 | ||
939ba9d0 | 91 | /* From the VERSION command, -1 if not specified. */ |
e47d05ad | 92 | int version_major, version_minor; |
c1711530 DK |
93 | |
94 | /* Only expected from .drectve sections, not .DEF files. */ | |
95 | def_file_aligncomm *aligncomms; | |
96 | ||
e47d05ad | 97 | } def_file; |
252b5132 | 98 | |
1579bae1 | 99 | extern def_file *def_file_empty (void); |
252b5132 | 100 | |
939ba9d0 | 101 | /* The second arg may be NULL. If not, this .def is appended to it. */ |
1579bae1 AM |
102 | extern def_file *def_file_parse (const char *, def_file *); |
103 | extern void def_file_free (def_file *); | |
104 | extern def_file_export *def_file_add_export (def_file *, const char *, | |
105 | const char *, int); | |
106 | extern def_file_import *def_file_add_import (def_file *, const char *, | |
107 | const char *, int, const char *); | |
108 | extern void def_file_add_directive (def_file *, const char *, int); | |
109 | extern def_file_module *def_get_module (def_file *, const char *); | |
252b5132 | 110 | #ifdef DEF_FILE_PRINT |
1579bae1 | 111 | extern void def_file_print (FILE *, def_file *); |
252b5132 | 112 | #endif |
1069dd8d ILT |
113 | |
114 | #endif /* DEFFILE_H */ |