deffile.h revision 60484
160484Sobrien/* deffile.h - header for .DEF file parser 260484Sobrien Copyright (C) 1998, 1999 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 1960484Sobrien Software Foundation, 59 Temple Place - Suite 330, Boston, MA 2060484Sobrien 02111-1307, USA. */ 2160484Sobrien 2260484Sobrien#ifndef DEFFILE_H 2360484Sobrien#define DEFFILE_H 2460484Sobrien 2560484Sobrien#include "ansidecl.h" 2660484Sobrien 2760484Sobrien/* DEF storage definitions. Note that any ordinal may be zero, and 2860484Sobrien any pointer may be NULL, if not defined by the DEF file. */ 2960484Sobrien 3060484Sobrientypedef struct def_file_section 3160484Sobrien { 3260484Sobrien char *name; /* always set */ 3360484Sobrien char *class; /* may be NULL */ 3460484Sobrien char flag_read, flag_write, flag_execute, flag_shared; 3560484Sobrien } 3660484Sobriendef_file_section; 3760484Sobrien 3860484Sobrientypedef struct def_file_export 3960484Sobrien { 4060484Sobrien char *name; /* always set */ 4160484Sobrien char *internal_name; /* always set, may == name */ 4260484Sobrien int ordinal; /* -1 if not specified */ 4360484Sobrien int hint; 4460484Sobrien char flag_private, flag_constant, flag_noname, flag_data; 4560484Sobrien } 4660484Sobriendef_file_export; 4760484Sobrien 4860484Sobrientypedef struct def_file_module 4960484Sobrien { 5060484Sobrien struct def_file_module *next; 5160484Sobrien void *user_data; 5260484Sobrien char name[1]; /* extended via malloc */ 5360484Sobrien } 5460484Sobriendef_file_module; 5560484Sobrien 5660484Sobrientypedef struct def_file_import 5760484Sobrien { 5860484Sobrien char *internal_name; /* always set */ 5960484Sobrien def_file_module *module; /* always set */ 6060484Sobrien char *name; /* may be NULL; either this or ordinal will be set */ 6160484Sobrien int ordinal; /* may be -1 */ 6260484Sobrien } 6360484Sobriendef_file_import; 6460484Sobrien 6560484Sobrientypedef struct def_file 6660484Sobrien { 6760484Sobrien 6860484Sobrien /* from the NAME or LIBRARY command */ 6960484Sobrien char *name; 7060484Sobrien int is_dll; /* -1 if NAME/LIBRARY not given */ 7160484Sobrien bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */ 7260484Sobrien 7360484Sobrien /* from the DESCRIPTION command */ 7460484Sobrien char *description; 7560484Sobrien 7660484Sobrien /* from the STACK/HEAP command, -1 if unspecified */ 7760484Sobrien int stack_reserve, stack_commit; 7860484Sobrien int heap_reserve, heap_commit; 7960484Sobrien 8060484Sobrien /* from the SECTION/SEGMENT commands */ 8160484Sobrien int num_section_defs; 8260484Sobrien def_file_section *section_defs; 8360484Sobrien 8460484Sobrien /* from the EXPORTS commands */ 8560484Sobrien int num_exports; 8660484Sobrien def_file_export *exports; 8760484Sobrien 8860484Sobrien /* used by imports for module names */ 8960484Sobrien def_file_module *modules; 9060484Sobrien 9160484Sobrien /* from the IMPORTS commands */ 9260484Sobrien int num_imports; 9360484Sobrien def_file_import *imports; 9460484Sobrien 9560484Sobrien /* from the VERSION command, -1 if not specified */ 9660484Sobrien int version_major, version_minor; 9760484Sobrien } 9860484Sobriendef_file; 9960484Sobrien 10060484Sobrienextern def_file *def_file_empty PARAMS ((void)); 10160484Sobrien 10260484Sobrien/* add_to may be NULL. If not, this .def is appended to it */ 10360484Sobrienextern def_file *def_file_parse PARAMS ((const char *_filename, 10460484Sobrien def_file * _add_to)); 10560484Sobrien 10660484Sobrienextern void def_file_free PARAMS ((def_file * _def)); 10760484Sobrien 10860484Sobrienextern def_file_export *def_file_add_export PARAMS ((def_file * _def, 10960484Sobrien const char *_name, 11060484Sobrien const char *_internal_name, 11160484Sobrien int _ordinal)); 11260484Sobrien 11360484Sobrienextern def_file_import *def_file_add_import PARAMS ((def_file * _def, 11460484Sobrien const char *_name, 11560484Sobrien const char *_from, 11660484Sobrien int _ordinal, 11760484Sobrien const char *_imported_name)); 11860484Sobrien 11960484Sobrienextern void def_file_add_directive PARAMS ((def_file * _def, 12060484Sobrien const char *param, 12160484Sobrien int len)); 12260484Sobrien 12360484Sobrien#ifdef DEF_FILE_PRINT 12460484Sobrienextern void def_file_print PARAMS ((FILE * _file, 12560484Sobrien def_file * _def)); 12660484Sobrien#endif 12760484Sobrien 12860484Sobrien#endif /* DEFFILE_H */ 129