2007-02-10 Paolo Bonzini <bonzini@gnu.org>
[binutils.git] / ld / deffile.h
blob6db8bf79d0357fc245e41de98ae0a0b48349400b
1 /* deffile.h - header for .DEF file parser
2 Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
3 Written by DJ Delorie dj@cygnus.com
5 This file is part of GLD, the Gnu Linker.
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.
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.
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, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
22 #ifndef DEFFILE_H
23 #define DEFFILE_H
25 /* DEF storage definitions. Note that any ordinal may be zero, and
26 any pointer may be NULL, if not defined by the DEF file. */
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;
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;
39 char flag_private, flag_constant, flag_noname, flag_data, flag_forward;
40 } def_file_export;
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;
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 */
53 int data; /* = 1 if data */
54 } def_file_import;
56 typedef struct def_file {
57 /* From the NAME or LIBRARY command. */
58 char *name;
59 int is_dll; /* -1 if NAME/LIBRARY not given */
60 bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */
62 /* From the DESCRIPTION command. */
63 char *description;
65 /* From the STACK/HEAP command, -1 if unspecified. */
66 int stack_reserve, stack_commit;
67 int heap_reserve, heap_commit;
69 /* From the SECTION/SEGMENT commands. */
70 int num_section_defs;
71 def_file_section *section_defs;
73 /* From the EXPORTS commands. */
74 int num_exports;
75 def_file_export *exports;
77 /* Used by imports for module names. */
78 def_file_module *modules;
80 /* From the IMPORTS commands. */
81 int num_imports;
82 def_file_import *imports;
84 /* From the VERSION command, -1 if not specified. */
85 int version_major, version_minor;
86 } def_file;
88 extern def_file *def_file_empty (void);
90 /* The second arg may be NULL. If not, this .def is appended to it. */
91 extern def_file *def_file_parse (const char *, def_file *);
92 extern void def_file_free (def_file *);
93 extern def_file_export *def_file_add_export (def_file *, const char *,
94 const char *, int);
95 extern def_file_import *def_file_add_import (def_file *, const char *,
96 const char *, int, const char *);
97 extern void def_file_add_directive (def_file *, const char *, int);
98 extern def_file_module *def_get_module (def_file *, const char *);
99 #ifdef DEF_FILE_PRINT
100 extern void def_file_print (FILE *, def_file *);
101 #endif
103 #endif /* DEFFILE_H */