Back to index

cell-binutils  2.17cvs20070401
deffile.h
Go to the documentation of this file.
00001 /* deffile.h - header for .DEF file parser
00002    Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
00003    Written by DJ Delorie dj@cygnus.com
00004 
00005    This file is part of GLD, the Gnu Linker.
00006 
00007    GLD is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2, or (at your option)
00010    any later version.
00011 
00012    GLD is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with GLD; see the file COPYING.  If not, write to the Free
00019    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00020    02110-1301, USA.  */
00021 
00022 #ifndef DEFFILE_H
00023 #define DEFFILE_H
00024 
00025 /* DEF storage definitions.  Note that any ordinal may be zero, and
00026    any pointer may be NULL, if not defined by the DEF file.  */
00027 
00028 typedef struct def_file_section {
00029   char *name;               /* always set */
00030   char *class;                     /* may be NULL */
00031   char flag_read, flag_write, flag_execute, flag_shared;
00032 } def_file_section;
00033 
00034 typedef struct def_file_export {
00035   char *name;               /* always set */
00036   char *internal_name;             /* always set, may == name */
00037   int ordinal;                     /* -1 if not specified */
00038   int hint;
00039   char flag_private, flag_constant, flag_noname, flag_data, flag_forward;
00040 } def_file_export;
00041 
00042 typedef struct def_file_module {
00043   struct def_file_module *next;
00044   void *user_data;
00045   char name[1];                    /* extended via malloc */
00046 } def_file_module;
00047 
00048 typedef struct def_file_import {
00049   char *internal_name;             /* always set */
00050   def_file_module *module;  /* always set */
00051   char *name;               /* may be NULL; either this or ordinal will be set */
00052   int ordinal;                     /* may be -1 */
00053   int data;                 /* = 1 if data */
00054 } def_file_import;
00055 
00056 typedef struct def_file {
00057   /* From the NAME or LIBRARY command.  */
00058   char *name;
00059   int is_dll;               /* -1 if NAME/LIBRARY not given */
00060   bfd_vma base_address;            /* (bfd_vma)(-1) if unspecified */
00061 
00062   /* From the DESCRIPTION command.  */
00063   char *description;
00064 
00065   /* From the STACK/HEAP command, -1 if unspecified.  */
00066   int stack_reserve, stack_commit;
00067   int heap_reserve, heap_commit;
00068 
00069   /* From the SECTION/SEGMENT commands.  */
00070   int num_section_defs;
00071   def_file_section *section_defs;
00072 
00073   /* From the EXPORTS commands.  */
00074   int num_exports;
00075   def_file_export *exports;
00076 
00077   /* Used by imports for module names.  */
00078   def_file_module *modules;
00079 
00080   /* From the IMPORTS commands.  */
00081   int num_imports;
00082   def_file_import *imports;
00083 
00084   /* From the VERSION command, -1 if not specified.  */
00085   int version_major, version_minor;
00086 } def_file;
00087 
00088 extern def_file *def_file_empty (void);
00089 
00090 /* The second arg may be NULL.  If not, this .def is appended to it.  */
00091 extern def_file *def_file_parse (const char *, def_file *);
00092 extern void def_file_free (def_file *);
00093 extern def_file_export *def_file_add_export (def_file *, const char *,
00094                                         const char *, int);
00095 extern def_file_import *def_file_add_import (def_file *, const char *,
00096                                         const char *, int, const char *);
00097 extern void def_file_add_directive (def_file *, const char *, int);
00098 extern def_file_module *def_get_module (def_file *, const char *);
00099 #ifdef DEF_FILE_PRINT
00100 extern void def_file_print (FILE *, def_file *);
00101 #endif
00102 
00103 #endif /* DEFFILE_H */