160484Sobrien/* deffile.h - header for .DEF file parser
2130561Sobrien   Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
360484Sobrien   Written by DJ Delorie dj@cygnus.com
460484Sobrien
560484Sobrien   This file is part of GLD, the Gnu Linker.
660484Sobrien
760484Sobrien   GLD is free software; you can redistribute it and/or modify
860484Sobrien   it under the terms of the GNU General Public License as published by
960484Sobrien   the Free Software Foundation; either version 2, or (at your option)
1060484Sobrien   any later version.
1160484Sobrien
1260484Sobrien   GLD is distributed in the hope that it will be useful,
1360484Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1460484Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1560484Sobrien   GNU General Public License for more details.
1660484Sobrien
1760484Sobrien   You should have received a copy of the GNU General Public License
1860484Sobrien   along with GLD; see the file COPYING.  If not, write to the Free
19218822Sdim   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20218822Sdim   02110-1301, USA.  */
2160484Sobrien
2260484Sobrien#ifndef DEFFILE_H
2360484Sobrien#define DEFFILE_H
2460484Sobrien
2560484Sobrien/* DEF storage definitions.  Note that any ordinal may be zero, and
2677298Sobrien   any pointer may be NULL, if not defined by the DEF file.  */
2760484Sobrien
2877298Sobrientypedef struct def_file_section {
2977298Sobrien  char *name;			/* always set */
3077298Sobrien  char *class;			/* may be NULL */
3177298Sobrien  char flag_read, flag_write, flag_execute, flag_shared;
3277298Sobrien} def_file_section;
3360484Sobrien
3477298Sobrientypedef struct def_file_export {
3577298Sobrien  char *name;			/* always set */
3677298Sobrien  char *internal_name;		/* always set, may == name */
3777298Sobrien  int ordinal;			/* -1 if not specified */
3877298Sobrien  int hint;
39218822Sdim  char flag_private, flag_constant, flag_noname, flag_data, flag_forward;
4077298Sobrien} def_file_export;
4160484Sobrien
4277298Sobrientypedef struct def_file_module {
4377298Sobrien  struct def_file_module *next;
4477298Sobrien  void *user_data;
4577298Sobrien  char name[1];			/* extended via malloc */
4677298Sobrien} def_file_module;
4760484Sobrien
4877298Sobrientypedef struct def_file_import {
4977298Sobrien  char *internal_name;		/* always set */
5077298Sobrien  def_file_module *module;	/* always set */
5177298Sobrien  char *name;			/* may be NULL; either this or ordinal will be set */
5277298Sobrien  int ordinal;			/* may be -1 */
53130561Sobrien  int data;			/* = 1 if data */
5477298Sobrien} def_file_import;
5560484Sobrien
5677298Sobrientypedef struct def_file {
57130561Sobrien  /* From the NAME or LIBRARY command.  */
5877298Sobrien  char *name;
5977298Sobrien  int is_dll;			/* -1 if NAME/LIBRARY not given */
6077298Sobrien  bfd_vma base_address;		/* (bfd_vma)(-1) if unspecified */
6160484Sobrien
62130561Sobrien  /* From the DESCRIPTION command.  */
6377298Sobrien  char *description;
6460484Sobrien
65130561Sobrien  /* From the STACK/HEAP command, -1 if unspecified.  */
6677298Sobrien  int stack_reserve, stack_commit;
6777298Sobrien  int heap_reserve, heap_commit;
6860484Sobrien
69130561Sobrien  /* From the SECTION/SEGMENT commands.  */
7077298Sobrien  int num_section_defs;
7177298Sobrien  def_file_section *section_defs;
7260484Sobrien
73130561Sobrien  /* From the EXPORTS commands.  */
7477298Sobrien  int num_exports;
7577298Sobrien  def_file_export *exports;
7660484Sobrien
77130561Sobrien  /* Used by imports for module names.  */
7877298Sobrien  def_file_module *modules;
7960484Sobrien
80130561Sobrien  /* From the IMPORTS commands.  */
8177298Sobrien  int num_imports;
8277298Sobrien  def_file_import *imports;
8360484Sobrien
84130561Sobrien  /* From the VERSION command, -1 if not specified.  */
8577298Sobrien  int version_major, version_minor;
8677298Sobrien} def_file;
8760484Sobrien
88130561Sobrienextern def_file *def_file_empty (void);
8960484Sobrien
90130561Sobrien/* The second arg may be NULL.  If not, this .def is appended to it.  */
91130561Sobrienextern def_file *def_file_parse (const char *, def_file *);
92130561Sobrienextern void def_file_free (def_file *);
93130561Sobrienextern def_file_export *def_file_add_export (def_file *, const char *,
94130561Sobrien					     const char *, int);
95130561Sobrienextern def_file_import *def_file_add_import (def_file *, const char *,
96130561Sobrien					     const char *, int, const char *);
97130561Sobrienextern void def_file_add_directive (def_file *, const char *, int);
98130561Sobrienextern def_file_module *def_get_module (def_file *, const char *);
9960484Sobrien#ifdef DEF_FILE_PRINT
100130561Sobrienextern void def_file_print (FILE *, def_file *);
10160484Sobrien#endif
10260484Sobrien
10360484Sobrien#endif /* DEFFILE_H */
104