Home | History | Annotate | Download | only in ld
      1 /* deffile.h - header for .DEF file parser
      2    Copyright (C) 1998-2016 Free Software Foundation, Inc.
      3    Written by DJ Delorie dj (at) cygnus.com
      4 
      5    This file is part of the GNU Binutils.
      6 
      7    This program 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 3, or (at your option)
     10    any later version.
     11 
     12    The program 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, 51 Franklin Street - Fifth Floor, Boston, MA
     20    02110-1301, USA.  */
     21 
     22 #ifndef DEFFILE_H
     23 #define DEFFILE_H
     24 
     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.  */
     27 
     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;
     33 
     34 typedef struct def_file_export {
     35   char *name;			/* always set */
     36   char *internal_name;		/* always set, may == name */
     37   char *its_name;		/* optional export table name refered to. */
     38   int ordinal;			/* -1 if not specified */
     39   int hint;
     40   char flag_private, flag_constant, flag_noname, flag_data, flag_forward;
     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   char *its_name;		/* optional import table name refered to. */
     54   int ordinal;			/* may be -1 */
     55   int data;			/* = 1 if data */
     56 } def_file_import;
     57 
     58 typedef struct def_file_aligncomm {
     59   struct def_file_aligncomm *next;	/* Chain pointer.  */
     60   char *symbol_name;		/* Name of common symbol.  */
     61   unsigned int alignment;	/* log-2 alignment.        */
     62 } def_file_aligncomm;
     63 
     64 typedef struct def_file {
     65   /* From the NAME or LIBRARY command.  */
     66   char *name;
     67   int is_dll;			/* -1 if NAME/LIBRARY not given */
     68   bfd_vma base_address;		/* (bfd_vma)(-1) if unspecified */
     69 
     70   /* From the DESCRIPTION command.  */
     71   char *description;
     72 
     73   /* From the STACK/HEAP command, -1 if unspecified.  */
     74   int stack_reserve, stack_commit;
     75   int heap_reserve, heap_commit;
     76 
     77   /* From the SECTION/SEGMENT commands.  */
     78   int num_section_defs;
     79   def_file_section *section_defs;
     80 
     81   /* From the EXPORTS commands.  */
     82   int num_exports;
     83   def_file_export *exports;
     84 
     85   /* Used by imports for module names.  */
     86   def_file_module *modules;
     87 
     88   /* From the IMPORTS commands.  */
     89   int num_imports;
     90   def_file_import *imports;
     91 
     92   /* From the VERSION command, -1 if not specified.  */
     93   int version_major, version_minor;
     94 
     95   /* Only expected from .drectve sections, not .DEF files.  */
     96   def_file_aligncomm *aligncomms;
     97 
     98 } def_file;
     99 
    100 extern def_file *def_file_empty (void);
    101 
    102 /* The second arg may be NULL.  If not, this .def is appended to it.  */
    103 extern def_file *def_file_parse (const char *, def_file *);
    104 extern void def_file_free (def_file *);
    105 extern def_file_export *def_file_add_export (def_file *, const char *,
    106 					     const char *, int,
    107 					     const char *, int *);
    108 extern def_file_import *def_file_add_import (def_file *, const char *,
    109 					     const char *, int, const char *,
    110 					     const char *, int *);
    111 extern void def_file_add_directive (def_file *, const char *, int);
    112 extern def_file_module *def_get_module (def_file *, const char *);
    113 #ifdef DEF_FILE_PRINT
    114 extern void def_file_print (FILE *, def_file *);
    115 #endif
    116 
    117 #endif /* DEFFILE_H */
    118