This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / ld / deffile.h
1 /* deffile.h - header for .DEF file parser
2    Copyright (C) 1998, 1999 Free Software Foundation, Inc.
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
22 #ifndef DEFFILE_H
23 #define DEFFILE_H
24
25 #include "ansidecl.h"
26
27 /* DEF storage definitions.  Note that any ordinal may be zero, and
28    any pointer may be NULL, if not defined by the DEF file. */
29
30 typedef struct def_file_section
31   {
32     char *name;                 /* always set */
33     char *class;                /* may be NULL */
34     char flag_read, flag_write, flag_execute, flag_shared;
35   }
36 def_file_section;
37
38 typedef struct def_file_export
39   {
40     char *name;                 /* always set */
41     char *internal_name;        /* always set, may == name */
42     int ordinal;                /* -1 if not specified */
43     int hint;
44     char flag_private, flag_constant, flag_noname, flag_data;
45   }
46 def_file_export;
47
48 typedef struct def_file_module
49   {
50     struct def_file_module *next;
51     void *user_data;
52     char name[1]; /* extended via malloc */
53   }
54 def_file_module;
55
56 typedef struct def_file_import
57   {
58     char *internal_name;        /* always set */
59     def_file_module *module;    /* always set */
60     char *name;                 /* may be NULL; either this or ordinal will be set */
61     int ordinal;                /* may be -1 */
62   }
63 def_file_import;
64
65 typedef struct def_file
66   {
67
68     /* from the NAME or LIBRARY command */
69     char *name;
70     int is_dll;                 /* -1 if NAME/LIBRARY not given */
71     bfd_vma base_address;       /* (bfd_vma)(-1) if unspecified */
72
73     /* from the DESCRIPTION command */
74     char *description;
75
76     /* from the STACK/HEAP command, -1 if unspecified */
77     int stack_reserve, stack_commit;
78     int heap_reserve, heap_commit;
79
80     /* from the SECTION/SEGMENT commands */
81     int num_section_defs;
82     def_file_section *section_defs;
83
84     /* from the EXPORTS commands */
85     int num_exports;
86     def_file_export *exports;
87
88     /* used by imports for module names */
89     def_file_module *modules;
90
91     /* from the IMPORTS commands */
92     int num_imports;
93     def_file_import *imports;
94
95     /* from the VERSION command, -1 if not specified */
96     int version_major, version_minor;
97   }
98 def_file;
99
100 extern def_file *def_file_empty PARAMS ((void));
101
102 /* add_to may be NULL.  If not, this .def is appended to it */
103 extern def_file *def_file_parse PARAMS ((const char *_filename,
104                                          def_file * _add_to));
105
106 extern void def_file_free PARAMS ((def_file * _def));
107
108 extern def_file_export *def_file_add_export PARAMS ((def_file * _def,
109                                                      const char *_name,
110                                                  const char *_internal_name,
111                                                      int _ordinal));
112
113 extern def_file_import *def_file_add_import PARAMS ((def_file * _def,
114                                                      const char *_name,
115                                                      const char *_from,
116                                                      int _ordinal,
117                                                const char *_imported_name));
118
119 extern void def_file_add_directive PARAMS ((def_file * _def,
120                                             const char *param,
121                                             int len));
122
123 #ifdef DEF_FILE_PRINT
124 extern void def_file_print PARAMS ((FILE * _file,
125                                     def_file * _def));
126 #endif
127
128 #endif /* DEFFILE_H */