* elf32-spu.c (build_stub): Fix malloc under-allocation.
[binutils.git] / ld / deffile.h
blobca8c7795bab807691764452f061e1e88d27023a6
1 /* deffile.h - header for .DEF file parser
2 Copyright 1998, 1999, 2000, 2002, 2003, 2005, 2006, 2007, 2009
3 Free Software Foundation, Inc.
4 Written by DJ Delorie dj@cygnus.com
6 This file is part of the GNU Binutils.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 The program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GLD; see the file COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21 02110-1301, USA. */
23 #ifndef DEFFILE_H
24 #define DEFFILE_H
26 /* DEF storage definitions. Note that any ordinal may be zero, and
27 any pointer may be NULL, if not defined by the DEF file. */
29 typedef struct def_file_section {
30 char *name; /* always set */
31 char *class; /* may be NULL */
32 char flag_read, flag_write, flag_execute, flag_shared;
33 } def_file_section;
35 typedef struct def_file_export {
36 char *name; /* always set */
37 char *internal_name; /* always set, may == name */
38 char *its_name; /* optional export table name refered to. */
39 int ordinal; /* -1 if not specified */
40 int hint;
41 char flag_private, flag_constant, flag_noname, flag_data, flag_forward;
42 } def_file_export;
44 typedef struct def_file_module {
45 struct def_file_module *next;
46 void *user_data;
47 char name[1]; /* extended via malloc */
48 } def_file_module;
50 typedef struct def_file_import {
51 char *internal_name; /* always set */
52 def_file_module *module; /* always set */
53 char *name; /* may be NULL; either this or ordinal will be set */
54 char *its_name; /* optional import table name refered to. */
55 int ordinal; /* may be -1 */
56 int data; /* = 1 if data */
57 } def_file_import;
59 typedef struct def_file_aligncomm {
60 struct def_file_aligncomm *next; /* Chain pointer. */
61 char *symbol_name; /* Name of common symbol. */
62 unsigned int alignment; /* log-2 alignment. */
63 } def_file_aligncomm;
65 typedef struct def_file {
66 /* From the NAME or LIBRARY command. */
67 char *name;
68 int is_dll; /* -1 if NAME/LIBRARY not given */
69 bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */
71 /* From the DESCRIPTION command. */
72 char *description;
74 /* From the STACK/HEAP command, -1 if unspecified. */
75 int stack_reserve, stack_commit;
76 int heap_reserve, heap_commit;
78 /* From the SECTION/SEGMENT commands. */
79 int num_section_defs;
80 def_file_section *section_defs;
82 /* From the EXPORTS commands. */
83 int num_exports;
84 def_file_export *exports;
86 /* Used by imports for module names. */
87 def_file_module *modules;
89 /* From the IMPORTS commands. */
90 int num_imports;
91 def_file_import *imports;
93 /* From the VERSION command, -1 if not specified. */
94 int version_major, version_minor;
96 /* Only expected from .drectve sections, not .DEF files. */
97 def_file_aligncomm *aligncomms;
99 } def_file;
101 extern def_file *def_file_empty (void);
103 /* The second arg may be NULL. If not, this .def is appended to it. */
104 extern def_file *def_file_parse (const char *, def_file *);
105 extern void def_file_free (def_file *);
106 extern def_file_export *def_file_add_export (def_file *, const char *,
107 const char *, int,
108 const char *, int *);
109 extern def_file_import *def_file_add_import (def_file *, const char *,
110 const char *, int, const char *,
111 const char *, int *);
112 extern void def_file_add_directive (def_file *, const char *, int);
113 extern def_file_module *def_get_module (def_file *, const char *);
114 #ifdef DEF_FILE_PRINT
115 extern void def_file_print (FILE *, def_file *);
116 #endif
118 #endif /* DEFFILE_H */